/* ═══════════════════════════════════════════════
   SKINARI AI Skin Scanner
   ═══════════════════════════════════════════════ */

/* ── 1. Section Card ── */
.skin-scanner {
    background: linear-gradient(180deg, var(--color-bg), var(--color-white));
}
.theme-dark .skin-scanner {
    background: linear-gradient(180deg, var(--color-bg), var(--color-surface)) !important;
}

.scanner-card {
    background: linear-gradient(140deg, rgba(251, 247, 242, 0.94) 0%, rgba(234, 223, 212, 0.9) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.theme-dark .scanner-card {
    background: linear-gradient(140deg, rgba(42, 38, 35, 0.94) 0%, rgba(30, 27, 25, 0.9) 100%) !important;
    border-color: rgba(184, 163, 137, 0.2) !important;
}

.scanner-cta-btn {
    margin-top: var(--space-lg);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    animation: scannerPulse 3s infinite ease-in-out;
}

.scanner-cta-icon {
    font-size: 1.2rem;
}

.scanner-privacy {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.theme-dark .scanner-privacy {
    color: var(--color-text-muted) !important;
}

@keyframes scannerPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(184, 163, 137, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(184, 163, 137, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(184, 163, 137, 0); }
}


/* ── 2. Full-Screen Modal ── */
.scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.scanner-modal.open {
    visibility: visible;
    opacity: 1;
}

.scanner-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 15, 13, 0.7); /* Deep espresso blur */
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
}

.scanner-panel {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.scanner-modal.open .scanner-panel {
    transform: translateY(0);
}

.theme-dark .scanner-panel {
    background: var(--color-surface) !important;
    border: 1px solid rgba(184, 163, 137, 0.2);
}

.scanner-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--color-text-light);
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    transition: color 0.3s ease;
}

.scanner-close:hover {
    color: var(--color-text);
}


/* ── 3. Stage 1: Upload ── */
.scanner-stage {
    display: none;
    text-align: center;
    animation: fadeInStage 0.5s ease forwards;
}

.scanner-stage.active {
    display: block;
}

@keyframes fadeInStage {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.scanner-upload-area {
    padding: var(--space-xl) var(--space-md);
}

.scanner-upload-icon {
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}
.theme-dark .scanner-upload-icon {
    color: var(--color-gold) !important;
}

.scanner-upload-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

.scanner-file-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scanner-camera-preview {
    margin-top: var(--space-md);
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
}
.scanner-camera-preview video {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    transform: scaleX(-1); /* mirror effect */
}
#scanner-capture-btn {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}


/* ── 4. Stage 2: Scanning Animation ── */
.scanner-photo-frame {
    position: relative;
    width: 100%;
    max-width: 320px;
    height: 400px;
    margin: 0 auto var(--space-lg) auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
}

.scanner-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.scanner-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary), 0 0 30px var(--color-primary);
    animation: sweep 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
    z-index: 2;
}

@keyframes sweep {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: calc(100% - 4px); opacity: 0; }
}

.scanner-corners .corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-primary);
    z-index: 3;
}
.theme-dark .scanner-corners .corner {
    border-color: var(--color-gold) !important;
}
.corner.tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.corner.tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.corner.bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.corner.br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

.scanner-progress-wrap {
    margin-bottom: var(--space-sm);
}

.scanner-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.scanner-progress-fill {
    height: 100%;
    background: var(--color-primary);
    width: 0%;
    transition: width 0.3s ease;
}
.theme-dark .scanner-progress-fill {
    background: var(--color-gold) !important;
}

.scanner-progress-text {
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 500;
}
.scanner-tagline {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}


/* ── 5. Stage 3: Results ── */
.scanner-results-header {
    margin-bottom: var(--space-xl);
}

.scanner-overall-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: var(--space-md) 0;
}

.score-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    stroke: var(--color-border);
}
.theme-dark .score-bg {
    stroke: rgba(255,255,255,0.1);
}

.score-fill {
    stroke: var(--color-primary);
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease-out;
}
.theme-dark .score-fill {
    stroke: var(--color-gold) !important;
}

.score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--color-text);
}
.theme-dark .score-number {
    color: var(--color-white) !important;
}

.score-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    margin-top: 8px;
}

.scanner-greeting {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--color-text);
}
.theme-dark .scanner-greeting {
    color: var(--color-white) !important;
}

.scanner-results-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    text-align: left;
    margin-bottom: var(--space-xl);
}

.result-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}
.theme-dark .result-card {
    background: rgba(255,255,255,0.03) !important;
    border-color: rgba(184, 163, 137, 0.15) !important;
}

.result-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-metric {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-text);
}
.theme-dark .result-metric {
    color: var(--color-white) !important;
}

.result-score-bar {
    display: flex;
    align-items: center;
}


.premium-score-track {
    width: 80px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
    margin-right: 8px;
    position: relative;
}
.theme-dark .premium-score-track {
    background: rgba(255,255,255,0.1) !important;
}

.premium-score-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 1s ease-out;
}
.theme-dark .premium-score-fill {
    background: var(--color-gold) !important;
}

.score-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-light);
}

.luxury-icon {
    color: var(--color-primary);
}
.theme-dark .luxury-icon {
    color: var(--color-gold) !important;
}

.result-obs {
    font-size: 0.95rem;
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
    line-height: 1.4;
}
.theme-dark .result-obs {
    color: rgba(255,255,255,0.7) !important;
}

.result-rec {
    background: transparent;
    padding: 10px 0;
    border-top: 1px solid rgba(201, 175, 150, 0.2);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
}
.theme-dark .result-rec {
    border-top-color: rgba(184, 163, 137, 0.2) !important;
    background: transparent !important;
}

.rec-name {
    font-weight: 600;
    color: var(--color-text);
}
.theme-dark .rec-name {
    color: var(--color-gold) !important;
}

.rec-price {
    font-weight: 500;
    color: var(--color-text-light);
}

.scanner-priority {
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-lg);
    background: rgba(201, 175, 150, 0.1);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}
.theme-dark .scanner-priority {
    background: rgba(184, 163, 137, 0.1) !important;
    color: var(--color-white) !important;
}

.scanner-results-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

.scanner-disclaimer {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
