/* ==========================================================================
   SeenLabs Premium Design System (Local - Vendor Evaluation)
   Glassmorphism, Animated Inputs, and Score Gauge
   ========================================================================== */

:root {
    /* Brand Gradients (Aurora) */
    --gradient-hero: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); /* Unified Dark Theme */
    --gradient-glass: linear-gradient(145deg, rgba(255,255,255,0.7), rgba(255,255,255,0.3));
    
    /* Colors */
    --primary: #3b82f6; /* Brighter blue for dark bg */
    --primary-dark: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-body: #f8fafc;
    --surface: #ffffff;
    --border: #cbd5e1;
    
    /* Spacing & Layout */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --container-max: 1000px;
    
    /* Effects */
    --shadow-sm: 0 1px 3px 0 rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    --blur: blur(8px);
    --anim-fast: 0.2s ease;
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout Utilities */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 1.5rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-4 { gap: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-8 { margin-top: 2rem; }
.w-full { width: 100%; }
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: 1fr; }
@media(min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }


/* ==========================================================================
   Components
   ========================================================================== */

/* Hero Section (Clean Professional) */
.hero {
    background: var(--gradient-hero);
    color: white;
    padding: 5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.hero p {
    font-size: 1.15rem;
    color: rgba(255,255,255,0.9);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow var(--anim-fast);
}
.card:hover {
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--anim-fast);
    cursor: pointer;
    border: none;
    font-size: 1rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-outline {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--text-main);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Custom Checkboxes (Animated) */
.checklist-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: #f8fafc; }

.custom-checkbox {
    position: relative;
    cursor: pointer;
    font-size: 1.1rem;
    user-select: none;
    padding-left: 2rem;
    margin-right: 0.5rem;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 4px; /* Align with text line-height */
    left: 0;
    height: 22px;
    width: 22px;
    background-color: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.checklist-item:hover .checkmark {
    border-color: var(--primary);
    background-color: #f8fafc;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--success);
    border-color: var(--success);
    transform: scale(1.1);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Gauge / Score Panel (Fixed Bottom or Side) */
.score-panel {
    position: sticky;
    bottom: 2rem;
    z-index: 100;
    margin-top: 2rem;
}
.score-card {
    background: #1e293b;
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.score-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}
.score-label {
    font-size: 0.875rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.score-grade {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    background: rgba(255,255,255,0.1);
}
.grade-good { background: var(--success); color: white; }
.grade-warn { background: var(--warning); color: white; }
.grade-bad { background: var(--danger); color: white; }

/* Modal (Duplicated) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-glass);
    text-align: center;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    font-size: 1rem;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ==========================================================================
   Standard Header & Modals
   ========================================================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header__logo { display: flex; align-items: center; gap: 1rem; text-decoration: none; }
.header__logo-img { width: 36px; height: 36px; border-radius: 6px; }
.header__title-group { display: flex; flex-direction: column; gap: 2px; }
.header__brand { font-size: 0.6875rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.header__title { font-size: 1rem; font-weight: 700; color: var(--primary); }

.header__actions { display: flex; gap: 0.5rem; align-items: center; }

.btn--icon {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 6px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted);
    cursor: pointer; transition: all 0.2s;
}
.btn--icon:hover { background: var(--bg-body); color: var(--primary); border-color: var(--primary); }

.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 6px; background: transparent;
    border: 1px solid var(--border);
    cursor: pointer; transition: all 0.2s; color: var(--text-muted);
}
.theme-toggle:hover { background: var(--bg-body); color: var(--primary); transform: rotate(15deg); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }

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

/* Content Modals */
.modal {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%; max-width: 600px;
    max-height: 85vh;
    display: flex; flex-direction: column;
    position: relative;
    border: 1px solid var(--border);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal__close {
    position: absolute; top: 1rem; right: 1rem;
    background: transparent; border: none;
    font-size: 1.5rem; color: var(--text-muted);
    cursor: pointer; padding: 0.5rem;
    line-height: 1; z-index: 10;
}
.modal__close:hover { color: var(--danger); }

.modal__title {
    padding: 1.5rem 1.5rem 1rem;
    font-size: 1.5rem; font-weight: 700;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.faq-modal__content, .methodology-modal__content {
    padding: 1.5rem;
    overflow-y: auto;
}

.faq__item { margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.faq__question {
    padding: 1rem; background: var(--bg-body);
    font-weight: 600; cursor: pointer; user-select: none;
    list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.faq__question::after { content: '+'; font-size: 1.2rem; color: var(--text-muted); }
details[open] .faq__question::after { content: '-'; }
.faq__answer { padding: 1rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; }

.methodology-section { margin-bottom: 1.5rem; }
.methodology-section h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--primary); }
.methodology-section p, .methodology-section li { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; }
.methodology-section ul { padding-left: 1.5rem; }
.methodology-section li { margin-bottom: 0.5rem; }

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --surface: #1e293b;
    --border: #334155;
    --primary: #60a5fa;
    --gradient-hero: linear-gradient(135deg, #0f172a 0%, #172554 100%);
}

[data-theme="dark"] .header { background: rgba(30, 41, 59, 0.8); border-color: var(--border); }
[data-theme="dark"] .modal { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .faq__question { background: #0f172a; }

/* Interactive Elements Dark Mode */
[data-theme="dark"] .checklist-item { border-bottom-color: #334155; }
[data-theme="dark"] .checklist-item:hover { background: rgba(255,255,255,0.05); }

[data-theme="dark"] .checkmark {
    background-color: #334155;
    border-color: #475569;
}
[data-theme="dark"] .checklist-item:hover .checkmark {
    background-color: #475569;
    border-color: var(--primary);
}

/* ==========================================================================
   Sidebar Layout (Redesign Phase 11)
   ========================================================================== */
@media (min-width: 900px) {
    .app-layout {
        display: grid;
        grid-template-columns: 320px 1fr;
        gap: 3rem;
        align-items: start;
    }

    .sidebar {
        position: sticky;
        top: 6rem; /* 5rem header + 1rem buffer */
    }
}

.score-card {
    /* Updated for Sidebar context */
    display: block; /* Override flex */
    text-align: center;
    background: #1e293b;
    color: white;
    padding: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Mobile Adjustments for Score Card */
@media (max-width: 899px) {
    .app-layout {
        display: flex;
        flex-direction: column-reverse; /* Content first, then sidebar (bottom) */
    }
    
    .sidebar {
        position: sticky;
        bottom: 0;
        z-index: 50;
        background: var(--bg-body);
        padding: 1rem 0;
        border-top: 1px solid var(--border);
    }

    .score-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        margin-bottom: 0;
        text-align: left;
    }

    .score-card .text-center { text-align: left !important; }
    #score-text, #score-grade { display: none; } /* Hide details on mobile sticky bar */
    .score-value { font-size: 1.5rem; }
}
