/* ========================================================
   Figma AI Reverse Image Search - Scanning Loader
   Nodes: 624:2, 626:609, 627:1352
   ======================================================== */

.ai-figma-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: figmaFadeIn 0.25s ease-out forwards;
}

.ai-loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 11, 23, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ai-scan-modal-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 680px;
    background: #FFFFFF;
    border-radius: 24px;
    padding: 28px 32px;
    box-shadow: 0 25px 60px rgba(5, 11, 23, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    gap: 32px;
    animation: figmaModalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes figmaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes figmaModalPop {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==========================================
   LEFT: FACE SCANNER VIEWPORT
   ========================================== */
.ai-scanner-box {
    position: relative;
    flex-shrink: 0;
    width: 230px;
    height: 230px;
    border-radius: 20px;
    overflow: hidden;
    background: #0B132B;
    box-shadow: 0 10px 25px rgba(0, 107, 255, 0.15);
}

.ai-scanner-img-wrap {
    width: 100%;
    height: 100%;
    position: relative;
}

.ai-scanner-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(0.92) contrast(1.05);
}

.ai-scanner-overlay-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 107, 255, 0.12) 0%, rgba(5, 11, 23, 0.45) 100%);
    pointer-events: none;
}

/* 4 Blue Corner Scanner Brackets [ ] */
.corner-bracket {
    position: absolute;
    width: 26px;
    height: 26px;
    pointer-events: none;
    z-index: 5;
}

.corner-tl {
    top: 14px;
    left: 14px;
    border-top: 3.5px solid #006BFF;
    border-left: 3.5px solid #006BFF;
    border-top-left-radius: 6px;
}

.corner-tr {
    top: 14px;
    right: 14px;
    border-top: 3.5px solid #006BFF;
    border-right: 3.5px solid #006BFF;
    border-top-right-radius: 6px;
}

.corner-bl {
    bottom: 14px;
    left: 14px;
    border-bottom: 3.5px solid #006BFF;
    border-left: 3.5px solid #006BFF;
    border-bottom-left-radius: 6px;
}

.corner-br {
    bottom: 14px;
    right: 14px;
    border-bottom: 3.5px solid #006BFF;
    border-right: 3.5px solid #006BFF;
    border-bottom-right-radius: 6px;
}

/* Sweeping Laser Beam */
.ai-scanner-laser {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #00D2FF;
    box-shadow: 0 0 16px 4px rgba(0, 210, 255, 0.8), 0 0 32px 8px rgba(0, 107, 255, 0.5);
    z-index: 6;
    pointer-events: none;
    animation: scannerBeamSweep 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes scannerBeamSweep {
    0% {
        top: 6%;
        opacity: 0.2;
    }
    15% {
        opacity: 1;
    }
    50% {
        top: 92%;
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        top: 6%;
        opacity: 0.2;
    }
}

/* Live Scanning Badge */
.ai-scanner-live-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(4, 13, 25, 0.78);
    backdrop-filter: blur(4px);
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #EF4444;
    box-shadow: 0 0 8px #EF4444;
    animation: dotPulse 1.2s infinite ease-in-out;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

/* ==========================================
   RIGHT: CONTENT & VERIFICATION CHECKLIST
   ========================================== */
.ai-scanner-content {
    flex: 1;
    min-width: 0;
}

.ai-loader-title {
    font-size: 21px;
    font-weight: 700;
    color: #040D19;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.ai-loader-subtitle {
    font-size: 13px;
    color: #64748B;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

/* Progress Row */
.ai-progress-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.ai-progress-track {
    flex: 1;
    height: 6px;
    background: #EEF2F6;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.ai-progress-fill {
    height: 100%;
    width: 0%;
    background: #006BFF;
    border-radius: 999px;
    transition: width 0.35s ease;
    box-shadow: 0 0 10px rgba(0, 107, 255, 0.4);
}

.ai-progress-percent {
    font-size: 17px;
    font-weight: 800;
    color: #006BFF;
    min-width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Checklist */
.ai-steps-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-step-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    transition: color 0.2s ease;
}

.step-icon-wrap {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.ai-step-item .step-label {
    flex: 1;
    font-weight: 600;
    color: #1E293B;
}

.ai-step-item .step-metric {
    font-size: 13px;
    font-weight: 700;
    color: #0F172A;
    margin-left: 12px;
}

/* Step States: Done, Active, Pending */
.ai-step-item.pending .step-label {
    color: #94A3B8;
}

.ai-step-item.pending .step-metric {
    color: #94A3B8;
    font-weight: 500;
}

.ai-step-item.pending .icon-check,
.ai-step-item.pending .icon-spinner {
    display: none;
}

.ai-step-item.pending .icon-circle {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid #CBD5E1;
    background: transparent;
}

.ai-step-item.active .step-label {
    color: #006BFF;
}

.ai-step-item.active .step-metric {
    color: #006BFF;
}

.ai-step-item.active .icon-check,
.ai-step-item.active .icon-circle {
    display: none;
}

.ai-step-item.active .icon-spinner {
    display: block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid #DBEAFE;
    border-top-color: #006BFF;
    animation: stepSpin 0.75s linear infinite;
}

@keyframes stepSpin {
    to { transform: rotate(360deg); }
}

.ai-step-item.done .step-label {
    color: #0F172A;
}

.ai-step-item.done .step-metric {
    color: #0F172A;
}

.ai-step-item.done .icon-spinner,
.ai-step-item.done .icon-circle {
    display: none;
}

.ai-step-item.done .icon-check {
    display: block;
}

/* Footer / Cancel */
.ai-scanner-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.ai-cancel-search-btn {
    background: transparent;
    border: none;
    padding: 0;
    color: #64748B;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.15s ease;
}

.ai-cancel-search-btn:hover {
    color: #0F172A;
}

/* ==========================================
   MOBILE RESPONSIVENESS (Node 627:1352)
   ========================================== */
@media (max-width: 600px) {
    .ai-scan-modal-card {
        flex-direction: column;
        padding: 24px 20px;
        gap: 20px;
        max-width: 360px;
    }

    .ai-scanner-box {
        width: 100%;
        max-width: 220px;
        height: 180px;
        margin: 0 auto;
    }

    .ai-loader-title {
        font-size: 18px;
        text-align: center;
    }

    .ai-loader-subtitle {
        text-align: center;
        margin-bottom: 14px;
    }

    .ai-scanner-footer {
        justify-content: center;
    }
}

/* ==========================================
   LOGGED-IN DASHBOARD ONLY (Figma 624:2, 626:609 desktop; 624:124, 627:1352 mobile)
   Scoped to the dashboard shell (.dashboard-wrapper ~) and the pro result page,
   so the public home page loader stays as it is.
   ========================================== */
/* Figma places the popup at y=210 of a 970px screen, not in the exact middle */
.dashboard-wrapper ~ .ai-figma-loader-overlay,
body.pro-result-mode .ai-figma-loader-overlay {
    align-items: flex-start;
    padding-top: 20.6vh;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-scan-modal-card,
body.pro-result-mode .ai-figma-loader-overlay .ai-scan-modal-card {
    max-width: 640px;
    padding: 30px;
    gap: 30px;
    border-radius: 20px;
    align-items: flex-start;
    box-shadow: 0 20px 50px rgba(7, 26, 49, 0.18);
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-loader-backdrop,
body.pro-result-mode .ai-figma-loader-overlay .ai-loader-backdrop {
    background: rgba(7, 26, 49, 0.55);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-scanner-box,
body.pro-result-mode .ai-figma-loader-overlay .ai-scanner-box {
    width: 210px;
    height: 210px;
    border-radius: 12px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-loader-title,
body.pro-result-mode .ai-figma-loader-overlay .ai-loader-title {
    font-size: 20px;
    line-height: 25px;
    color: #071A31;
    margin-bottom: 6px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-loader-subtitle,
body.pro-result-mode .ai-figma-loader-overlay .ai-loader-subtitle {
    font-size: 14px;
    line-height: 18px;
    color: #455365;
    margin-bottom: 20px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-progress-row,
body.pro-result-mode .ai-figma-loader-overlay .ai-progress-row {
    gap: 20px;
    margin-bottom: 20px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-progress-percent,
body.pro-result-mode .ai-figma-loader-overlay .ai-progress-percent {
    font-size: 18px;
    font-weight: 700;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-progress-fill,
body.pro-result-mode .ai-figma-loader-overlay .ai-progress-fill {
    box-shadow: none;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-steps-list,
body.pro-result-mode .ai-figma-loader-overlay .ai-steps-list {
    gap: 16px;
    margin-bottom: 26px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item {
    font-size: 14px;
    line-height: 20px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .step-icon-wrap,
.dashboard-wrapper ~ .ai-figma-loader-overlay .icon-check,
body.pro-result-mode .ai-figma-loader-overlay .step-icon-wrap,
body.pro-result-mode .ai-figma-loader-overlay .icon-check {
    width: 20px;
    height: 20px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.pending .icon-circle,
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.active .icon-spinner,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.pending .icon-circle,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.active .icon-spinner {
    width: 18px;
    height: 18px;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.pending .icon-circle,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.pending .icon-circle {
    border-color: #D6DFEB;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item .step-label,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item .step-label {
    font-weight: 500;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item .step-metric,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item .step-metric {
    font-size: 14px;
    font-weight: 600;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.done .step-label,
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.done .step-metric,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.done .step-label,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.done .step-metric {
    color: #071A31;
    font-weight: 600;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.pending .step-label,
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.pending .step-metric,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.pending .step-label,
body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.pending .step-metric {
    color: #455365;
    font-weight: 500;
}
.dashboard-wrapper ~ .ai-figma-loader-overlay .ai-cancel-search-btn,
body.pro-result-mode .ai-figma-loader-overlay .ai-cancel-search-btn {
    color: #455365;
    font-weight: 500;
}

@media (max-width: 600px) {
    .dashboard-wrapper ~ .ai-figma-loader-overlay,
    body.pro-result-mode .ai-figma-loader-overlay {
        padding: 20.6vh 15px 15px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-scan-modal-card,
    body.pro-result-mode .ai-figma-loader-overlay .ai-scan-modal-card {
        max-width: 290px;
        padding: 20px 15px 18px;
        gap: 30px;
        align-items: stretch;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-scanner-box,
    body.pro-result-mode .ai-figma-loader-overlay .ai-scanner-box {
        width: 160px;
        max-width: 160px;
        height: 160px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-loader-title,
    body.pro-result-mode .ai-figma-loader-overlay .ai-loader-title {
        font-size: 16px;
        line-height: 20px;
        text-align: left;
        margin-bottom: 4px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-loader-subtitle,
    body.pro-result-mode .ai-figma-loader-overlay .ai-loader-subtitle {
        font-size: 11px;
        line-height: 14px;
        text-align: left;
        margin-bottom: 14px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-progress-row,
    body.pro-result-mode .ai-figma-loader-overlay .ai-progress-row {
        gap: 18px;
        margin-bottom: 14px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-progress-percent,
    body.pro-result-mode .ai-figma-loader-overlay .ai-progress-percent {
        font-size: 14px;
        min-width: 32px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-steps-list,
    body.pro-result-mode .ai-figma-loader-overlay .ai-steps-list {
        gap: 12px;
        margin-bottom: 16px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item,
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item .step-metric,
    body.pro-result-mode .ai-figma-loader-overlay .ai-step-item,
    body.pro-result-mode .ai-figma-loader-overlay .ai-step-item .step-metric {
        font-size: 11px;
        line-height: 16px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .step-icon-wrap,
    .dashboard-wrapper ~ .ai-figma-loader-overlay .icon-check,
    body.pro-result-mode .ai-figma-loader-overlay .step-icon-wrap,
    body.pro-result-mode .ai-figma-loader-overlay .icon-check {
        width: 16px;
        height: 16px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .step-icon-wrap,
    body.pro-result-mode .ai-figma-loader-overlay .step-icon-wrap {
        margin-right: 6px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.pending .icon-circle,
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-step-item.active .icon-spinner,
    body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.pending .icon-circle,
    body.pro-result-mode .ai-figma-loader-overlay .ai-step-item.active .icon-spinner {
        width: 15px;
        height: 15px;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-scanner-footer,
    body.pro-result-mode .ai-figma-loader-overlay .ai-scanner-footer {
        justify-content: flex-end;
    }
    .dashboard-wrapper ~ .ai-figma-loader-overlay .ai-cancel-search-btn,
    body.pro-result-mode .ai-figma-loader-overlay .ai-cancel-search-btn {
        font-size: 11px;
    }
}
