/* ========================================
   BUNK MANAGER - Design System
   Modern Dark Theme with Glassmorphism
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(255, 255, 255, 0.05);

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-rgb: 99, 102, 241;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    /* Status Colors */
    --color-safe: #22c55e;
    --color-safe-rgb: 34, 197, 94;
    --color-warning: #eab308;
    --color-warning-rgb: 234, 179, 8;
    --color-danger: #ef4444;
    --color-danger-rgb: 239, 68, 68;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Border & Shadow */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ========================================
   Reset & Base Styles
   ======================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;

    /* Prevents text selection highlight */
    -webkit-user-select: none;
    user-select: none;

    /* Disables the long-press popup menu (Copy/Share/Select All) */
    -webkit-touch-callout: none;
}

/* Background gradient effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: bgShift 15s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% {
        background:
            radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    }

    50% {
        background:
            radial-gradient(ellipse at 40% 60%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
            radial-gradient(ellipse at 70% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    }

    100% {
        background:
            radial-gradient(ellipse at 60% 40%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
            radial-gradient(ellipse at 30% 70%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
    }
}

/* ========================================
   Loading Splash (shown during auth check)
   ======================================== */

.loading-splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 9999;
    gap: var(--space-lg);
}

.loading-splash.hidden {
    display: none;
}

.loading-logo {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-lg);
    animation: pulse-logo 1.8s ease-in-out infinite;
    mix-blend-mode: screen;
}

.loading-title {
    font-family: 'Atomic Age', cursive;
    font-size: 2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse-logo 1.8s ease-in-out infinite;
    margin: 0;
}

@keyframes pulse-logo {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   Login Screen
   ======================================== */

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-lg);
    position: relative;
}

.login-card {
    background: rgba(18, 18, 26, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(99, 102, 241, 0.06);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    mix-blend-mode: screen;
}

.login-title {
    font-family: 'Atomic Age', cursive;
    font-size: var(--font-size-2xl);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Auth Buttons */
.auth-btn {
    width: 100%;
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-normal);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn.loading {
    position: relative;
    color: transparent;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.google-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.google-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.email-btn {
    background: var(--accent-gradient);
    color: white;
}

.email-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Auth Form */
.login-screen .form-input {
    width: 100%;
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.login-screen .form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.login-screen .form-input::placeholder {
    color: var(--text-muted);
}

.login-screen .form-group {
    margin-bottom: var(--space-md);
}

/* Auth Toggle */
.auth-toggle {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.auth-toggle a {
    color: var(--accent-primary);
    font-weight: 600;
    margin-left: var(--space-xs);
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* Auth Error */
.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    color: var(--color-danger);
    font-size: var(--font-size-sm);
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

/* Auth Success Message */
.auth-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    color: var(--color-safe);
    font-size: var(--font-size-sm);
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

/* Forgot Password Link */
.forgot-password {
    text-align: right;
    margin: calc(-1 * var(--space-sm)) 0 var(--space-md) 0;
}

.forgot-password a {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.forgot-password a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
    text-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

/* Account Linking Prompt */
.account-linking-prompt {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

.linking-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.linking-message {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.linking-message strong {
    color: var(--accent-primary);
}

.linking-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ========================================
   User Profile (Sidebar Footer)
   ======================================== */

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
}

.user-profile:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.1));
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: white;
    overflow: hidden;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon {
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;

    /* IMPORTANT: Re-enable selection for input fields! */
    -webkit-user-select: auto;
    user-select: auto;
}

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

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: rgba(18, 18, 26, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-normal);
}

/* Sidebar Overlay — covers content area when sidebar is open on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-bottom: var(--space-lg);
    margin-bottom: var(--space-lg);
    position: relative;
    cursor: pointer;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
}

.sidebar-header:hover .logo-img {
    transform: scale(1.08) rotate(-3deg);
    filter: drop-shadow(0 0 15px rgba(168, 85, 247, 0.4));
}

.logo {
    display: none;
    /* Hide old text logo container if present */
}

.logo-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
    mix-blend-mode: screen;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-text {
    font-size: 36px;
    font-family: 'Atomic Age', serif;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    border-radius: 0 4px 4px 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item:hover::before {
    transform: scaleY(0.4);
    opacity: 0.5;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, transparent 100%);
    color: white;
}

.nav-item.active::before {
    transform: scaleY(1);
    opacity: 1;
    box-shadow: 0 0 10px var(--accent-primary);
}

.nav-item.active svg {
    color: var(--accent-secondary);
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
    transform: scale(1.1);
    transition: all 0.3s ease;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: var(--space-lg);
    position: relative;
}

.sidebar-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
}

.user-profile .btn-icon {
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.user-profile .btn-icon:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
    transform: scale(1.1) rotate(5deg);
}

/* Main Content */
.main-content {
    flex: 1;
    width: 100%;
    margin-left: 300px;
    padding: var(--space-xl);
    min-height: 100vh;
    box-sizing: border-box;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 50%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    margin-top: var(--space-xs);
    letter-spacing: 0.03em;
}

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

.card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

/* ========================================
   Dashboard Poster / Banner
   ======================================== */

.dashboard-poster {
    position: relative;
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-xl);
    overflow: hidden;
    animation: posterSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(-12px);
}

@keyframes posterSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-poster.poster-dismissing {
    animation: posterSlideOut 0.4s ease forwards;
}

@keyframes posterSlideOut {
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        max-height: 0;
    }
}

/* Info Poster */
.info-poster {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.08) 50%, rgba(168, 85, 247, 0.06) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Birthday Poster */
.birthday-poster {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.15) 0%, rgba(168, 85, 247, 0.12) 30%, rgba(99, 102, 241, 0.1) 60%, rgba(16, 185, 129, 0.08) 100%);
    border: 1px solid rgba(236, 72, 153, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    min-height: 100px;
}

.poster-content {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    position: relative;
    z-index: 2;
}

.poster-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: posterIconFloat 3s ease-in-out infinite;
}

.birthday-icon {
    background: rgba(236, 72, 153, 0.15) !important;
    border-color: rgba(236, 72, 153, 0.25) !important;
    font-size: 2.8rem;
    animation: birthdayBounce 2s ease-in-out infinite !important;
}

@keyframes posterIconFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

@keyframes birthdayBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    25% {
        transform: translateY(-6px) scale(1.05);
    }

    50% {
        transform: translateY(0) scale(1);
    }

    75% {
        transform: translateY(-3px) scale(1.02);
    }
}

.poster-text {
    flex: 1;
    min-width: 0;
}

.poster-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    line-height: 1.3;
}

.birthday-poster .poster-title {
    background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 50%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: var(--font-size-2xl);
}

.poster-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.poster-subtitle strong {
    color: var(--accent-primary);
}

.poster-dismiss {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 5;
    line-height: 1;
}

.poster-dismiss:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    transform: scale(1.1);
}

/* Poster Glow Effect */
.poster-glow {
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: posterGlowPulse 4s ease-in-out infinite;
}

.birthday-glow {
    background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, transparent 70%) !important;
    width: 250px;
    height: 250px;
}

@keyframes posterGlowPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Confetti Animation */
.poster-confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    left: var(--x);
    width: 8px;
    height: 8px;
    border-radius: 2px;
    opacity: 0;
    animation: confettiFall 3.5s ease-in var(--delay) infinite;
}

.confetti-0 {
    background: #ec4899;
    width: 6px;
    height: 10px;
}

.confetti-1 {
    background: #6366f1;
    width: 8px;
    height: 6px;
}

.confetti-2 {
    background: #f59e0b;
    width: 5px;
    height: 8px;
    border-radius: 50%;
}

.confetti-3 {
    background: #10b981;
    width: 7px;
    height: 7px;
}

.confetti-4 {
    background: #a855f7;
    width: 9px;
    height: 5px;
    border-radius: 1px;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10px) translateX(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.9;
    }

    100% {
        transform: translateY(140px) translateX(var(--drift)) rotate(720deg);
        opacity: 0;
    }
}

/* ========================================
   Stats Cards
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    position: relative;
}

.stats-grid::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: ambientPulse 4s ease-in-out infinite;
    z-index: -1;
}

@keyframes ambientPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
}

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: statCardFadeIn 0.5s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes statCardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:nth-child(1)::before {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.stat-card:nth-child(2)::before {
    background: var(--accent-gradient);
}

.stat-card:nth-child(3)::before {
    background: linear-gradient(90deg, #eab308, #fbbf24);
}

.stat-card:nth-child(4)::before {
    background: linear-gradient(90deg, #a855f7, #c084fc);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.stat-card:nth-child(1):hover {
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.15);
}

.stat-card:nth-child(2):hover {
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15);
}

.stat-card:nth-child(3):hover {
    box-shadow: 0 8px 30px rgba(234, 179, 8, 0.15);
}

.stat-card:nth-child(4):hover {
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.15);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.15);
}

.stat-icon.primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.stat-icon.safe {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-safe);
}

.stat-icon.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--color-warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.stat-content h3 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    transition: color 0.3s ease;
}

.stat-card:hover .stat-content h3 {
    color: white;
}

.stat-content p {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    letter-spacing: 0.02em;
}

/* ========================================
   Subject Cards
   ======================================== */

.subject-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.1);
}

.subject-card:hover::before {
    transform: scaleX(1);
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.subject-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.subject-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    box-shadow: 0 0 8px currentColor;
    transition: transform 0.3s ease;
}

.subject-card:hover .subject-color {
    transform: scale(1.3);
}

.subject-percentage {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    transition: transform 0.3s ease;
}

.subject-card:hover .subject-percentage {
    transform: scale(1.05);
}

.subject-percentage.safe {
    color: var(--color-safe);
}

.subject-percentage.warning {
    color: var(--color-warning);
}

.subject-percentage.danger {
    color: var(--color-danger);
}

/* Progress Bar */
.progress-container {
    margin: var(--space-md) 0;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
}

.progress-fill.safe {
    background: linear-gradient(90deg, var(--color-safe), #4ade80);
}

.progress-fill.warning {
    background: linear-gradient(90deg, var(--color-warning), #fbbf24);
}

.progress-fill.danger {
    background: linear-gradient(90deg, var(--color-danger), #f87171);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* Bunk Budget */
.bunk-budget {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    font-weight: 500;
}

.bunk-budget.safe {
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-safe);
}

.bunk-budget.warning {
    background: rgba(234, 179, 8, 0.1);
    color: var(--color-warning);
}

.bunk-budget.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

/* ========================================
   Today's Classes Section
   ======================================== */

.today-section {
    margin-bottom: var(--space-xl);
}

.today-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.today-date {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.class-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.class-item {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.class-item:hover {
    background: var(--bg-card-hover);
    border-left-color: var(--accent-primary);
    transform: translateX(4px);
    box-shadow: -4px 0 15px rgba(99, 102, 241, 0.1);
}

.class-item.marked {
    opacity: 0.6;
    border-left-color: rgba(255, 255, 255, 0.1);
}

/* ---- Swipe Gesture Styles ---- */
.class-item.swipeable {
    overflow: hidden;
    position: relative;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
}

/* Indicator layers revealed behind swipe-content */
.swipe-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0 var(--space-xl);
    font-weight: 700;
    font-size: var(--font-size-lg);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 0;
}

.swipe-indicator-right {
    left: 0;
    justify-content: flex-start;
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.35), rgba(34, 197, 94, 0.08));
    color: var(--color-safe);
}

.swipe-indicator-left {
    right: 0;
    justify-content: flex-end;
    background: linear-gradient(270deg, rgba(239, 68, 68, 0.35), rgba(239, 68, 68, 0.08));
    color: var(--color-danger);
}

.swipe-indicator.visible {
    opacity: 1;
}

.swipe-indicator svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

/* The inner content that translates with the swipe */
.swipe-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: inherit;
    padding: var(--space-lg);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
}

.swipe-content.swiping {
    transition: none;
}

/* Swipe hint */
.swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    opacity: 0;
    animation: swipeHintFade 3s ease 1s forwards;
}

.swipe-hint .hint-arrow {
    display: inline-block;
    animation: swipeHintBounce 1.5s ease-in-out infinite;
}

.swipe-hint .hint-arrow-left {
    animation-direction: reverse;
}

@keyframes swipeHintFade {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 0.7;
    }

    80% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
    }
}

@keyframes swipeHintBounce {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(4px);
    }
}

.class-info {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.class-time {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    min-width: 80px;
}

.class-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.class-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ========================================
   Slot Notes
   ======================================== */

.btn-note {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    opacity: 0.4;
    transition: all var(--transition-fast);
}

.btn-note:hover {
    opacity: 1;
    background: rgba(99, 102, 241, 0.15);
}

.btn-note.has-note {
    opacity: 1;
}

.slot-note-editor {
    margin-top: var(--space-sm);
}

.slot-note-textarea {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-xs);
    resize: vertical;
    transition: border-color var(--transition-fast);
}

.slot-note-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.slot-note-textarea::placeholder {
    color: var(--text-muted);
}

.slot-note-preview {
    width: 100%;
    margin-top: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slot-note-preview:hover {
    color: var(--text-secondary);
}

.class-note-display {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
    padding: 2px 0;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.btn:hover::after {
    opacity: 1;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-secondary);
    border-color: rgba(99, 102, 241, 0.25);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.btn-attended {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-safe);
    border-color: rgba(34, 197, 94, 0.3);
}

.btn-attended:hover {
    background: rgba(34, 197, 94, 0.25);
}

.btn-attended.active {
    background: var(--color-safe);
    color: white;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
    animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    }
}

.btn-missed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-missed:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-missed.active {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.btn-cancelled {
    background: rgba(234, 179, 8, 0.15);
    color: var(--color-warning);
    border-color: rgba(234, 179, 8, 0.3);
}

.btn-cancelled:hover {
    background: rgba(234, 179, 8, 0.25);
}

.btn-cancelled.active {
    background: var(--color-warning);
    color: black;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ========================================
   Timetable Grid
   ======================================== */

.timetable-container {
    width: 100%;
}

.timetable-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* Updated Timetable list view styles used in app.js */
.timetable-day-column {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--space-md);
    height: 100%;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.timetable-day-column.drag-over {
    background: rgba(99, 102, 241, 0.15) !important;
    /* accent-primary with low opacity, but on top of base? No, background replaces */
    background: #1e1e2d !important;
    /* Solid lighter alternate */
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.timetable-slot-item {
    background: var(--bg-card);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left-width: 3px;
    border-left-style: solid;
    transition: background var(--transition-fast);
}

.timetable-slot-item:hover {
    background: var(--bg-card-hover);
}

.slot-time {
    font-family: monospace;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.slot-subject {
    margin-left: var(--space-sm);
    font-weight: 500;
    flex: 1;
}

.btn-icon-sm {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.btn-icon-sm:hover {
    background: var(--bg-card-hover);
    color: var(--color-danger);
}

.day-header {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-add-slot {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-add-slot:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* ========================================
   Modal System
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-danger);
    color: white;
}

.modal-body {
    margin-bottom: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* ========================================
   Custom Confirm/Alert Dialog (WebView safe)
   ======================================== */

.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.custom-dialog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 85%;
    max-width: 360px;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.custom-dialog-overlay.active .custom-dialog {
    transform: scale(1) translateY(0);
}

.custom-dialog-body {
    margin-bottom: var(--space-xl);
}

.custom-dialog-message {
    font-size: var(--font-size-md);
    color: var(--text-primary);
    line-height: 1.5;
    text-align: center;
}

.custom-dialog-footer {
    display: flex;
    gap: var(--space-md);
}

.custom-dialog-footer .btn {
    flex: 1;
    justify-content: center;
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-md);
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.custom-dialog-footer .btn.btn-ghost {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.custom-dialog-footer .btn.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

select.form-input option {
    background-color: #12121a;
    /* bg-secondary */
    color: #ffffff;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--bg-secondary);
}

/* ========================================
   Chatbot Interface
   ======================================== */

.chat-fab {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    z-index: 900;
    transition: all var(--transition-normal);
}

.chat-fab:hover {
    transform: scale(1.1);
}

.chat-fab.active {
    transform: rotate(45deg);
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: var(--space-xl);
    width: 380px;
    height: min(500px, calc(100vh - 120px));
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
    z-index: 899;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-info h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
}

.chat-info p {
    font-size: var(--font-size-xs);
    color: var(--color-safe);
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-message {
    max-width: 85%;
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.bot {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-bottom-left-radius: var(--space-xs);
}

.chat-message.user {
    background: var(--accent-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: var(--space-xs);
}

.chat-input-container {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.chat-input:focus {
    border-color: var(--accent-primary);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.chat-send:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

/* Quick Actions in Chat */
.chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.quick-action {
    padding: var(--space-sm) var(--space-md);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--accent-secondary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.quick-action:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    color: var(--accent-secondary);
}

.quick-action:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

/* Chat Typing Indicator */
.chat-typing {
    padding: 8px 16px;
}

.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    width: fit-content;
    border: 1px solid var(--border-color);
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing-bounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Chat Source Badges (AI / Logic / Fallback) */
.chat-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 6px;
    margin-bottom: 4px;
    font-weight: 600;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

.chat-badge.ai {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.chat-badge.logic {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.chat-badge.fallback {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

/* ========================================
   Settings Page
   ======================================== */

.settings-section {
    margin-bottom: var(--space-xl);
}

.settings-section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.settings-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    font-weight: 500;
}

.settings-description {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Toggle Switch */
.toggle {
    width: 48px;
    height: 26px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle.active {
    background: var(--accent-primary);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: var(--radius-full);
    transition: transform var(--transition-fast);
}

.toggle.active::after {
    transform: translateX(22px);
}

/* Time Picker */
.time-picker {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.time-picker input {
    width: 140px;
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-align: center;
    color-scheme: dark;
    /* Forces browser controls to be dark-themed */
}

/* Fix for WebKit browsers (Chrome/Edge/Safari) */
.time-picker input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    /* Inverts black icon to white */
    cursor: pointer;
}

/* ========================================
   Import/Export
   ======================================== */

.import-export-btns {
    display: flex;
    gap: var(--space-md);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-md);
}

/* ========================================
   Empty States
   ======================================== */

.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    margin-bottom: var(--space-lg);
}

/* ========================================
   Can I Bunk Today Widget
   ======================================== */

.bunk-widget {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.bunk-widget-header {
    margin-bottom: var(--space-md);
}

.bunk-widget-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.bunk-widget-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border-left: 3px solid transparent;
    background: var(--bg-card);
    transition: all var(--transition-fast);
    animation: slideUp 0.3s ease both;
}

.bunk-widget-row:hover {
    background: var(--bg-card-hover);
}

.bunk-widget-row.safe {
    border-left-color: var(--color-safe);
}

.bunk-widget-row.warning {
    border-left-color: var(--color-warning);
}

.bunk-widget-row.danger {
    border-left-color: var(--color-danger);
}

.bunk-widget-subject {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
}

.bunk-widget-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bunk-widget-pct {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.bunk-widget-verdict {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.bunk-widget-row.safe .bunk-widget-verdict {
    color: var(--color-safe);
}

.bunk-widget-row.warning .bunk-widget-verdict {
    color: var(--color-warning);
}

.bunk-widget-row.danger .bunk-widget-verdict {
    color: var(--color-danger);
}

.bunk-widget-icon {
    font-size: var(--font-size-md);
}

.bunk-widget-empty {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
}

.bunk-widget-empty span {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-sm);
}

/* ========================================
   Subject Attendance History Modal
   ======================================== */

.history-modal-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Stats summary */
.history-stats-row {
    display: flex;
    gap: var(--space-md);
}

.history-stat {
    flex: 1;
    text-align: center;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.history-stat.safe {
    border-bottom: 2px solid var(--color-safe);
}

.history-stat.danger {
    border-bottom: 2px solid var(--color-danger);
}

.history-stat.warning {
    border-bottom: 2px solid var(--color-warning);
}

.history-stat-num {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

.history-stat.safe .history-stat-num {
    color: var(--color-safe);
}

.history-stat.danger .history-stat-num {
    color: var(--color-danger);
}

.history-stat.warning .history-stat-num {
    color: var(--color-warning);
}

.history-stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Calendar heatmap */
.history-calendar {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
}

.cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.cal-month-label {
    font-weight: 600;
    font-size: var(--font-size-md);
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day-header {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 600;
    padding: var(--space-xs) 0;
}

.cal-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.cal-cell.empty {
    background: transparent;
}

.cal-cell:not(.empty) {
    background: rgba(255, 255, 255, 0.03);
}

.cal-cell.attended {
    background: rgba(34, 197, 94, 0.25);
    color: var(--color-safe);
    font-weight: 600;
}

.cal-cell.missed {
    background: rgba(239, 68, 68, 0.25);
    color: var(--color-danger);
    font-weight: 600;
}

.cal-cell.cancelled {
    background: rgba(234, 179, 8, 0.25);
    color: var(--color-warning);
    font-weight: 600;
}

.cal-cell.today {
    outline: 2px solid var(--accent-primary);
    outline-offset: -1px;
    border-radius: var(--radius-sm);
}

/* Calendar legend */
.cal-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.cal-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
}

.cal-dot.attended {
    background: var(--color-safe);
}

.cal-dot.missed {
    background: var(--color-danger);
}

.cal-dot.cancelled {
    background: var(--color-warning);
}

/* History log */
.history-log-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.history-log-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.history-log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.history-log-item:hover {
    background: var(--bg-card-hover);
}

.history-log-date {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.history-log-status {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.history-log-status.safe {
    color: var(--color-safe);
}

.history-log-status.danger {
    color: var(--color-danger);
}

.history-log-status.warning {
    color: var(--color-warning);
}

.history-empty {
    text-align: center;
    padding: var(--space-lg);
}

/* ========================================
   Quick Setup Wizard
   ======================================== */

/* Stepper */
.qs-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.qs-step {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    transition: all var(--transition-normal);
}

.qs-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-xs);
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    transition: all var(--transition-normal);
}

.qs-step.active .qs-step-num {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.qs-step.active {
    color: var(--text-primary);
    font-weight: 500;
}

.qs-step.completed .qs-step-num {
    background: var(--color-safe);
    border-color: var(--color-safe);
    color: #fff;
}

.qs-step.completed {
    color: var(--color-safe);
}

.qs-step-line {
    width: 40px;
    height: 2px;
    background: var(--border-color);
    transition: background var(--transition-normal);
}

.qs-step-line.completed {
    background: var(--color-safe);
}

/* Subject chip input area */
.qs-subject-form {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    align-items: flex-end;
}

.qs-subject-form .form-group {
    margin-bottom: 0;
}

.qs-subject-form .form-input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: border-color var(--transition-fast);
}

.qs-subject-form .form-input:focus {
    border-color: var(--accent-primary);
}

/* Color mini-picker */
.qs-color-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.qs-color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.qs-color-dot:hover {
    transform: scale(1.15);
}

.qs-color-dot.selected {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Subject chips container */
.qs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    min-height: 42px;
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
}

.qs-chips:empty::before {
    content: 'No subjects added yet — add your first one above ☝️';
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
}

.qs-chip {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
    animation: fadeInUp 0.2s ease;
}

.qs-chip-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.qs-chip-del {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--font-size-md);
    line-height: 1;
    padding: 0 2px;
    transition: color var(--transition-fast);
}

.qs-chip-del:hover {
    color: var(--color-danger);
}

/* Step 2 — Timetable Grid */
.qs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}

.qs-day-col {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    border: 1px solid var(--border-color);
}

.qs-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.qs-day-add {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: var(--font-size-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.qs-day-add:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.qs-slot-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    align-items: center;
    margin-bottom: var(--space-sm);
    padding: var(--space-xs);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    animation: fadeInUp 0.2s ease;
}

.qs-slot-row select,
.qs-slot-row input[type="time"] {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 4px 6px;
    font-size: var(--font-size-xs);
    flex: 1;
    min-width: 0;
}

.qs-slot-row select {
    flex: 1.5;
}

.qs-slot-del {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--font-size-md);
    padding: 0 4px;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.qs-slot-del:hover {
    color: var(--color-danger);
}

.qs-day-empty {
    text-align: center;
    padding: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-style: italic;
}

/* Step 3 — Review */
.qs-review {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.qs-review-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
}

.qs-review-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.qs-review-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.qs-review-day {
    margin-bottom: var(--space-md);
}

.qs-review-day:last-child {
    margin-bottom: 0;
}

.qs-review-day-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: capitalize;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.qs-review-slot {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.qs-review-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: var(--font-size-sm);
    text-align: center;
    padding: var(--space-lg);
}

/* Wizard footer */
.qs-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.qs-footer .btn {
    min-width: 120px;
    justify-content: center;
}

.qs-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: center;
    margin-top: var(--space-sm);
}

/* Widen modal when wizard is active */
.modal:has(.qs-stepper) {
    max-width: 900px;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
    }

    /* Timetable single column on mobile/tablet */
    #timetable-grid-content, .timetable-grid-view {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: var(--space-md);
    }

    .timetable-day-column {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-md) var(--space-lg);
        background: rgba(18, 18, 26, 0.8);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        position: sticky;
        top: 0;
        z-index: 50;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .mobile-header::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
    }

    .mobile-header .logo-img {
        width: 50px;
        height: 50px;
    }

    /* Show mobile header when sidebar is hidden */
    .mobile-header.hidden {
        display: flex !important;
    }

    .hamburger {
        width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: var(--radius-lg);
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .hamburger:hover {
        background: rgba(99, 102, 241, 0.15);
        border-color: rgba(99, 102, 241, 0.3);
        transform: scale(1.05);
    }

    /* Page header stacks on tablet */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
    }

    .dashboard-poster {
        padding: var(--space-md) var(--space-lg);
    }

    .poster-content {
        gap: var(--space-md);
    }

    .poster-icon {
        width: 48px;
        height: 48px;
        font-size: 1.8rem;
    }

    .birthday-icon {
        font-size: 2rem;
    }

    .poster-title {
        font-size: var(--font-size-lg);
    }

    .birthday-poster .poster-title {
        font-size: var(--font-size-xl);
    }

    .poster-subtitle {
        font-size: var(--font-size-xs);
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .class-item {
        padding: var(--space-md);
    }

    .class-item .swipe-content {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }

    .class-info {
        width: 100%;
        gap: var(--space-md);
    }

    .class-actions {
        width: 100%;
        justify-content: space-between;
    }

    .class-actions .btn {
        flex: 1;
        justify-content: center;
        min-height: 40px;
    }

    .chat-window {
        left: auto;
        right: var(--space-md);
        width: 380px;
        max-width: calc(100vw - 32px);
        bottom: 72px;
        height: auto;
        max-height: 70vh;
    }

    .chat-fab {
        bottom: var(--space-md);
        right: var(--space-md);
        width: 52px;
        height: 52px;
    }

    /* Settings rows stack on mobile */
    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .import-export-btns {
        flex-direction: column;
        width: 100%;
    }

    .import-export-btns .btn {
        width: 100%;
        justify-content: center;
    }

    /* Modal adjustments */
    .modal {
        width: 95%;
        max-height: 85vh;
        padding: var(--space-lg);
    }

    /* Force quick setup inputs to wrap neatly on mobile using Grid */
    .qs-slot-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr auto !important;
        gap: var(--space-xs);
    }
    .qs-slot-row select {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }
    .qs-slot-row input[type="time"],
    .qs-slot-row input[type="text"] {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Subject card — no lift on hover (prevents sticky-hover on touch) */
    .subject-card:hover {
        transform: none;
    }

    /* Stat card compact */
    .stat-card {
        padding: var(--space-md);
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-md);
    }

    .stat-content h3 {
        font-size: var(--font-size-xl);
    }

    /* Progress stats wrap */
    .progress-stats {
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    /* Quick Setup Wizard — tablet/mobile */
    .qs-subject-form {
        flex-direction: column;
        align-items: stretch;
    }

    .qs-subject-form .btn {
        width: 100%;
        height: auto;
        padding: var(--space-sm) var(--space-md);
    }

    .qs-color-row {
        flex-wrap: wrap;
    }

    .qs-grid {
        grid-template-columns: 1fr;
    }

    .qs-stepper {
        gap: var(--space-xs);
    }

    .qs-step-line {
        width: 24px;
    }

    .qs-footer {
        gap: var(--space-sm);
    }

    .qs-footer .btn {
        min-width: 100px;
    }
}

@media (max-width: 480px) {

    /* Quick Setup Wizard — small mobile */
    .qs-stepper {
        flex-wrap: wrap;
        justify-content: center;
    }

    .qs-step {
        font-size: var(--font-size-xs);
    }

    .qs-step-num {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .qs-step-line {
        width: 16px;
    }

    .qs-color-dot {
        width: 20px;
        height: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-sm);
    }

    .stat-card {
        padding: var(--space-sm) var(--space-md);
        gap: var(--space-sm);
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-sm);
        border-radius: var(--radius-sm);
    }

    .stat-content h3 {
        font-size: var(--font-size-lg);
    }

    .stat-content p {
        font-size: var(--font-size-xs);
    }

    .page-title {
        font-size: var(--font-size-xl);
    }

    .page-subtitle {
        font-size: var(--font-size-xs);
    }

    .main-content {
        padding: var(--space-md);
    }

    /* Header action buttons — compact */
    .header-actions {
        gap: var(--space-xs) !important;
    }

    .header-actions .btn {
        font-size: var(--font-size-xs);
        padding: var(--space-xs) var(--space-sm);
    }

    /* Today's classes — tighter */
    .class-item {
        padding: var(--space-sm) var(--space-md);
        border-radius: var(--radius-md);
    }

    .class-name {
        font-size: var(--font-size-sm);
    }

    .class-time {
        font-size: var(--font-size-xs);
        min-width: auto;
    }

    .class-actions .btn {
        font-size: var(--font-size-xs);
        padding: var(--space-xs) var(--space-sm);
        min-height: 36px;
    }

    /* Subject cards tighter */
    .subject-card {
        padding: var(--space-md);
    }

    .subject-name {
        font-size: var(--font-size-sm);
    }

    .subject-percentage {
        font-size: var(--font-size-xl);
    }

    .bunk-budget {
        font-size: var(--font-size-sm);
        padding: var(--space-sm) var(--space-md);
    }

    /* Card title */
    .card-title {
        font-size: var(--font-size-md);
    }

    /* Modal fullscreen-like */
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: var(--space-md);
    }

    .modal-title {
        font-size: var(--font-size-lg);
    }

    /* Chat window takes more space */
    .chat-window {
        left: auto;
        right: var(--space-sm);
        width: 350px;
        max-width: calc(100vw - 32px);
        bottom: 64px;
        height: min(500px, 70vh);
        border-radius: var(--radius-xl);
    }

    .chat-fab {
        width: 48px;
        height: 48px;
        bottom: var(--space-sm);
        right: var(--space-sm);
    }

    .chat-fab svg {
        width: 20px;
        height: 20px;
    }

    /* Quick actions scroll horizontally */
    .chat-quick-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-xs);
    }

    .quick-action {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Settings */
    .settings-card {
        padding: var(--space-md);
    }

    .settings-label {
        font-size: var(--font-size-sm);
    }

    .settings-description {
        font-size: var(--font-size-xs);
    }

    /* Manage subjects items wrap nicely */
    .manage-subject-item {
        font-size: var(--font-size-sm) !important;
        padding: var(--space-xs) var(--space-sm) !important;
    }

    /* Sidebar when open */
    .sidebar {
        width: 85vw;
        max-width: 300px;
    }
}

/* ========================================
   Animations & Utilities
   ======================================== */

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.3));
    border-radius: var(--radius-full);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.7), rgba(139, 92, 246, 0.6));
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Text utilities */
.text-safe {
    color: var(--color-safe);
}

.text-warning {
    color: var(--color-warning);
}

.text-danger {
    color: var(--color-danger);
}

.text-muted {
    color: var(--text-muted);
}

.text-xs {
    font-size: var(--font-size-xs);
}

/* Credits */
.credit {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    opacity: 0.6;
    transition: all 0.4s ease;
    cursor: default;
    background: linear-gradient(135deg, var(--text-muted), var(--text-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.credit:hover {
    opacity: 1;
    transform: translateX(2px);
    letter-spacing: 0.05em;
}

.heart {
    display: inline-block;
    animation: heartbeat 1.5s ease-in-out infinite;
    color: #ef4444;
    -webkit-text-fill-color: initial;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.3);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.3);
    }

    70% {
        transform: scale(1);
    }
}

/* ========================================
   Semester Management
   ======================================== */

/* Button variants for semester feature */
.btn-sm {
    padding: 6px 14px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-outline {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

/* Semester Actions Grid */
.semester-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.semester-action-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-xl);
    background: linear-gradient(145deg, rgba(30, 30, 42, 0.6), rgba(20, 20, 30, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: left;
}

.semester-action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.semester-action-card:hover {
    transform: translateY(-4px);
    background: linear-gradient(145deg, rgba(40, 40, 55, 0.7), rgba(25, 25, 35, 0.9));
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 20px rgba(99, 102, 241, 0.1);
}

.semester-action-card:hover::before {
    opacity: 1;
}

.semester-action-card--danger::before {
    background: linear-gradient(90deg, #10b981, #059669);
}

.semester-action-card--danger:hover {
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 20px rgba(16, 185, 129, 0.1);
}

.semester-action-icon {
    font-size: 26px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
    transition: transform 0.3s ease;
}

.semester-action-card--danger .semester-action-icon {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.semester-action-card:hover .semester-action-icon {
    transform: scale(1.05) rotate(-5deg);
}

.semester-action-info {
    margin-bottom: var(--space-lg);
}

.semester-action-info .settings-label {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 6px;
    color: white;
}

.semester-action-info .settings-description {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.semester-action-btns {
    display: flex;
    gap: var(--space-sm);
    margin-top: auto;
}

/* New Semester Modal */
.new-semester-modal {
    max-width: 500px;
}

.semester-warning-banner {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.semester-warning-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.semester-warning-text strong {
    color: var(--color-danger);
    font-size: var(--font-size-sm);
}

.semester-warning-text p {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    margin-top: 4px;
    line-height: 1.5;
}

.semester-archive-preview {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
}

.semester-preview-title {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.semester-preview-stats {
    display: flex;
    gap: var(--space-xl);
    justify-content: center;
}

.semester-preview-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.semester-preview-num {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--accent-primary);
}

.semester-preview-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Archive Cards — Premium Redesign */
.archive-card {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    margin-bottom: var(--space-lg);
}

.archive-card:last-child {
    margin-bottom: 0;
}

.archive-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.1);
}

/* Gradient accent bar at top */
.archive-card-accent {
    height: 4px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 40%, #a855f7 70%, #6366f1 100%);
    background-size: 200% 100%;
    animation: shimmer-accent 3s ease-in-out infinite;
}

@keyframes shimmer-accent {

    0%,
    100% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 100% 0%;
    }
}

.archive-card-inner {
    padding: var(--space-xl) var(--space-xl) var(--space-2xl);
}

/* Top section: info + ring */
.archive-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-lg);
}

.archive-card-info {
    flex: 1;
    min-width: 0;
}

.archive-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 4px;
}

.archive-semester-badge {
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.archive-name {
    font-weight: 700;
    font-size: var(--font-size-lg);
    background: linear-gradient(135deg, var(--text-primary) 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.archive-date {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

/* Stats pills */
.archive-stats-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.archive-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.archive-pill-icon {
    font-size: 12px;
}

.archive-pill--green {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.archive-pill--blue {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.archive-pill--yellow {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

/* Circular percentage ring */
.archive-ring-container {
    position: relative;
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}

.archive-ring {
    width: 90px;
    height: 90px;
    transform: rotate(-90deg);
}

.archive-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 6;
}

.archive-ring-fill {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px currentColor);
}

.archive-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
}

.archive-ring-pct {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.archive-ring-pct-sign {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Subject chips */
.archive-subjects-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.archive-subject-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.archive-subject-chip:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--chip-color, rgba(255, 255, 255, 0.15));
}

.archive-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 4px currentColor;
}

.archive-chip-more {
    color: var(--text-muted);
    font-style: italic;
}

/* Action buttons bar */
.archive-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: var(--space-md);
    padding: var(--space-lg) var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-color);
}

.archive-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.archive-action-btn svg {
    flex-shrink: 0;
}

.archive-action-btn:hover {
    transform: translateY(-2px);
}

.archive-action-btn--view {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

.archive-action-btn--view:hover {
    background: rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
}

.archive-action-btn--csv {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.archive-action-btn--csv:hover {
    background: rgba(34, 197, 94, 0.22);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.35);
}

.archive-action-btn--pdf {
    background: rgba(251, 146, 60, 0.1);
    border-color: rgba(251, 146, 60, 0.2);
    color: #fdba74;
}

.archive-action-btn--pdf:hover {
    background: rgba(251, 146, 60, 0.22);
    box-shadow: 0 4px 16px rgba(251, 146, 60, 0.2);
    border-color: rgba(251, 146, 60, 0.35);
}

.archive-action-btn--delete {
    margin-left: auto;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
    color: rgba(239, 68, 68, 0.5);
    padding: 10px 14px;
}

.archive-action-btn--delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
}

/* Archive View Modal */
.archive-view-modal {
    max-width: 500px;
}

.archive-view-header {
    text-align: center;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-lg);
}

.archive-view-date {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.archive-view-overall {
    margin-bottom: var(--space-sm);
}

.archive-view-overall-pct {
    font-size: 48px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.archive-view-overall-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.archive-view-subjects {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.archive-view-subject {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.archive-view-subject-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 500;
}

.archive-view-subject-stats {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.archive-view-subject-stats .subject-percentage {
    font-size: var(--font-size-md);
    font-weight: 700;
}

/* Mobile responsive for semester management */
@media (max-width: 768px) {
    .semester-actions-grid {
        grid-template-columns: 1fr;
    }

    .semester-preview-stats {
        gap: var(--space-lg);
    }

    .archive-card-top {
        flex-direction: column;
        align-items: stretch;
    }

    .archive-ring-container {
        align-self: center;
        margin-top: var(--space-sm);
    }

    .archive-card-actions {
        flex-wrap: wrap;
    }

    .archive-action-btn--delete {
        margin-left: 0;
    }

    .semester-warning-banner {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   AI Scanner Animation (Ultra Premium)
   ======================================== */
.ocr-scanner-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) 0;
    margin-bottom: var(--space-lg);
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px);
}

.ocr-scanner-animation.active {
    opacity: 1;
    transform: translateY(0);
}

.ai-premium-scanner {
    position: relative;
    width: 130px;
    height: 130px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-scanner-border {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(168, 85, 247, 0.1) 60deg, #a855f7 120deg, #6366f1 240deg, transparent 360deg);
    animation: spin-border 2s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.ai-scanner-content {
    width: 110px;
    height: 110px;
    background: rgba(20, 20, 30, 0.6);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.2);
    z-index: 2;
}

.ai-logo-pulse {
    width: 56px;
    height: 56px;
    object-fit: contain;
    animation: pulse-logo 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.6));
}

.ai-ripple {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(168, 85, 247, 0.4);
    z-index: 1;
}

.ai-ripple-1 {
    animation: ripple-out 2.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.ai-ripple-2 {
    animation: ripple-out 2.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
    animation-delay: 1.25s;
}

.ocr-status-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #a855f7, #6366f1, #3b82f6, #a855f7);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-text 3s linear infinite;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

@keyframes spin-border {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse-logo {

    0%,
    100% {
        transform: scale(0.95);
        opacity: 0.8;
        filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.4));
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
        filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.9));
    }
}

@keyframes ripple-out {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@keyframes gradient-text {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 300% center;
    }
}

/* ========================================
   WhatsApp Channel Link (Sidebar Footer)
   ======================================== */

.whatsapp-channel-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #25D366;
    font-size: var(--font-size-xs);
    font-weight: 500;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(37, 211, 102, 0.08);
    border: 1px solid rgba(37, 211, 102, 0.15);
    transition: all var(--transition-normal);
    margin-top: var(--space-xs);
}

.whatsapp-channel-link:hover {
    color: #25D366;
    background: rgba(37, 211, 102, 0.15);
    border-color: rgba(37, 211, 102, 0.35);
    box-shadow: 0 0 12px rgba(37, 211, 102, 0.2);
    transform: translateY(-1px);
}

.whatsapp-channel-link svg {
    flex-shrink: 0;
}

/* ========================================
   Legal Links (Login Screen)
   ======================================== */

.legal-links {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-md);
    line-height: 1.6;
}

.legal-links a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all var(--transition-fast);
}

.legal-links a:hover {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Legal Section in Settings */
.settings-legal-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 6px 14px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--accent-primary);
    text-decoration: none;
    background: rgba(var(--accent-primary-rgb), 0.08);
    border: 1px solid rgba(var(--accent-primary-rgb), 0.15);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.settings-legal-link:hover {
    background: rgba(var(--accent-primary-rgb), 0.15);
    border-color: rgba(var(--accent-primary-rgb), 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.15);
}