/* FILE: style.css */
/* ============================================================================ */
:root {
    /* Dark Mode (Default) */
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.2);
    --success: #10b981;
    --danger: #ef4444;
    --radius-lg: 16px;
    --radius-md: 12px;
    --sidebar-width: 260px;
}

/* Light Mode Variables - FIXED VISIBILITY */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #0284c7;
    --accent-glow: rgba(2, 132, 199, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- LAYOUT & RESPONSIVENESS --- */
.app-container { display: flex; min-height: 100vh; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s;
}

/* Mobile Layout */
@media (max-width: 768px) {
    .main-content { margin-left: 0; width: 100%; padding: 20px; padding-top: 80px; }
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); box-shadow: 10px 0 50px rgba(0,0,0,0.5); }
}

/* --- LOGIN PAGE FIXES --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
}

.logo-img { max-width: 100%; height: auto; }

/* --- WIZARD / QUESTIONNAIRE STYLES --- */
.wizard-step {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-bar-container {
    background: var(--glass-border);
    height: 6px;
    border-radius: 10px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.4s ease;
}

/* --- COMMON COMPONENTS --- */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.input-field {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus { border-color: var(--accent); }

/* Buttons */
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- INSTALL PROMPT (Slide Up) --- */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 20px 20px 0 0;
    z-index: 2000;
    display: none;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp { 
    from { transform: translateY(100%); } 
    to { transform: translateY(0); } 
}

/* Sidebar Specifics */
.sidebar { background: var(--bg-card); }
.nav-link { color: var(--text-secondary); }
.nav-link.active { background: var(--accent-glow); color: var(--accent); }
.nav-link:hover { color: var(--text-primary); }

/* Floating Support Button */
.fab-support {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    z-index: 1900;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999; 
    background: var(--bg-dark);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
    pointer-events: all;
}

.blink-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    animation: beep-pulse 1.5s infinite ease-in-out;
}

@keyframes beep-pulse {
    0% { transform: scale(1); opacity: 0.8; filter: drop-shadow(0 0 0px var(--accent)); }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 20px var(--accent)); }
    100% { transform: scale(1); opacity: 0.8; filter: drop-shadow(0 0 0px var(--accent)); }
}

#loading-text {
    margin-top: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Light Theme Loading Overlay */
[data-theme="light"] #loading-overlay {
    background: #ffffff;
}
[data-theme="light"] #loading-text {
    color: #1e293b;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 0.8rem;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    gap: 12px;
}

.nav-link:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-link.active {
    background: var(--accent);
    color: #ffffff !important;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-link i, .nav-link svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: var(--danger);
    background: rgba(239, 64, 64, 0.1);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* Improved theme toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 24px;
}
.slider-round:before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
input:checked + .slider-round:before {
    transform: translateX(26px);
}
/* Icons inside slider (handled via JS) */

/* Mobile responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.3);
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 80px;
    }
    .hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1100;
        background: var(--bg-card);
        border: 1px solid var(--glass-border);
        padding: 10px;
        border-radius: 10px;
        color: var(--text-primary);
        cursor: pointer;
    }
}

@media (min-width: 769px) {
    .sidebar-close-btn {
        display: none;
    }
    .hamburger {
        display: none;
    }
}

/* Button loading spinner */
.btn-loading .spinner,
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Help text */
.help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 4px;
}
.help-text i {
    width: 14px;
    height: 14px;
}

/* Theme toggle switch */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
}
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: 0.4s;
    border-radius: 26px;
    display: flex;
    align-items: center;
    padding: 2px;
}
.theme-slider .theme-icon {
    width: 22px;
    height: 22px;
    color: #0f172a;
    background-color: white;
    border-radius: 50%;
    padding: 4px;
    transition: transform 0.4s;
    transform: translateX(0);
}
input:checked + .theme-slider {
    background-color: var(--accent);
}
input:checked + .theme-slider .theme-icon {
    transform: translateX(26px);
}