/* ===========================================================
   AI 사이트 진단 — 플로팅 카드 + URL 입력 모달
   독립 스타일(aidx- 네임스페이스). 시안: bg rgba(0,0,0,.8) / accent #0057FF / Pretendard
   PC 전용 (≤1024px 비노출)
   =========================================================== */
:root {
    --aidx-accent: #0057FF;
    --aidx-bg: rgba(0, 0, 0, .82);
    --aidx-line: rgba(255, 255, 255, .1);
    --aidx-white: #fff;
    --aidx-muted: rgba(255, 255, 255, .6);
    --aidx-font: 'Pretendard', system-ui, -apple-system, sans-serif;
    /* 점수 팔레트 (D/C/B/A) */
    --aidx-red: #EF5A5A;
    --aidx-orange: #F4A261;
    --aidx-blue: #4F8EF7;
    --aidx-teal: #0057FF;   /* 기존 초록(#00C9B1) → 블루(#0057FF) 통일 */
}

/* ---------- 플로팅 카드 (우하단) ---------- */
.aidx-card {
    position: fixed; z-index: 200;
    right: clamp(20px, 3vw, 40px); bottom: clamp(20px, 4vh, 44px);
    width: 578px; min-height: 150px; box-sizing: border-box;
    display: flex; gap: 22px; align-items: center;
    padding: 24px 26px;
    background: var(--aidx-bg); border: 1px solid var(--aidx-line);
    border-radius: 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
    font-family: var(--aidx-font); color: var(--aidx-white);
    cursor: pointer;
    transform: translateY(12px); opacity: 0;
    transition: opacity .4s ease, transform .4s ease;
}
.aidx-card__pill {
    position: absolute; top: -13px; left: 22px;
    background: var(--aidx-accent); color: #fff;
    font-size: 13px; font-weight: 600; line-height: 1;
    padding: 6px 14px; border-radius: 20px;
}
.aidx-card.is-in { opacity: 1; transform: none; }
.aidx-card[hidden] { display: none; }
.aidx-card:hover { border-color: rgba(0, 87, 255, .5); }

.aidx-card__orb {
    flex: none; width: 96px; height: 96px; border-radius: 18px; overflow: hidden;
    background: #04060f;
}
.aidx-card__orb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.aidx-card__body { min-width: 0; flex: 1; }
.aidx-card__tag { font-size: 20px; font-weight: 700; line-height: 1.2; }
.aidx-card__sub { margin-top: 6px; font-size: 13px; font-weight: 400; color: var(--aidx-muted); line-height: 1.4; }
.aidx-card__cta {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 12px; font-size: 13px; font-weight: 500; color: var(--aidx-white);
    border-bottom: 1px solid rgba(255, 255, 255, .5); padding-bottom: 2px;
    float: right;
}
.aidx-card__close {
    position: absolute; top: 10px; right: 10px;
    width: 24px; height: 24px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .08); border: 0; border-radius: 50%;
    color: var(--aidx-muted); cursor: pointer; transition: color .2s, background .2s;
}
.aidx-card__close:hover { color: #fff; background: rgba(255, 255, 255, .16); }

/* 카드 표시 중엔 '맨 위로' 버튼을 카드 위로 밀어올림 (kida.css 미수정, 여기서 오버라이드) */
body.aidx-card-on .to-top { bottom: 210px; }

/* ---------- URL 입력 모달 ---------- */
/* 배경 스크롤 잠그지 않음 — 모달이 떠 있어도 뒤의 KIDA 사이트가 스크롤되어야 함 */
.aidx-modal {
    position: fixed; inset: 0; z-index: 1100;
    display: flex; align-items: center; justify-content: center; padding: 24px;
    font-family: var(--aidx-font);
}
.aidx-modal[hidden] { display: none; }
.aidx-modal__overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.aidx-modal__dialog {
    position: relative; box-sizing: border-box;
    width: min(640px, 100%); max-height: 90vh; overflow-y: auto;
    padding: 40px 44px;
    background: #0D1829; border: 1px solid var(--aidx-line);
    border-radius: 16px; box-shadow: 0 28px 70px rgba(0, 0, 0, .55);
    color: var(--aidx-white);
    opacity: 0; transform: translateY(14px) scale(.98);
    transition: opacity .25s ease, transform .25s ease;
}
.aidx-modal.is-open .aidx-modal__dialog { opacity: 1; transform: none; }

.aidx-modal__pill {
    display: inline-block; background: var(--aidx-accent); color: #fff;
    font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 20px;
}
.aidx-modal__close {
    position: absolute; top: 32px; right: 36px;
    width: 40px; height: 40px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .12); border: 0; border-radius: 50%;
    color: var(--aidx-muted); cursor: pointer; transition: color .2s, background .2s;
}
.aidx-modal__close:hover { color: #fff; background: rgba(255, 255, 255, .2); }

.aidx-modal__spark { display: block; margin: 26px 0 14px; color: var(--aidx-accent); line-height: 0; }
.aidx-modal__title { font-size: 24px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.aidx-accent { color: var(--aidx-accent); }
.aidx-modal__sub { margin-top: 14px; font-size: 16px; font-weight: 400; line-height: 1.45; color: var(--aidx-muted); }

.aidx-modal__form { display: flex; gap: 10px; margin-top: 26px; }
.aidx-modal__input {
    flex: 1; min-width: 0; box-sizing: border-box; height: 48px; padding: 0 16px;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px; color: #fff; font: 400 14px/1 var(--aidx-font);
    outline: none; transition: border-color .2s;
}
.aidx-modal__input::placeholder { color: var(--aidx-muted); }
.aidx-modal__input:focus { border-color: rgba(0, 87, 255, .6); }
.aidx-modal__submit {
    flex: none; height: 48px; padding: 0 24px;
    background: var(--aidx-accent); border: 0; border-radius: 8px;
    color: #fff; font: 700 14px/1 var(--aidx-font); cursor: pointer;
    transition: filter .2s; white-space: nowrap;
}
.aidx-modal__submit:hover { filter: brightness(1.1); }

.aidx-modal__helper { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--aidx-muted); }
.aidx-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--aidx-accent); flex: none; }

.aidx-modal__chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 28px; }
.aidx-chip {
    display: flex; align-items: center; gap: 9px; padding: 12px 14px;
    background: rgba(255, 255, 255, .04); border: 1px solid var(--aidx-line);
    border-radius: 8px; font-size: 13px; font-weight: 500; color: #e6ecf5;
}
.aidx-chip__ico { width: 16px; height: 16px; object-fit: contain; flex: none; }

.aidx-modal__disclaimer { margin-top: 22px; font-size: 11px; line-height: 1.6; color: rgba(255, 255, 255, .4); }
.aidx-modal__err { margin-top: 12px; font-size: 13px; color: #ff8a8a; }

/* ====================== 화면 전환 / 공통 ====================== */
.aidx-screen[hidden] { display: none; }
.aidx-center { text-align: center; }
.aidx-screen__title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.aidx-screen__sub { margin-top: 10px; font-size: 13px; color: var(--aidx-muted); line-height: 1.5; }
.aidx-emoji { display: block; font-size: 24px; margin-bottom: 14px; }

/* 점수 색 토큰 (--c-bg 는 color-mix 대신 정적 rgba — html2canvas/PDF 호환) */
[data-color="red"]    { --c: var(--aidx-red);    --c-bg: rgba(239, 90, 90, .14); }
[data-color="orange"] { --c: var(--aidx-orange); --c-bg: rgba(244, 162, 97, .14); }
[data-color="blue"]   { --c: var(--aidx-blue);   --c-bg: rgba(79, 142, 247, .14); }
[data-color="teal"]   { --c: var(--aidx-teal);   --c-bg: rgba(0, 87, 255, .14); }

/* 버튼 */
.aidx-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; box-sizing: border-box; height: 50px;
    background: var(--aidx-accent); border: 0; border-radius: 10px;
    color: #fff; font: 700 14px/1 var(--aidx-font); cursor: pointer; text-decoration: none;
    transition: filter .2s;
}
.aidx-btn-primary:hover { filter: brightness(1.12); }
.aidx-btn-primary[disabled] { opacity: .6; cursor: default; }
.aidx-btn-ghost {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; box-sizing: border-box; height: 46px; margin-top: 10px;
    background: transparent; border: 1.5px solid rgba(79, 142, 247, .4); border-radius: 10px;
    color: var(--aidx-blue); font: 700 13px/1 var(--aidx-font); cursor: pointer; transition: background .2s;
}
.aidx-btn-ghost:hover { background: rgba(79, 142, 247, .08); }

/* ====================== 화면 2: 분석 중 ====================== */
.aidx-spinner {
    width: 64px; height: 64px; margin: 14px auto 26px; border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, .1); border-top-color: var(--aidx-accent);
    animation: aidx-spin .9s linear infinite;
}
@keyframes aidx-spin { to { transform: rotate(360deg); } }
.aidx-an__url { margin-top: 8px; font-size: 13px; color: var(--aidx-blue); word-break: break-all; }
.aidx-checklist { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.aidx-checkrow {
    display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 8px;
    font-size: 13px; color: var(--aidx-muted); border: 1px solid transparent; transition: .3s;
}
.aidx-checkrow__dot {
    width: 18px; height: 18px; flex: none; border-radius: 50%;
    background: rgba(255, 255, 255, .08); display: grid; place-items: center; font-size: 10px; color: #fff;
}
.aidx-checkrow.is-active { background: rgba(0, 87, 255, .08); border-color: rgba(0, 87, 255, .35); color: #fff; }
.aidx-checkrow.is-done { color: #cfe0ff; }
.aidx-checkrow.is-done .aidx-checkrow__dot { background: var(--aidx-accent); }
.aidx-checkrow.is-done .aidx-checkrow__dot::after { content: '✓'; }

/* ====================== 게이지 ====================== */
.aidx-gauge { position: relative; width: 120px; height: 120px; flex: none; }
.aidx-gauge svg { width: 100%; height: 100%; display: block; overflow: visible; }
.aidx-gauge__track { stroke: rgba(255, 255, 255, .08); }
.aidx-gauge__arc { stroke: var(--c, #4F8EF7); transition: stroke-dashoffset .9s ease, stroke .3s; }
.aidx-gauge__num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.aidx-gauge__score { font-size: 30px; font-weight: 700; line-height: 1; color: var(--c, #fff); }
.aidx-gauge__max { font-size: 11px; font-style: normal; line-height: 1; color: var(--aidx-muted); margin-top: 2px; }
.aidx-gauge--lg { width: 132px; height: 132px; }

/* ====================== 결과 헤더 (티저/리포트 공통) ====================== */
.aidx-result__head {
    display: flex; align-items: center; flex-wrap: wrap; gap: 24px; padding: 22px;
    background: rgba(255, 255, 255, .04); border: 1px solid rgba(79, 142, 247, .16); border-radius: 12px;
}
.aidx-result__meta { min-width: 0; }
.aidx-result__label { font-size: 11px; letter-spacing: .05em; color: var(--aidx-muted); }
.aidx-result__url { margin-top: 4px; font-size: 16px; font-weight: 700; word-break: break-all; }
.aidx-badge {
    display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 700; color: var(--c, #fff);
    background: var(--c-bg, rgba(79, 142, 247, .14));
}
/* 리포트 PDF 다운로드 버튼 (PDF에는 포함 안 됨 — data-html2canvas-ignore) */
.aidx-dl {
    margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px;
    height: 42px; padding: 0 18px; border: 0; border-radius: 9px;
    background: var(--aidx-accent); color: #fff; font: 700 13px/1 var(--aidx-font);
    cursor: pointer; white-space: nowrap; transition: filter .2s;
}
.aidx-dl:hover { filter: brightness(1.12); }
.aidx-dl[disabled] { opacity: .6; cursor: default; }
.aidx-dl__ico { font-size: 14px; line-height: 1; }

/* ====================== 티저 영역 리스트 ====================== */
.aidx-arealist { margin-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.aidx-arearow__top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.aidx-arearow__name { font-size: 13px; color: #cdd8e8; }
.aidx-arearow__score { font-size: 22px; font-weight: 700; color: var(--c, #fff); }
.aidx-arearow__lock { font-size: 18px; }
.aidx-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.aidx-bar__fill { height: 100%; border-radius: 3px; background: var(--c, #4F8EF7); width: 0; transition: width .9s ease; }
.aidx-arearow.is-locked .aidx-bar { filter: blur(3px); }
.aidx-arearow__hint { margin-top: 6px; font-size: 11px; color: var(--aidx-muted); }

.aidx-unlock {
    margin-top: 24px; padding: 20px; border-radius: 10px;
    background: rgba(0, 87, 255, .07); border: 1px solid rgba(0, 87, 255, .22);
}
.aidx-unlock__title { font-size: 13px; font-weight: 700; color: #cfe0ff; }
.aidx-unlock__sub { margin-top: 6px; font-size: 12px; color: var(--aidx-muted); }
.aidx-unlock .aidx-btn-primary { margin-top: 14px; }

/* ====================== 리드 폼 ====================== */
.aidx-leadform { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; }
.aidx-field { display: flex; flex-direction: column; gap: 7px; }
.aidx-field__label { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #aebed3; }
.aidx-field input, .aidx-field select {
    height: 46px; padding: 0 14px; box-sizing: border-box;
    background: rgba(255, 255, 255, .04); border: 1.5px solid rgba(79, 142, 247, .2); border-radius: 8px;
    color: #fff; font: 400 14px/1 var(--aidx-font); outline: none; transition: border-color .2s;
    color-scheme: dark;
}
.aidx-field input::placeholder { color: var(--aidx-muted); }
.aidx-field input:focus, .aidx-field select:focus { border-color: rgba(0, 87, 255, .6); }
.aidx-field select { appearance: none; cursor: pointer; }
/* Windows/Chrome 등에서 드롭다운 팝업이 흰 배경으로 떠 흰 글씨가 안 보이는 문제 방지 */
.aidx-field select option { background: #0D1829; color: #fff; }
.aidx-leadform__err { font-size: 13px; color: #ff8a8a; }
.aidx-reassure {
    margin-top: 16px; padding: 14px 16px; border-radius: 8px;
    background: rgba(255, 255, 255, .04); border: 1px solid rgba(79, 142, 247, .16);
    font-size: 11px; line-height: 1.6; color: var(--aidx-muted);
}
.aidx-reassure b { color: var(--aidx-accent); }

/* ====================== 모달 컨택 폼 (시안 #29 톤, 2단 그리드) ====================== */
.aidx-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.aidx-cform { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.aidx-cform__full { grid-column: 1 / -1; }
.aidx-cform textarea {
    width: 100%; box-sizing: border-box; min-height: 84px; padding: 12px 14px; resize: vertical;
    background: rgba(255, 255, 255, .04); border: 1.5px solid rgba(79, 142, 247, .2); border-radius: 8px;
    color: #fff; font: 400 14px/1.5 var(--aidx-font); outline: none; transition: border-color .2s;
}
.aidx-cform textarea::placeholder { color: var(--aidx-muted); }
.aidx-cform textarea:focus { border-color: rgba(0, 87, 255, .6); }
.aidx-cform input[type="file"] { height: auto; padding: 8px 14px; line-height: normal; font-size: 12px; color: var(--aidx-muted); }
.aidx-cform input[type="file"]::file-selector-button {
    margin-right: 10px; padding: 7px 12px; border: 1.5px solid rgba(79, 142, 247, .25);
    border-radius: 7px; background: rgba(255, 255, 255, .04); color: #cfe0ff; cursor: pointer;
    font: 600 12px var(--aidx-font); vertical-align: middle;
}
.aidx-consent { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--aidx-muted); cursor: pointer; }
.aidx-consent input { width: 16px; height: 16px; flex: none; accent-color: var(--aidx-accent); }
.aidx-consent__link { background: none; border: 0; padding: 0; color: var(--aidx-blue); text-decoration: underline; cursor: pointer; font: inherit; }
.aidx-done__close { margin-top: 24px; }

/* ====================== 리포트 ====================== */
.aidx-seclabel { margin: 30px 0 14px; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--aidx-blue); }
.aidx-cwv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.aidx-cwv__card { padding: 16px 12px; text-align: center; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(79, 142, 247, .15); }
.aidx-cwv__val { font-size: 20px; font-weight: 700; color: var(--c, #fff); }
.aidx-cwv__code { margin-top: 4px; font-size: 11px; font-weight: 700; color: #aebed3; }
.aidx-cwv__ko { margin-top: 2px; font-size: 10px; color: var(--aidx-muted); }

.aidx-report-areas { display: flex; flex-direction: column; gap: 12px; }
.aidx-acard { padding: 18px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(79, 142, 247, .15); }
.aidx-acard__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.aidx-acard__icon { display: inline-flex; align-items: center; flex: none; }
.aidx-acard__name { flex: 1; font-size: 14px; font-weight: 700; }

/* 영역 아이콘(이미지) — 티저 리스트 & 리포트 카드 공용 */
.aidx-areaicon { width: 18px; height: 18px; object-fit: contain; vertical-align: middle; }
.aidx-arearow__name .aidx-areaicon { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
.aidx-acard__score { font-size: 22px; font-weight: 700; color: var(--c, #fff); }
.aidx-acard__badge { padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; color: var(--c, #fff); background: var(--c-bg, rgba(79, 142, 247, .14)); }
.aidx-acard .aidx-bar { margin-bottom: 12px; }
.aidx-acard__comment { font-size: 12px; line-height: 1.65; color: #bccadb; }
.aidx-acard__checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.aidx-chk { font-size: 11px; padding: 3px 9px; border-radius: 4px; }
.aidx-chk.ok { color: var(--aidx-teal); background: #F7F8FB; }
.aidx-chk.no { color: var(--aidx-red); background: #F7F8FB; }

.aidx-top3 { display: flex; flex-direction: column; gap: 12px; }
.aidx-t3 { display: flex; gap: 14px; padding: 16px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(79, 142, 247, .15); }
.aidx-t3__no { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--aidx-accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.aidx-t3__title { font-size: 14px; font-weight: 700; }
.aidx-t3__meta { margin: 3px 0 7px; font-size: 11px; color: var(--aidx-muted); }
.aidx-t3__desc { font-size: 12px; line-height: 1.55; color: #bccadb; }
.aidx-t3__tip { margin-top: 9px; font-size: 11px; color: var(--aidx-teal); background: #F7F8FB; padding: 7px 10px; border-radius: 6px; }

.aidx-cta { margin-top: 28px; padding: 30px 24px; text-align: center; border-radius: 12px; background: rgba(0, 87, 255, .1); border: 1px solid rgba(0, 87, 255, .28); }
.aidx-cta__eyebrow { font-size: 14px; font-weight: 500; color: var(--aidx-accent); }
.aidx-cta__title { margin-top: 10px; font-size: 20px; font-weight: 700; }
.aidx-cta__sub { margin-top: 10px; font-size: 13px; line-height: 1.5; color: #bccadb; }
.aidx-cta .aidx-btn-primary { margin-top: 18px; }
.aidx-cta__btn { width: auto; min-width: 200px; padding: 0 28px; }

/* ---------- PC 전용: 태블릿/모바일 비노출 ---------- */
@media (max-width: 1024px) {
    .aidx-card, .aidx-modal { display: none !important; }
    body.aidx-card-on .to-top { bottom: clamp(20px, 4vh, 44px); }
}
