/* ================================================
   SEO Scanner Modal — Skyline Digital (Wide Dark v3)
   ================================================ */

.scan-overlay {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    opacity: 0; visibility: hidden;
    transition: opacity .3s, visibility .3s;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.scan-overlay.active { opacity: 1; visibility: visible; }
.scan-overlay-bg {
    position: absolute; inset: 0;
    background: rgba(10,12,20,.78);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}

/* ---- Modal ---- */
.scan-modal {
    position: relative; width: 100%; max-width: 880px;
    max-height: 90vh; overflow: hidden;
    background: linear-gradient(145deg, #0F172A 0%, #0c1929 40%, #111d30 100%);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 25px 60px -12px rgba(0,0,0,.5), 0 0 60px rgba(37,133,248,.06);
    transform: translateY(16px) scale(.97);
    transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.scan-overlay.active .scan-modal { transform: translateY(0) scale(1); }

/* Shiny mesh gradient blobs — matching hero */
.scan-modal::before {
    content: ''; position: absolute; inset: -30px;
    border-radius: 16px; overflow: hidden;
    background:
        radial-gradient(ellipse 70% 55% at 80% 12%, rgba(37,133,248,.22) 0%, transparent 60%),
        radial-gradient(ellipse 60% 70% at 10% 70%, rgba(96,165,250,.18) 0%, transparent 55%),
        radial-gradient(ellipse 50% 45% at 55% 95%, rgba(255,120,81,.12) 0%, transparent 50%),
        radial-gradient(ellipse 40% 35% at 22% 15%, rgba(139,92,246,.08) 0%, transparent 50%),
        radial-gradient(ellipse 90% 70% at 50% 40%, rgba(37,133,248,.06) 0%, transparent 60%);
    z-index: 0; pointer-events: none;
    animation: scanMesh 20s ease-in-out infinite;
}
.scan-modal::after {
    content: ''; position: absolute; inset: -30px;
    border-radius: 16px; overflow: hidden;
    background:
        radial-gradient(ellipse 35% 30% at 65% 25%, rgba(255,120,81,.07) 0%, transparent 50%),
        radial-gradient(ellipse 70% 50% at 45% 45%, rgba(255,255,255,.04) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 85% 80%, rgba(96,165,250,.1) 0%, transparent 50%);
    z-index: 0; pointer-events: none;
    animation: scanMesh 25s ease-in-out infinite reverse;
}
@keyframes scanMesh {
    0%,100%{ transform: translate(0,0) scale(1); }
    25%{ transform: translate(8px,-6px) scale(1.02); }
    50%{ transform: translate(-4px,4px) scale(.98); }
    75%{ transform: translate(-6px,-3px) scale(1.01); }
}


/* ---- Close ---- */
.scan-close {
    position: sticky; top: 8px; float: right; margin: 8px 8px 0 0;
    width: 28px; height: 28px; border: none; border-radius: 50%;
    background: rgba(255,255,255,.07);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 10; transition: background .15s, transform .15s;
}
.scan-close:hover { background: rgba(255,255,255,.14); transform: scale(1.1); }
.scan-close svg { width: 12px; height: 12px; color: rgba(255,255,255,.5); }

/* ---- Body ---- */
.scan-body { padding: 2px 24px 20px; position: relative; z-index: 1; }

/* ---- Domain & bar ---- */
.scan-loading-domain, .scan-result-domain {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: #fff;
}
.scan-domain-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #FF7851; box-shadow: 0 0 8px rgba(255,120,81,.4);
}
.scan-result-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 12px; margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

/* ---- Progress ---- */
.scan-progress-section { margin: 12px 0 16px; }
.scan-progress-track { height: 3px; background: rgba(255,255,255,.06); border-radius: 2px; overflow: hidden; }
.scan-progress-fill {
    height: 100%; border-radius: 2px;
    background: linear-gradient(90deg, #FF7851, #FFA07A, #FF7851);
    background-size: 300% 100%; animation: shimmer 2s ease-in-out infinite;
    transition: width .6s cubic-bezier(.16,1,.3,1);
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-100% 0} }
.scan-progress-info {
    display: flex; align-items: center; justify-content: space-between; margin-top: 5px;
}
.scan-progress-msg {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 500; color: rgba(255,255,255,.45);
}
.scan-progress-pct { font-size: 11px; font-weight: 700; color: #FF7851; font-variant-numeric: tabular-nums; }
.scan-spinner {
    width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,.08); border-top-color: #FF7851;
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* ==== TOP SECTION: Screenshot left + Scores right ==== */
.scan-top {
    display: flex; flex-direction: column; align-items: center;
    margin-bottom: 14px;
}
.scan-top.has-shot {
    display: grid; grid-template-columns: 1.15fr 1fr;
    gap: 20px; align-items: center;
}
.scan-top-left { min-width: 0; }
.scan-top-right {
    display: flex; flex-direction: column; align-items: center;
    gap: 10px;
}

/* ---- Screenshot ---- */
.scan-shot {
    border-radius: 8px; overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 4px 24px rgba(0,0,0,.3);
}
.scan-shot-bar {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 8px; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.06);
}
.scan-dot { width: 5px; height: 5px; border-radius: 50%; }
.scan-dot.r { background: #FCA5A5; } .scan-dot.y { background: #FDE68A; } .scan-dot.g { background: #86EFAC; }
.scan-shot-url {
    flex: 1; font-size: 8px; color: rgba(255,255,255,.25); margin-left: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scan-shot img { width: 100%; height: auto; display: block; }

/* ---- Score row: big gauge + 2x2 minis ---- */
.scan-score-row {
    display: flex; align-items: center; gap: 18px;
}
.scan-score-main {
    display: flex; flex-direction: column; align-items: center; flex-shrink: 0;
    padding: 4px;
}
.scan-score-label {
    font-size: 10px; font-weight: 600; color: rgba(255,255,255,.35);
    text-transform: uppercase; letter-spacing: .06em; margin-top: 3px;
}

/* Gauge */
.scan-gauge {
    position: relative; border-radius: 50%;
    box-shadow: 0 0 18px var(--gc), 0 0 36px var(--gc);
}
.scan-gauge svg { transform: rotate(-90deg); display: block; }
.scan-gauge .ring-bg { fill: none; stroke: rgba(255,255,255,.1); }
.scan-gauge .ring-fg {
    fill: none; stroke-linecap: round;
    transition: stroke-dashoffset 1.2s cubic-bezier(.16,1,.3,1);
}
.gauge-center {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
.gauge-num {
    font-size: 30px; font-weight: 800; color: #fff;
    line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}

/* Mini gauges 2x2 grid */
.scan-cats-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px;
}
.scan-mini-gauge {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.scan-mg-ring {
    position: relative; display: block;
}
.scan-mg-ring svg { transform: rotate(-90deg); display: block; }
.scan-mg-ring .ring-bg { fill: none; stroke: rgba(255,255,255,.06); }
.scan-mg-ring .ring-fg {
    fill: none; stroke-linecap: round;
    transition: stroke-dashoffset 1.2s cubic-bezier(.16,1,.3,1);
}
.mini-gauge-val {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.mini-gauge-label {
    font-size: 8px; font-weight: 600; color: rgba(255,255,255,.35);
    text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}

.sc-green { color: #34D399; } .sc-amber { color: #FBBF24; } .sc-red { color: #F87171; } .sc-muted { color: rgba(255,255,255,.25); }

/* Stats line */
.scan-stats-line {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 12px; color: rgba(255,255,255,.4); font-weight: 500;
    padding: 0;
}
.scan-stats-line .hl { font-weight: 800; color: #fff; font-size: 12px; }
.scan-stats-sep { width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,.15); flex-shrink: 0; }

/* ==== ISSUES (full-width below top section) ==== */
.scan-issues {
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.scan-issues-hdr {
    font-size: 11px; font-weight: 700; color: rgba(255,255,255,.45);
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.scan-issues-hdr .hl { color: #fff; font-size: 12px; }

.scan-issue {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 6px; margin-bottom: 2px;
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.04);
}
.scan-issue-badge {
    font-size: 7px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; padding: 2px 6px; border-radius: 3px;
    white-space: nowrap; flex-shrink: 0;
}
.sev-critical { background: rgba(239,68,68,.1); color: #FCA5A5; border: 1px solid rgba(239,68,68,.1); }
.sev-warning  { background: rgba(245,158,11,.1); color: #FDE68A; border: 1px solid rgba(245,158,11,.1); }
.sev-info     { background: rgba(37,133,248,.1); color: #93C5FD; border: 1px solid rgba(37,133,248,.1); }
.scan-issue-text { font-size: 11px; font-weight: 500; color: rgba(255,255,255,.6); line-height: 1.3; }

.scan-issue-fade {
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
    opacity: .35; pointer-events: none;
}
.scan-issue-gate { padding: 4px 0 0; }
.scan-gate-content {
    display: flex; align-items: center; justify-content: center;
    gap: 5px; font-size: 10px; font-weight: 600; color: rgba(255,255,255,.3);
}
.scan-gate-content svg { width: 12px; height: 12px; color: rgba(255,255,255,.2); }

/* ==== CTA FOOTER ==== */
.scan-cta-footer {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,120,81,.08), rgba(255,120,81,.02));
    border: 1px solid rgba(255,120,81,.1);
}
.scan-cta-left {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.scan-cta-icon {
    width: 28px; height: 28px; border-radius: 6px;
    background: linear-gradient(135deg, #FF7851, #E5673F);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(255,120,81,.25);
}
.scan-cta-icon svg { width: 13px; height: 13px; color: #fff; }
.scan-cta-title { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; }
.scan-cta-form {
    display: flex; gap: 6px; flex: 1; min-width: 0;
}
.scan-input {
    flex: 1; min-width: 0; padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.1); border-radius: 6px;
    font-family: inherit; font-size: 12px; font-weight: 500;
    color: #fff; background: rgba(255,255,255,.05);
    outline: none; transition: border-color .2s, box-shadow .2s;
}
.scan-input::placeholder { color: rgba(255,255,255,.25); }
.scan-input:focus { border-color: #FF7851; box-shadow: 0 0 0 2px rgba(255,120,81,.1); }
.scan-input.input-error { border-color: #EF4444; box-shadow: 0 0 0 2px rgba(239,68,68,.1); }
.scan-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #FF7851, #E5673F);
    color: #fff; border: none; border-radius: 6px; font-family: inherit;
    font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: box-shadow .2s, transform .1s;
    box-shadow: 0 3px 12px rgba(255,120,81,.2);
}
.scan-btn svg { width: 12px; height: 12px; }
.scan-btn:hover { box-shadow: 0 5px 20px rgba(255,120,81,.3); transform: translateY(-1px); }
.scan-btn:active { transform: scale(.98) translateY(0); }
.scan-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.scan-cta-trust {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; margin-top: 6px; font-size: 9px; color: rgba(255,255,255,.2);
}
.scan-cta-trust svg { width: 10px; height: 10px; color: rgba(255,255,255,.15); }

/* ---- Skeleton (loading state uses scan-top layout) ---- */
.scan-skel-shot {
    aspect-ratio: 16/10; border-radius: 8px;
    background: linear-gradient(110deg, rgba(255,255,255,.03) 30%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 70%);
    background-size: 250% 100%; animation: shimmer 1.8s ease-in-out infinite;
}
.scan-skel-ring {
    width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(110deg, rgba(255,255,255,.03) 30%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 70%);
    background-size: 250% 100%; animation: shimmer 1.8s ease-in-out infinite;
}
.scan-skel-minis { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.scan-skel-mini {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(110deg, rgba(255,255,255,.03) 30%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 70%);
    background-size: 250% 100%; animation: shimmer 1.8s ease-in-out infinite;
}
.scan-skel-rows { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.scan-skel-row {
    height: 28px; border-radius: 5px;
    background: linear-gradient(110deg, rgba(255,255,255,.03) 30%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 70%);
    background-size: 250% 100%; animation: shimmer 1.8s ease-in-out infinite;
}
.scan-skel-row.short { width: 50%; }

/* ---- Success ---- */
.scan-success-state { text-align: center; padding: 24px 0 12px; }
.scan-success-icon {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.15);
    margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
    animation: pop .4s cubic-bezier(.16,1,.3,1);
}
.scan-success-icon svg { width: 20px; height: 20px; color: #34D399; }
.scan-success-title { font-size: 15px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.scan-success-text { font-size: 12px; color: rgba(255,255,255,.4); line-height: 1.4; max-width: 280px; margin: 0 auto; }

/* ---- Error ---- */
.scan-error-state { text-align: center; padding: 24px 0 12px; }
.scan-error-icon {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.12);
    margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
    animation: pop .4s cubic-bezier(.16,1,.3,1);
}
.scan-error-icon svg { width: 20px; height: 20px; color: #F87171; }
.scan-error-title { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.scan-error-text { font-size: 11px; color: rgba(255,255,255,.4); line-height: 1.4; max-width: 280px; margin: 0 auto; }
.scan-retry {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 10px; padding: 7px 14px;
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
    border-radius: 6px; font-family: inherit;
    font-size: 11px; font-weight: 600; color: rgba(255,255,255,.6); cursor: pointer;
}
.scan-retry svg { width: 11px; height: 11px; }
.scan-retry:hover { background: rgba(255,255,255,.1); }

@keyframes pop { 0%{transform:scale(0);opacity:0} 60%{transform:scale(1.1)} 100%{transform:scale(1);opacity:1} }

/* ---- Stagger reveal ---- */
.scan-reveal {
    opacity: 0; transform: translateY(8px);
    animation: revealUp .4s cubic-bezier(.16,1,.3,1) forwards;
    animation-delay: calc(var(--d, 0) * .06s);
}
@keyframes revealUp { to { opacity:1; transform:translateY(0); } }

#searchInput.error_input { animation: shake .4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* ---- Responsive ---- */
@media (max-width: 700px) {
    .scan-overlay { padding: 8px; }
    .scan-modal::before, .scan-modal::after { display: none; }
    .scan-modal { max-width: 100%; border-radius: 14px; max-height: 94vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .scan-body { padding: 2px 14px 16px; }

    .scan-top.has-shot { grid-template-columns: 1fr; }
    .scan-top-left .scan-shot { max-width: 280px; margin: 0 auto; }

    .scan-score-row { flex-wrap: wrap; justify-content: center; gap: 12px; }

    .scan-cta-footer { flex-direction: column; align-items: stretch; gap: 10px; }
    .scan-cta-left { justify-content: center; }
    .scan-cta-form { flex-direction: column; }
    .scan-btn { justify-content: center; }
}

@media (max-width: 400px) {
    .scan-body { padding: 2px 12px 14px; }
    .gauge-num { font-size: 22px; }
}
