@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Accessible Skincare Design Tokens (Light/Dark Variables) */
:root {
    /* DEFAULT LIGHT THEME (Luxury Sage & Warm Alabaster) */
    --bg-base: #fbfbfa;
    --bg-app: #f4f6f4;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(244, 246, 244, 0.95);
    
    --brand-sage: #166534; /* Rich Sage Green (Accessible against light backgrounds) */
    --brand-sage-light: #dcfce7;
    --brand-sage-glow: rgba(22, 101, 52, 0.15);
    
    --accent-emerald: #15803d;
    --accent-rose: #be123c; /* Redness highlights */
    --accent-amber: #b45309; /* Sebum highlights */
    --accent-sky: #0369a1; /* Pore/Blemish highlights */
    
    --text-primary: #1c1917; /* Slate Black */
    --text-secondary: #44403c;
    --text-muted: #78716c;
    --border-light: rgba(120, 113, 108, 0.12);
    --border-glow: rgba(22, 101, 52, 0.25);
    
    --shadow-premium: 0 15px 35px -5px rgba(28, 25, 23, 0.06), 0 5px 15px -5px rgba(28, 25, 23, 0.04);
    --shadow-glow: 0 0 20px rgba(22, 101, 52, 0.15);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

[data-theme="dark"] {
    /* DARK THEME (Luxury Obsidian & forest glows) */
    --bg-base: #0c0a09; /* Warm Obsidian Black */
    --bg-app: #141211;
    --bg-card: rgba(28, 25, 23, 0.7);
    --bg-card-hover: rgba(44, 40, 38, 0.8);
    
    --brand-sage: #4ade80; /* Soft glowing Sage Green */
    --brand-sage-light: rgba(22, 101, 52, 0.4);
    --brand-sage-glow: rgba(74, 222, 128, 0.15);
    
    --accent-emerald: #22c55e;
    --accent-rose: #f43f5e;
    --accent-amber: #fbbf24;
    --accent-sky: #38bdf8;
    
    --text-primary: #f5f5f4; /* Warm Alabaster White */
    --text-secondary: #d6d3d1;
    --text-muted: #a8a29e;
    --border-light: rgba(168, 162, 158, 0.12);
    --border-glow: rgba(74, 222, 128, 0.25);
    
    --shadow-premium: 0 20px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(74, 222, 128, 0.25);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 0% 0%, var(--brand-sage-glow) 0px, transparent 40%),
        radial-gradient(at 100% 100%, rgba(180, 83, 9, 0.05) 0px, transparent 45%);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
    position: relative;
    z-index: 10;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 2rem;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--brand-sage) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme Toggle Switcher */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.25s ease;
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
}

.theme-dark-icon { display: none; }
[data-theme="dark"] .theme-light-icon { display: none; }
[data-theme="dark"] .theme-dark-icon { display: block; }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-sage);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--brand-sage);
    box-shadow: 0 0 8px var(--brand-sage);
}

/* Global View Styles */
.view-section {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Onboarding Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, 0.45);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 28px;
    padding: 2.5rem;
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content h3 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.modal-steps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    text-align: left;
    margin-bottom: 2rem;
}

.modal-step-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.modal-step-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-sage-light);
    color: var(--brand-sage);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Landing Section */
.hero-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: center;
    padding: 2rem 0;
}

@media (max-width: 968px) {
    .hero-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
    .hero-cta-group, .hero-features {
        justify-content: center;
    }
}

.hero-content h2 {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.hero-content p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 620px;
}

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.feature-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: var(--brand-sage-light);
    border: 1px solid var(--border-glow);
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-sage);
}

.hero-cta-group {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

/* Premium Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--brand-sage) 100%);
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 1rem 2.25rem;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 35px var(--border-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    transform: none;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 1rem 2.25rem;
    border-radius: 16px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

/* Hero Mockup image ring */
.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glow-ring {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    border: 1px dashed var(--brand-sage);
    animation: rotateRing 25s linear infinite;
    pointer-events: none;
}

.visual-phone-mockup {
    width: 260px;
    height: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
}

.mockup-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}

@keyframes rotateRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Image Capture / Scan View */
.scan-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2.5rem;
}

@media (max-width: 868px) {
    .scan-grid {
        grid-template-columns: 1fr;
    }
}

.scan-box-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 28px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
}

.media-viewport-container {
    width: 100%;
    aspect-ratio: 4/3;
    max-width: 580px;
    background: #0d0c15;
    border-radius: 20px;
    border: 2px solid var(--border-light);
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.media-viewport-container video, .media-viewport-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.media-viewport-container video.active, .media-viewport-container img.active {
    display: block;
}

.media-viewport-container canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: none;
}

.media-viewport-container canvas.active {
    display: block;
}

/* Scanner Overlay */
.scanner-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    display: none;
}

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

.scanner-laser {
    position: absolute;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--brand-sage), var(--brand-sage), transparent);
    box-shadow: 0 0 20px 4px var(--brand-sage);
    animation: scannerLineMove 3.5s linear infinite;
}

@keyframes scannerLineMove {
    0% { top: 0%; opacity: 0; }
    5% { opacity: 1; }
    95% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Viewport Controls layout */
.viewport-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-top: 1.5rem;
    width: 100%;
    flex-wrap: wrap;
}

.btn-upload-input {
    display: none !important;
}

/* Shutter Button Style */
.shutter-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--brand-sage);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.25s ease;
    padding: 0;
    flex-shrink: 0;
}

.shutter-btn:hover {
    transform: scale(1.08);
}

.shutter-inner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-rose);
    transition: background 0.2s ease, transform 0.1s ease;
}

.shutter-btn:active .shutter-inner {
    background: #9f1239;
    transform: scale(0.9);
}

/* Quality Validation Alert */
.validation-error-alert {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    background: rgba(190, 18, 60, 0.95);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    display: none;
    z-index: 50;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    animation: slideDownIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideDownIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Questionnaire */
.quiz-container {
    max-width: 720px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 28px;
    padding: 3rem;
    box-shadow: var(--shadow-premium);
}

.quiz-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 99px;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    width: 20%;
    background: linear-gradient(to right, var(--accent-emerald), var(--brand-sage));
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.question-block {
    display: none;
}

.question-block.active {
    display: block;
    animation: quizSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.question-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
    color: var(--text-primary);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

@media (min-width: 580px) {
    .options-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.option-card {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--brand-sage);
    transform: translateY(-2px);
}

.option-card.selected {
    background: var(--brand-sage-light);
    border-color: var(--brand-sage);
    box-shadow: var(--shadow-glow);
}

.option-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Dashboard Metrics Breakdown */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.dashboard-hero-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 28px;
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
}

@media (min-width: 768px) {
    .dashboard-hero-card {
        grid-template-columns: 1.2fr 0.8fr;
    }
}

.report-summary h2 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.report-summary p {
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.summary-badge {
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border-light);
}

.summary-badge.skin-type { background: var(--brand-sage-light); color: var(--brand-sage); border-color: var(--border-glow); }
.summary-badge.concern { background: rgba(190, 18, 60, 0.08); color: var(--accent-rose); }
.summary-badge.environment { background: rgba(3, 105, 161, 0.08); color: var(--accent-sky); }

/* Score Circle Widget */
.score-widget-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.score-circle-outer {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-premium);
}

.svg-score-ring {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-90deg);
}

.circle-track {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 12;
}

.circle-fill {
    fill: none;
    stroke: var(--accent-emerald);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 565; /* 2 * PI * r (r=90) */
    stroke-dashoffset: 565;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s;
}

.score-center-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 10;
}

.score-number {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Metric Cards with Confidence Dials */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.metric-gauge-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 1.75rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.metric-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.metric-badge-status {
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-badge-status.optimal, .metric-badge-status.smooth { background: var(--brand-sage-light); color: var(--brand-sage); }
.metric-badge-status.moderate, .metric-badge-status.balanced { background: rgba(180, 83, 9, 0.08); color: var(--accent-amber); }
.metric-badge-status.deficient, .metric-badge-status.severe, .metric-badge-status.high { background: rgba(190, 18, 60, 0.08); color: var(--accent-rose); }

.metric-gauge-track {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 99px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.metric-gauge-bar {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.5s;
}

.metric-gauge-bar.hydration { background: var(--accent-sky); }
.metric-gauge-bar.oil { background: var(--accent-amber); }
.metric-gauge-bar.redness { background: var(--accent-rose); }
.metric-gauge-bar.acne { background: var(--brand-sage); }
.metric-gauge-bar.spots { background: var(--text-secondary); }

.metric-footer-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.metric-confidence {
    font-weight: 600;
    color: var(--brand-sage);
}

/* History Progress Tracking Grid */
.history-section-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2.5rem;
}

@media (max-width: 968px) {
    .history-section-layout {
        grid-template-columns: 1fr;
    }
}

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 28px;
    padding: 2rem;
    box-shadow: var(--shadow-premium);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 18px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.history-item:hover {
    border-color: var(--brand-sage);
    background: var(--bg-card-hover);
}

.history-item.selected {
    border-color: var(--brand-sage);
    background: var(--brand-sage-light);
}

.history-meta h5 {
    font-size: 0.95rem;
    font-weight: 700;
}

.history-meta p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-score-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--brand-sage);
}

/* SVG Line Graph styles */
.chart-container {
    width: 100%;
    height: 240px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-line {
    fill: none;
    stroke: var(--brand-sage);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-area {
    fill: url(#chartGrad);
}

.chart-dot {
    fill: var(--bg-base);
    stroke: var(--brand-sage);
    stroke-width: 3;
    transition: r 0.2s ease;
    cursor: pointer;
}

.chart-dot:hover {
    r: 7;
}

.chart-grid-line {
    stroke: var(--border-light);
    stroke-width: 1;
}

/* Before / After Visual Slider Wrapper */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
}

@media (max-width: 768px) {
    .comparison-container {
        grid-template-columns: 1fr;
    }
}

.slider-viewport {
    width: 100%;
    aspect-ratio: 4/3;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-premium);
    background: #0d0c15;
}

.slider-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.slider-handle-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    left: 50%;
    cursor: ew-resize;
    z-index: 100;
}

.slider-handle-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    background: white;
    border-radius: 50%;
    border: 2px solid var(--brand-sage);
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
    color: var(--brand-sage);
}

.slider-handle-button svg {
    width: 18px;
    height: 18px;
}

/* Products and Routines Listing Columns */
.routine-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 968px) {
    .routine-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.routine-column {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 28px;
    padding: 2.25rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
}

.routine-column.am { border-top: 5px solid var(--accent-amber); }
.routine-column.pm { border-top: 5px solid var(--brand-sage); }
.routine-column.weekly { border-top: 5px solid var(--accent-sky); grid-column: 1 / -1; }

@media (max-width: 968px) {
    .routine-column.weekly { grid-column: auto; }
}

.product-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-card {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    transition: all 0.3s ease;
}

.product-card:hover {
    border-color: var(--brand-sage);
    transform: translateY(-1px);
    background: var(--bg-card-hover);
}

.product-image-container {
    width: 90px;
    height: 90px;
    border-radius: 14px;
    background: white;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.product-image-container img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.product-brand-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(28,25,23,0.8);
    color: white;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    padding: 2px 0;
}

.product-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.product-brand {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--brand-sage);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.product-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0.25rem 0;
}

.product-actives {
    font-size: 0.75rem;
    color: var(--brand-sage);
    background: var(--brand-sage-light);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.product-reason {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    border-top: 1px dashed var(--border-light);
    padding-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.btn-buy-product {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--brand-sage-light);
    border: 1px solid var(--border-glow);
    color: var(--brand-sage);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.25s ease;
    align-self: flex-start;
}

.btn-buy-product:hover {
    background: var(--brand-sage);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Chat Assistant Side-drawer styles */
.chat-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-light);
    backdrop-filter: blur(20px);
    z-index: 1000;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-drawer.active {
    right: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.chat-header h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chat-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
}

.chat-messages-container {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.chat-bubble {
    padding: 1rem;
    border-radius: 18px;
    max-width: 85%;
    font-size: 0.88rem;
    line-height: 1.45;
}

.chat-bubble.assistant {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--brand-sage) 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-glow);
}

.chat-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.chat-input-field {
    flex-grow: 1;
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input-field:focus {
    border-color: var(--brand-sage);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: var(--brand-sage);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

/* Floating AI Action Button */
.floating-chat-trigger {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--brand-sage) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(22, 101, 52, 0.4);
    z-index: 999;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-chat-trigger:hover {
    transform: scale(1.08);
}

.floating-chat-trigger svg {
    width: 28px;
    height: 28px;
}

/* Skeleton Loading Shimmer Placeholders */
.skeleton-loader {
    width: 100%;
    background: var(--border-light);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.skeleton-loader::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2) 50%, transparent);
    animation: shimmerPulse 1.8s infinite;
}

[data-theme="dark"] .skeleton-loader::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05) 50%, transparent);
}

@keyframes shimmerPulse {
    100% { transform: translateX(100%); }
}

/* PRINT STYLES FOR PDF DOWNLOAD */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .app-container {
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    header, 
    .header-controls, 
    .theme-toggle-btn, 
    .viewport-controls, 
    .floating-chat-trigger, 
    .chat-drawer, 
    .btn-primary, 
    .btn-secondary,
    .report-footer, 
    .modal-overlay,
    .instructions-card,
    #toggleHeatmapBtn {
        display: none !important;
    }
    
    .view-section {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .dashboard-hero-card {
        border: 2px solid #ccc !important;
        background: #f9f9f9 !important;
        padding: 1.5rem !important;
        page-break-inside: avoid;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr 1fr !important;
        page-break-inside: avoid;
    }
    
    .routine-grid {
        grid-template-columns: 1fr 1fr !important;
        page-break-inside: avoid;
    }
    
    .product-card {
        border: 1px solid #ddd !important;
        background: white !important;
        page-break-inside: avoid;
    }
    
    .btn-buy-product {
        display: none !important;
    }
}

/* Timeline Layout */
.timeline-container {
    position: relative;
    padding-left: 0.5rem;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 72px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-light);
    border-style: dashed;
    z-index: 1;
}

.timeline-container > div {
    position: relative;
    z-index: 2;
    margin-bottom: 0.5rem;
}

/* Dot marker for timeline */
.timeline-container > div::before {
    content: '';
    position: absolute;
    left: 69px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-sage);
    border: 2px solid var(--bg-card);
    z-index: 3;
}

/* Interactive Face Map SVG path styling */
svg path[id^="face"] {
    fill: rgba(6, 182, 212, 0.04);
    stroke: var(--border-light);
    stroke-width: 0.8px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* SVG Active Highlight States */
svg path[id^="face"].active-apply {
    fill: rgba(22, 163, 74, 0.2) !important;
    stroke: var(--brand-sage) !important;
    stroke-width: 1.2px !important;
    filter: drop-shadow(0 0 4px rgba(22, 163, 74, 0.4));
}

svg path[id^="face"].active-avoid {
    fill: rgba(225, 29, 72, 0.15) !important;
    stroke: var(--accent-rose) !important;
    stroke-width: 1.2px !important;
}

svg path[id^="face"]:hover {
    fill: rgba(6, 182, 212, 0.15);
    stroke: #06b6d4;
    stroke-width: 1px;
}

/* Comparison Tables */
#compareTableBody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease;
}

#compareTableBody tr:hover {
    background: rgba(0, 0, 0, 0.01);
}

[data-theme="dark"] #compareTableBody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

#compareTableBody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    line-height: 1.45;
}

#compareTableBody td:first-child {
    font-weight: 700;
    color: var(--text-secondary);
}

/* Badge variants */
.badge-accent {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

