/* styles.css - Complete Attendance Tracker Styles */

/* ============================================
   CSS VARIABLES & THEME
   ============================================ */
:root {
    --primary: #8B4513;
    --primary-light: #A0522D;
    --primary-dark: #654321;
    --secondary: #D2691E;
    --accent: #CD853F;
    --light-grey: #F5F5DC;
    --bg-color: #FFF8DC;
    --dark-text: #2F1B14;
    --grey-text: #8B7355;
    --light-text: #ffffff;
    --green: #228B22;
    --green-dark: #006400;
    --red: #B22222;
    --red-dark: #8B0000;
    --blue-accent: #4682B4;
    --blue-accent-dark: #2F4F4F;
    --yellow: #DAA520;
    --yellow-dark: #B8860B;
    --border-color: #DEB887;
    --popup-bg: rgba(245, 245, 220, 0.9);
    /* Beige translucent */
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(139, 69, 19, 0.1);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary: #A0522D;
    --primary-light: #CD853F;
    --primary-dark: #8B4513;
    --secondary: #F4A460;
    --accent: #DEB887;
    --light-grey: #2C2C2C;
    --bg-color: #1A1A1A;
    --dark-text: #E5E5E5;
    --grey-text: #B0B0B0;
    --light-text: #ffffff;
    --green: #32CD32;
    --green-dark: #228B22;
    --red: #FF6B6B;
    --red-dark: #DC143C;
    --blue-accent: #87CEEB;
    --blue-accent-dark: #4682B4;
    --yellow: #FFD700;
    --yellow-dark: #FFA500;
    --border-color: #404040;
    --popup-bg: rgba(44, 44, 44, 0.9);
    /* Dark grey translucent */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Color Schemes */
[data-color-scheme="ocean"] {
    --primary: #2E86AB;
    --primary-light: #3498DB;
    --primary-dark: #1B5E7F;
    --secondary: #3498DB;
    --accent: #5DADE2;
}

[data-color-scheme="forest"] {
    --primary: #2D5016;
    --primary-light: #4A7C59;
    --primary-dark: #1E3A0F;
    --secondary: #8FBC8F;
    --accent: #98D8C8;
}

[data-color-scheme="sunset"] {
    --primary: #D2691E;
    --primary-light: #FF7F50;
    --primary-dark: #A0522D;
    --secondary: #FF6347;
    --accent: #FFA07A;
}

[data-color-scheme="glass"] {
    --primary: #5227ff;
    --primary-light: #7c4dff;
    --primary-dark: #3f1dcb;
    --secondary: rgba(82, 39, 255, 0.8);
    --accent: rgba(124, 77, 255, 0.6);
    --light-grey: rgba(255, 255, 255, 0.2);
    --popup-bg: rgba(82, 39, 255, 0.4);
    /* Glass purple */
    --bg-color: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --dark-text: #ffffff;
    --grey-text: rgba(255, 255, 255, 0.7);
    --light-text: #ffffff;
    --border-color: rgba(255, 255, 255, 0.2);
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

[data-color-scheme="glass"] body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
}

[data-color-scheme="glass"] .app-header,
[data-color-scheme="glass"] .user-bar,
[data-color-scheme="glass"] .data-row,
[data-color-scheme="glass"] .settings-section,
[data-color-scheme="glass"] .modal-content {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-color-scheme="crimson"] {
    --primary: #dc2626;
    --primary-light: #ef4444;
    --primary-dark: #b91c1c;
}

[data-color-scheme="violet"] {
    --primary: #7c3aed;
    --primary-light: #8b5cf6;
    --primary-dark: #6d28d9;
}

[data-color-scheme="emerald"] {
    --primary: #059669;
    --primary-light: #10b981;
    --primary-dark: #047857;
}

[data-color-scheme="festive"] {
    --primary: #c41e3a;
    --primary-light: #dc143c;
    --primary-dark: #8b0000;
    --secondary: #228b22;
    --accent: #ffd700;
    --green: #228b22;
    --red: #c41e3a;
    --yellow: #ffd700;
}

[data-color-scheme="festive"] .app-header {
    background: linear-gradient(135deg, #c41e3a 0%, #228b22 50%, #8b0000 100%);
}

[data-color-scheme="festive"] .bulk-attendance-card {
    background: linear-gradient(135deg, #c41e3a 0%, #228b22 100%);
}

/* Font Settings */
[data-font="inter"] * {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

[data-font="roboto"] * {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

[data-font="philosopher"] * {
    font-family: 'Philosopher', serif !important;
}

.app-header h1,
h2,
h3,
h4,
.nav-link {
    font-family: 'Iceberg', serif !important;
}

/* Khmer Font Override */
[lang="km"] * {
    font-family: 'Kantumruy Pro', sans-serif !important;
}

/* ============================================
   BASE STYLES
   ============================================ */
.icon-svg {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-grey);
}

::-webkit-scrollbar-thumb {
    background: var(--grey-text);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

body {
    font-family: 'Philosopher', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--dark-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.header-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 12px 20px 0 20px;
    position: sticky;
    top: 12px;
    z-index: 1100;
}

.header-logo-circle {
    width: 67px;
    height: 67px;
    min-width: 67px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo-circle:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.header-logo-circle img {
    width: 67px;
    height: 67px;
    object-fit: contain;
}

.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--light-text);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    flex: 1;
    min-height: 52px;
    box-sizing: border-box;
}

.header-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
    font-family: 'Iceberg', serif !important;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
}

.app-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.app-nav {
    display: flex;
    gap: 1.5rem;
    position: relative;
}

.app-nav::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: var(--indicator-left, 0);
    width: var(--indicator-width, 0);
    height: 3px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.nav-link {
    color: var(--light-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: var(--red);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 10;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    line-height: 1;
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 700;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--light-text);
    cursor: pointer;
    padding: 0;
    border-radius: 25px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 32px;
    position: relative;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    left: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .theme-toggle::before {
    transform: translateX(38px);
    background: #1a1a1a;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    position: absolute;
    transition: all 0.3s ease;
    z-index: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

#sun-icon {
    left: 8px;
    opacity: 1;
    color: #ffffff;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
}

#moon-icon {
    right: 8px;
    opacity: 1;
    color: #ffffff;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

[data-theme="dark"] #sun-icon {
    opacity: 0.4;
    color: #ffffff;
    filter: none;
}

[data-theme="dark"] #moon-icon {
    opacity: 1;
    color: #ffffff;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
}

[data-theme="light"] #sun-icon {
    opacity: 1;
    color: #ffffff;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
}

[data-theme="light"] #moon-icon {
    opacity: 0.4;
    color: #ffffff;
    filter: none;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--light-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    z-index: 1200;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.user-bar {
    background-color: var(--light-grey);
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.user-bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.user-major {
    color: var(--grey-text);
    font-size: 0.85rem;
}

.user-id-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-username {
    font-size: 0.8rem;
    color: var(--grey-text);
}

.user-stats-bar {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

#streak-display {
    color: var(--green);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
    position: relative;
}

/* Milestone fire animation - floating fire SVGs across full screen */
.milestone {
    position: relative;
    animation: milestoneGlow 3s ease-in-out;
}

@keyframes milestoneGlow {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

.fire-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.fire-icon {
    position: absolute;
    width: 30px;
    height: 30px;
    opacity: 1;
    animation: floatUpAndPulse 3s linear forwards;
}

@keyframes floatUpAndPulse {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 1;
    }

    12.5% {
        transform: translateY(-12.5vh) scale(1.2);
        opacity: 1;
    }

    25% {
        transform: translateY(-25vh) scale(0.8);
        opacity: 1;
    }

    37.5% {
        transform: translateY(-37.5vh) scale(1.2);
        opacity: 0.9;
    }

    50% {
        transform: translateY(-50vh) scale(0.8);
        opacity: 0.8;
    }

    62.5% {
        transform: translateY(-62.5vh) scale(1.2);
        opacity: 0.7;
    }

    75% {
        transform: translateY(-75vh) scale(0.8);
        opacity: 0.6;
    }

    87.5% {
        transform: translateY(-87.5vh) scale(1.2);
        opacity: 0.3;
    }

    100% {
        transform: translateY(-100vh) scale(0.8);
        opacity: 0;
    }
}

.avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    background: var(--light-grey);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-container:hover {
    transform: scale(1.05);
}

.avatar-preview-small {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--light-grey);
}

.avatar-preview-small svg {
    width: 28px;
    height: 28px;
    color: var(--grey-text);
    display: block;
}

.avatar-edit-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    z-index: 2;
    transition: var(--transition);
}

.avatar-container:hover .avatar-edit-badge {
    background: var(--primary-light);
    transform: scale(1.1);
}

.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.avatar-preview-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--light-grey);
    border: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.avatar-preview-large svg {
    width: 56px;
    height: 56px;
    color: var(--grey-text);
    display: block;
}

.username-input-group {
    display: flex;
    gap: 0.5rem;
}

.username-input-group .form-input {
    flex: 1;
}

.username-status {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.username-status.success {
    color: var(--green);
}

.username-status.error {
    color: var(--red);
}

.crop-container {
    width: 100%;
    background: #000;
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
.page {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page.active {
    display: block;
    animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--dark-text);
}



/* ============================================
   DASHBOARD STYLES
   ============================================ */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ============================================
   SLIDESHOW STYLES
   ============================================ */
.slideshow-section {
    margin-bottom: 2rem;
}

.slideshow-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--light-grey);
}

.slideshow-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    width: 700%;
    /* 7 slides * 100% */
}

.slide {
    width: 14.2857%;
    /* 100% / 7 slides */
    flex-shrink: 0;
    position: relative;
    aspect-ratio: 3/1;
    background: var(--light-grey);
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
}

.slide-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.slideshow-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.dot.active {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

.dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .slide {
        aspect-ratio: 3/1;
    }

    .slide-title {
        font-size: 1.2rem;
    }

    .slide-overlay {
        padding: 1.5rem 1rem 1rem;
    }
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.dashboard-date {
    color: var(--grey-text);
    font-size: 0.95rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--light-grey);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    border-left: 4px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.stat-card-primary {
    border-left-color: var(--primary);
}

.stat-card-success {
    border-left-color: var(--green);
}

.stat-card-info {
    border-left-color: var(--blue-accent);
}

.stat-card-warning {
    border-left-color: var(--yellow-dark);
}

.stat-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    display: flex;
    align-items: center;
}

.stat-icon svg {
    width: 1em;
    height: 1em;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-text);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--grey-text);
    margin-top: 0.25rem;
}

.dashboard-section {
    background: var(--light-grey);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.section-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.section-badge-warning {
    background: var(--red);
}

.todays-subjects {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.subject-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    transition: var(--transition);
}

.subject-item:hover {
    transform: translateX(4px);
}

.subject-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.subject-item.status-present .subject-status-indicator {
    background: var(--green);
}

.subject-item.status-absent .subject-status-indicator {
    background: var(--red);
}

.subject-item.status-permission .subject-status-indicator {
    background: var(--blue-accent);
}

.subject-item.status-late .subject-status-indicator {
    background: var(--yellow);
}

.subject-item.status-pending .subject-status-indicator {
    background: var(--grey-text);
}

/* Today's Classes Contrast Fix */
.subject-item.status-present {
    background-color: var(--green) !important;
    border: 1px solid var(--green);
}

.subject-item.status-present .subject-name,
.subject-item.status-present .subject-status {
    color: white;
    font-weight: 600;
}

.subject-item.status-present .subject-status-indicator {
    background-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Dark Mode Overrides for Lime Green background */
[data-theme="dark"] .subject-item.status-present .subject-name,
[data-theme="dark"] .subject-item.status-present .subject-status {
    color: #003300;
    /* Dark green text for better contrast on lime green */
}

[data-theme="dark"] .subject-item.status-present .subject-status-indicator {
    background-color: #003300;
}

.subject-name {
    flex: 1;
    font-weight: 600;
}

.subject-status {
    font-size: 0.9rem;
    color: var(--grey-text);
}

.warnings-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.warning-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 3px solid var(--red);
}

.warning-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.warning-icon svg {
    width: 1em;
    height: 1em;
}

.warning-content {
    flex: 1;
}

.warning-subject {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.warning-status {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.warning-details {
    font-size: 0.9rem;
    color: var(--grey-text);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 8px;
    transition: var(--transition);
}

.activity-item:hover {
    transform: translateX(4px);
}

.activity-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.activity-indicator.status-present {
    background: var(--green);
}

.activity-indicator.status-absent {
    background: var(--red);
}

.activity-indicator.status-permission {
    background: var(--blue-accent);
}

.activity-indicator.status-late {
    background: var(--yellow);
}

.activity-content {
    flex: 1;
}

.activity-subject {
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.activity-date {
    font-size: 0.85rem;
    color: var(--grey-text);
}

.activity-status {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.activity-status.status-present {
    background: rgba(34, 139, 34, 0.1);
    color: var(--green-dark);
}

.activity-status.status-absent {
    background: rgba(178, 34, 34, 0.1);
    color: var(--red-dark);
}

.activity-status.status-permission {
    background: rgba(70, 130, 180, 0.1);
    color: var(--blue-accent-dark);
}

.activity-status.status-late {
    background: rgba(218, 165, 32, 0.1);
    color: var(--yellow-dark);
}

/* ============================================
   DATA ROWS & ATTENDANCE
   ============================================ */
.data-row {
    background-color: var(--light-grey);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.4s ease forwards;
    transition: var(--transition);
}

.data-row:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.data-row-completed {
    opacity: 0.7;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.subject-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.subject-info-detailed {
    flex: 1;
}

.subject-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.subject-name-large {
    font-weight: 600;
    font-size: 1.1rem;
}

.subject-day-badge {
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.subject-status-row {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.subject-warning {
    font-weight: 600;
}

.subject-percentage {
    font-weight: 600;
}

.subject-marked-badge {
    background: var(--green);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

.subject-edited-badge {
    background: var(--yellow);
    color: var(--dark-text);
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.edit-btn {
    background: linear-gradient(145deg, #f5d76e 0%, #e6c04a 100%);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: var(--dark-text);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    margin-right: 0.5rem;
    box-shadow: 0 2px 6px rgba(230, 192, 74, 0.35);
}

.edit-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #f7dc7a 0%, #d4a82e 100%);
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(212, 168, 46, 0.45);
}

.edit-btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
    opacity: 0.5;
}

.edit-btn svg {
    width: 19px;
    height: 19px;
}

.btn-orange {
    background: linear-gradient(135deg, var(--yellow) 0%, var(--yellow-dark) 100%);
    color: var(--dark-text);
}

.subject-row-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.data-row-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ============================================
   BULK ATTENDANCE CARD
   ============================================ */
.bulk-attendance-card {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    color: white;
}

.bulk-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.bulk-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

/* ============================================
   CUSTOM TIME PICKER
   ============================================ */
.bulk-icon svg {
    width: 1em;
    height: 1em;
}

.bulk-title {
    font-weight: 600;
    font-size: 1.1rem;
    flex: 1;
}

.bulk-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.bulk-btn {
    flex: 1 1 calc(50% - 0.375rem);
    min-width: 120px;
    padding: 0.75rem 0.75rem;
    border: 2px solid white;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.bulk-btn:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-2px);
}

.bulk-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bulk-btn-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* ============================================
   WEEKLY REPORT STYLES
   ============================================ */
.weekly-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-row {
    margin-bottom: 0;
}

.week-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--light-grey);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.summary-icon {
    font-size: 3rem;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-text);
}

.summary-label {
    font-size: 0.9rem;
    color: var(--grey-text);
}

.warnings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.warning-card {
    background: var(--light-grey);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.warning-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.warning-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.warning-subject-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.warning-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.warning-stats {
    display: flex;
    gap: 1rem;
}

.warning-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.warning-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-text);
}

.warning-stat-label {
    font-size: 0.8rem;
    color: var(--grey-text);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--light-text);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.btn-green {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
}

.btn-red {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
}

.tick-btn {
    background-color: var(--green);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.tick-btn:hover:not(:disabled) {
    background-color: var(--green-dark);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(34, 139, 34, 0.3);
}

.tick-btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
    opacity: 0.5;
}

.tick-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

/* Disabled status dropdown (after attendance submitted) */
.status-dropdown.disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.status-dropdown.disabled .dropdown-selected {
    cursor: not-allowed;
}


/* CSS Fix for Dropdown Clipping & Modal Scrolling */
.modal-overlay {
    overflow: hidden !important;
    padding: 0;
}

.modal-content {
    overflow: visible !important;
    /* Allow popups to pop out */
}

.modal-body {
    overflow-y: auto !important;
    padding: 2rem;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--grey-text) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--grey-text);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}


.tick-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   TOTAL PAGE - SUBJECT CARDS (Header-like Style)
   ============================================ */

/* Header labels for PRS/ABS/PER/LAT */
.total-header-labels {
    display: flex;
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--grey-text);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-header-spacer {
    flex: 1;
}

.total-header-counts {
    display: flex;
    gap: 0.5rem;
}

.total-header-label {
    width: 67px;
    text-align: center;
}

.total-subject-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.4s ease forwards;
}

.total-subject-bar {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--light-text);
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    min-height: 67px;
    box-sizing: border-box;
}

.total-subject-bar .subject-info-detailed {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.total-subject-bar .subject-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.total-subject-bar .subject-name-large {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--light-text);
}

.total-subject-bar .subject-day-badge {
    background: rgba(255, 255, 255, 0.25);
    color: var(--light-text);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.total-subject-bar .subject-status-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.total-subject-bar .subject-warning {
    opacity: 0.9;
}

.total-subject-bar .subject-percentage {
    font-weight: 600;
}

.total-count-circles {
    display: flex;
    gap: 0.5rem;
}

.count-circle {
    width: 67px;
    height: 67px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--light-text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.count-circle:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.count-circle.count-green {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
}

.count-circle.count-red {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
}

.count-circle.count-blue {
    background: linear-gradient(135deg, var(--blue-accent) 0%, var(--blue-accent-dark) 100%);
}

.count-circle.count-yellow {
    background: linear-gradient(135deg, var(--yellow) 0%, var(--yellow-dark) 100%);
    color: var(--dark-text);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .total-subject-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .total-count-circles {
        justify-content: center;
    }

    .count-circle {
        width: 56px;
        height: 56px;
        font-size: 1.1rem;
    }
}

/* ============================================
   COUNT BUBBLES
   ============================================ */
.count-bubble {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--light-text);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.count-green {
    background-color: var(--green);
}

.count-red {
    background-color: var(--red);
}

.count-blue {
    background-color: var(--blue-accent);
}

.count-yellow {
    background-color: var(--yellow);
    color: var(--dark-text);
}

/* ============================================
   DROPDOWNS
   ============================================ */
.custom-dropdown {
    position: relative;
    user-select: none;
    min-width: 140px;
}

.dropdown-selected {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    color: var(--light-text);
    padding: 0.875rem 1.25rem;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border: none;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 44px;
}

.dropdown-selected:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.dropdown-selected svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.custom-dropdown.open .dropdown-selected svg {
    transform: rotate(180deg);
}

.dropdown-options {
    display: none;
    position: absolute;
    background: var(--popup-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-y: auto;
    z-index: 20000;
    top: 110%;
    left: 0;
    width: 100%;
    max-height: 250px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: dropdownFade 0.2s ease;
}



@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-options.open {
    display: block !important;
}


.dropdown-option {
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    color: var(--dark-text);
}

.dropdown-option:hover {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    color: white;
}

.dropdown-option:first-child {
    border-radius: 16px 16px 0 0;
}

.dropdown-option:last-child {
    border-radius: 0 0 16px 16px;
}

/* Status dropdown colors */
.status-present {
    background: var(--green);
}

.status-absent {
    background: var(--red);
}

.status-permission {
    background: var(--blue-accent);
}

.status-late {
    background: var(--yellow);
    color: var(--dark-text);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    /* animation: fadeIn 0.3s ease; REMOVED to prevent freeze */
}

.modal-content {
    background: var(--light-grey);
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    /* Robust Flex */
    flex-direction: column;
    overflow: hidden !important;
    /* Contain the scrolling body, popups are ported anyway */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}



@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    /* Tighter padding */
    border-bottom: 1px solid var(--border-color);
}


.modal-header h4 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    /* Clear default browser margins */
}


.modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--grey-text);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--dark-text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    /* Restore padding here */
    border-top: 1px solid var(--border-color);
}


/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-text);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--bg-color);
    color: var(--dark-text);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

/* ============================================
   GOOGLE SIGN IN BUTTON
   ============================================ */
.google-btn {
    transition: background-color .3s, box-shadow .3s;
}

.google-btn:hover {
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15) !important;
    background-color: #f7f8f8 !important;
}

.google-btn:active {
    background-color: #f1f3f4 !important;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
    position: fixed;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 90vw;
    pointer-events: none;
}

.toast {
    background: var(--popup-bg);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    flex-direction: column;
    width: fit-content;
    max-width: 90vw;
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
    transition: none;
    border: 2px solid var(--primary);
    pointer-events: auto;
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.toast-show {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: toastSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast-hide {
    animation: toastSlideOut 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

.toast-success {
    border-color: var(--green);
}

.toast-error {
    border-color: var(--red);
}

.toast-warning {
    border-color: var(--yellow);
}

.toast-info {
    border-color: var(--primary);
}

.toast-loading {
    border-color: var(--primary);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    font-size: 1.25rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}

.toast-success .toast-icon {
    color: var(--green);
}

.toast-error .toast-icon {
    color: var(--red);
}

.toast-warning .toast-icon {
    color: var(--yellow-dark);
}

.toast-info .toast-icon {
    color: var(--primary);
}

.toast-loading .toast-icon {
    color: var(--primary);
}

.toast-message {
    font-weight: 500;
    color: var(--dark-text);
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Close button removed - toasts auto-close after 5s
.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--grey-text);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    opacity: 0.7;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.1);
    opacity: 1;
}
*/

/* Expandable toast styles */
.toast-expand-hint {
    font-size: 0.75rem;
    color: var(--grey-text);
    opacity: 0.7;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.toast-detail {
    position: absolute;
    width: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0;
    margin: 0;
    border-top: 0 solid transparent;
    /* When COLLAPSING: same timing as expand - text fades, then box shrinks */
    transition: opacity 0.3s ease-out,
        max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.35s,
        width 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.35s,
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.35s,
        margin 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.35s,
        position 0s linear 0.35s;
}

.toast-detail-message {
    font-size: 0.9rem;
    color: var(--dark-text);
    margin: 0 0 0.5rem 0;
    white-space: normal;
    line-height: 1.5;
}

.toast-detail-extra {
    font-size: 0.85rem;
    color: var(--grey-text);
    margin: 0;
    white-space: normal;
    line-height: 1.4;
}

/* Expanded state */
.toast-expanded {
    border-radius: 16px;
    max-width: 400px;
    min-width: 300px;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-expanded .toast-message {
    white-space: normal;
}

.toast-expanded .toast-expand-hint {
    display: none;
}

.toast-expanded .toast-detail {
    position: relative;
    width: 100%;
    max-height: 200px;
    opacity: 1;
    padding: 0.75rem 1rem 0.5rem;
    border-top-color: var(--border-color);
    margin-top: 0.75rem;
    /* When EXPANDING: box opens first, then text fades in after delay */
    transition: position 0s linear,
        width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        margin 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease-in 0.35s;
}

.toast-expanded .toast-content {
    flex-wrap: wrap;
}

/* ============================================
   SKELETON LOADERS
   ============================================ */
.skeleton-loader {
    animation: fadeIn 0.3s ease;
}

.skeleton-row {
    height: 80px;
    background: linear-gradient(90deg, var(--light-grey) 0%, var(--border-color) 50%, var(--light-grey) 100%);
    background-size: 200% 100%;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-list-item {
    padding: 1rem;
    background: var(--light-grey);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.skeleton-text {
    height: 16px;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--light-grey) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s infinite;
}

.skeleton-text-title {
    width: 60%;
    height: 20px;
    margin-bottom: 0.5rem;
}

.skeleton-text-subtitle {
    width: 40%;
}

.skeleton-text-large {
    width: 50%;
    height: 32px;
    margin-bottom: 0.5rem;
}

.skeleton-text-small {
    width: 70%;
    height: 14px;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--border-color) 0%, var(--light-grey) 50%, var(--border-color) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.skeleton-card {
    padding: 1.5rem;
    background: var(--light-grey);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.skeleton-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.skeleton-stat-card {
    padding: 1.5rem;
    background: var(--light-grey);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.skeleton-section {
    background: var(--light-grey);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--light-grey);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.empty-state-mini {
    text-align: center;
    padding: 2rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.empty-state-mini.success-state {
    background: rgba(34, 139, 34, 0.05);
    border: 2px solid var(--green);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    display: flex;
    justify-content: center;
    align-items: center;
}

.empty-icon svg {
    width: 1em;
    height: 1em;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-text);
}

.empty-state p,
.empty-text {
    color: var(--grey-text);
    margin-bottom: 1.5rem;
}

.empty-subtext {
    font-size: 0.9rem;
    color: var(--grey-text);
}

.empty-illustration {
    margin-bottom: 1.5rem;
}

/* ============================================
   FAB (Floating Action Button)
   ============================================ */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(139, 69, 19, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 999;
}

.fab:hover {
    transform: scale(1.1) rotate(360deg);
    box-shadow: 0 12px 32px rgba(139, 69, 19, 0.4);
}

.fab svg {
    width: 28px;
    height: 28px;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-section {
    background-color: var(--light-grey);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.settings-section:has(.settings-header.collapsible.collapsed) {
    padding: 1rem 1.5rem;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    transition: border-color var(--transition);
}

.settings-header.collapsible {
    cursor: pointer;
    user-select: none;
    /* Move layout properties here from :hover to prevent jumping */
    /* Reduced bottom margin and padding to fix "hollow" look */
    margin: 0 -1rem 0.5rem -1rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border-bottom: 2px solid transparent;
    /* Hide default border, let it be handled by section or specific spacing */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Ensure vertically centered */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-header.collapsible.collapsed {
    padding: 0.4rem 1rem;
    margin-bottom: 0;
}

/* Restore the separator line visually if needed, or rely on spacing. 
   Given the previous design had border-bottom, let's keep it subtle or handle it via margin.
   Actually, let's keep the visual 'row' feel without the jarring layout shift. */

.settings-header.collapsible:hover {
    background: rgba(0, 0, 0, 0.03);
    /* No margin/padding changes here! */
    transform: translateY(-1px);
}

.settings-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
}

.collapse-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy spring effect */
    color: var(--grey-text);
}

.settings-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.settings-content {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    overflow: hidden;
    max-height: 2000px;
}

.settings-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    pointer-events: none;
}

.settings-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    /* Slightly rounder */
    background-color: var(--bg-color);
    margin-bottom: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    /* Prevent border jump if added later */
}

.settings-list-item:hover {
    transform: translateY(-2px);
    /* Premium lift effect */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.05);
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 12000;
    align-items: center;
    justify-content: center;
}

.cute-loader {
    display: inline-block;
    position: relative;
    width: 40px;
    height: 40px;
    margin: 0 0.5rem;
}

.cute-loader::before {
    content: '🌸';
    position: absolute;
    font-size: 20px;
    animation: bounce 1.4s ease-in-out infinite both;
}

.cute-loader::after {
    content: '✨';
    position: absolute;
    font-size: 16px;
    left: 24px;
    top: -4px;
    animation: sparkle 1.4s ease-in-out infinite both;
    animation-delay: 0.2s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0.7;
    }

    40% {
        transform: scale(1.2) rotate(10deg);
        opacity: 1;
    }
}

@keyframes sparkle {

    0%,
    80%,
    100% {
        transform: scale(0.5) rotate(0deg);
        opacity: 0.5;
    }

    40% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
/* Responsive styles moved to consolidated blocks below */

/* ============================================
   DATE PICKER STYLES
   ============================================ */
.custom-date-picker {
    position: relative;
    min-width: 200px;
}

.date-picker-selected {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    color: var(--light-text);
    padding: 0.875rem 1.25rem;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border: none;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 44px;
}

.date-picker-selected:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.date-picker-calendar {
    display: none;
    position: absolute;
    background: var(--popup-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    z-index: 20000;
    top: 110%;
    left: 0;
    min-width: 280px;
    max-height: 350px;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    padding: 1rem;
}

.date-picker-calendar.open {
    display: block !important;
}


.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--dark-text);
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav:hover {
    background: rgba(139, 69, 19, 0.1);
    transform: scale(1.1);
}

.calendar-month-year {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark-text);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--grey-text);
    padding: 0.5rem;
}

.calendar-day {
    text-align: center;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
    color: var(--dark-text);
}

.calendar-day.disabled {
    color: var(--grey-text);
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}


.calendar-day.selected {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    color: white;
    font-weight: 700;
}

.calendar-day.other-month {
    color: var(--grey-text);
    opacity: 0.5;
}

.calendar-day.today {
    background: rgba(139, 69, 19, 0.15);
    font-weight: 700;
    box-shadow: inset 0 0 0 2px var(--primary);
}

@media (max-width: 768px) {
    .date-picker-calendar {
        min-width: 260px;
        max-height: 300px;
    }

    .calendar-grid {
        gap: 2px;
    }

    .calendar-day {
        padding: 0.5rem 0.25rem;
        font-size: 0.9rem;
    }
}

/* ============================================
   AUTH TABS
   ============================================ */
.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    color: var(--grey-text);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    font-size: 1rem;
}

.auth-tab:hover {
    color: var(--primary);
    background: rgba(139, 69, 19, 0.05);
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--grey-text);
    font-size: 0.9rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    .app-header,
    .user-bar,
    .theme-toggle,
    .btn,
    .fab,
    #toast-container,
    .modal-overlay {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .data-row,
    .settings-section,
    .stat-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .page {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================
   DARK MODE ENHANCEMENTS
   ============================================ */
[data-theme="dark"] .data-row:hover,
[data-theme="dark"] .settings-list-item:hover,
[data-theme="dark"] .stat-card:hover {
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .form-input {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .form-input:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-light);
}

[data-theme="dark"] .dropdown-option:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

[data-theme="dark"] .calendar-day:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .calendar-day.today {
    background: rgba(160, 82, 45, 0.3);
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */
.data-row,
.stat-card,
.settings-list-item,
.btn {
    will-change: transform;
}

.custom-dropdown.open {
    will-change: auto;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {

    .btn,
    .dropdown-selected,
    .data-row {
        border: 2px solid currentColor;
    }

    .status-present,
    .status-absent,
    .status-permission,
    .status-late {
        border: 2px solid white;
    }
}

/* ============================================
   CUSTOM SCROLLBAR FOR DATE PICKER
   ============================================ */
.date-picker-calendar::-webkit-scrollbar,
.dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.date-picker-calendar::-webkit-scrollbar-track,
.dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.date-picker-calendar::-webkit-scrollbar-thumb,
.dropdown-options::-webkit-scrollbar-thumb {
    background: var(--grey-text);
    border-radius: 3px;
}

.date-picker-calendar::-webkit-scrollbar-thumb:hover,
.dropdown-options::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ============================================
   LOADING STATES
   ============================================ */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */
.btn:active {
    transform: scale(0.95);
}

.dropdown-option:active,
.calendar-day:active {
    transform: scale(0.95);
}

.stat-card:active {
    transform: translateY(-2px) scale(0.98);
}

/* Hover effect for interactive elements */
.btn,
.dropdown-selected,
.date-picker-selected,
.nav-link,
.calendar-day,
.dropdown-option {
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   GLASS MORPHISM ENHANCEMENTS
   ============================================ */
[data-color-scheme="glass"] .dropdown-selected,
[data-color-scheme="glass"] .date-picker-selected {
    background: rgba(82, 39, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-color-scheme="glass"] .dropdown-options,
[data-color-scheme="glass"] .date-picker-calendar {
    background: rgba(82, 39, 255, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-color-scheme="glass"] .dropdown-option {
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-color-scheme="glass"] .dropdown-option:hover {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

[data-color-scheme="glass"] .custom-dropdown.open {
    z-index: 1001;
}

/* ============================================
   ADDITIONAL MOBILE OPTIMIZATIONS
   ============================================ */
/* Additional responsive styles moved to consolidated blocks below */

/* ============================================
   TABLET OPTIMIZATIONS
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    main {
        max-width: 900px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .warnings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   LARGE SCREEN OPTIMIZATIONS
   ============================================ */
@media (min-width: 1400px) {
    main {
        max-width: 1400px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .warnings-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .dropdown-selected,
    .date-picker-selected,
    .tick-btn,
    .calendar-day {
        min-height: 44px;
        min-width: 44px;
    }

    .dropdown-option {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .dropdown-selected:hover,
    .data-row:hover {
        transform: none;
    }
}

/* ============================================
   FOCUS STYLES FOR KEYBOARD NAVIGATION
   ============================================ */
.nav-link:focus-visible {
    outline: 2px solid var(--light-text);
    outline-offset: 4px;
}

.dropdown-option:focus {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    color: white;
    outline: none;
}

.calendar-day:focus {
    background: rgba(139, 69, 19, 0.2);
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* ============================================
   ERROR STATES
   ============================================ */
.form-input.error {
    border-color: var(--red);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(178, 34, 34, 0.1);
}

.error-message {
    color: var(--red);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.success-message {
    color: var(--green);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================================
   ASSISTANT OVERLAY STYLES
   ============================================ */
.assistant-overlay {
    position: fixed;
    bottom: 90px;
    right: 2rem;
    width: 350px;
    /* Use viewport height to prevent cutoff on small screens */
    max-height: calc(100vh - 120px);
    height: 500px;
    /* Fallback/Target height */
    background: var(--bg-color);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
    /* Prevent scrolling the body when scrolling inside the assistant */
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}

.assistant-overlay.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.assistant-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Ensure rounded corners clip content */
}

.assistant-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-grey);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.assistant-header h4 {
    margin: 0;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.assistant-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--grey-text);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.assistant-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--dark-text);
}

.assistant-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assistant-icon {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.assistant-content {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Smooth scrolling */
    scroll-behavior: smooth;
    /* Critical for preventing scroll propagation */
    overscroll-behavior: contain;
}

/* Chat Bubbles */
.chat-bubble {
    display: flex;
    gap: 0.5rem;
    max-width: 90%;
    animation: bubbleIn 0.3s ease;
}

@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-bubble.bot {
    align-self: flex-start;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.bubble-content {
    padding: 0.75rem 1rem;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.9rem;
}

.chat-bubble.bot .bubble-content {
    background: var(--light-grey);
    color: var(--dark-text);
    border-bottom-left-radius: 4px;
}

.chat-bubble.user .bubble-content {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--grey-text);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input Section */
.chat-input-section {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    background: var(--bg-color);
    border-radius: 0 0 16px 16px;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 0.9rem;
    background: var(--light-grey);
    color: var(--dark-text);
    transition: var(--transition);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.chat-input::placeholder {
    color: var(--grey-text);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.3);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.4);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* Suggested Questions */
.chat-suggestions {
    padding: 0.5rem 0;
}

.suggestions-label {
    font-size: 0.8rem;
    color: var(--grey-text);
    margin-bottom: 0.5rem;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-btn {
    padding: 0.5rem 0.75rem;
    background: var(--light-grey);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--dark-text);
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* No Match Message */
.no-match {
    text-align: center;
    color: var(--grey-text);
    padding: 1rem;
}

/* Contact Link in Chat */
.contact-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.contact-link:hover {
    color: var(--primary-light);
    text-decoration: none;
}

@media (max-width: 768px) {
    .assistant-overlay {
        width: calc(100vw - 2rem);
        right: 1rem;
        left: 1rem;
        bottom: 80px;
    }

    .assistant-overlay::after {
        right: 50px;
    }
}

/* ============================================
   COMPLETED - END OF STYLES
   ============================================ */

/* ============================================
   WEEKLY REPORT STATS
   ============================================ */
.weekly-stats-grid {
    display: flex;
    justify-content: space-around;
    padding: 1.5rem;
    background: var(--light-grey);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    min-width: 60px;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--grey-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.count-bubble {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.count-green {
    background: var(--green);
}

.count-red {
    background: var(--red);
}

.count-blue {
    background: var(--blue-accent);
}

.count-yellow {
    background: var(--yellow);
    color: var(--dark-text);
}

/* ============================================
   CUSTOM TIME PICKER
   ============================================ */
.custom-time-picker {
    position: relative;
    cursor: pointer;
    width: 100%;
}

.time-picker-display {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    min-height: 48px;
}

.custom-time-picker.open .time-picker-display {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.time-picker-display span {
    font-weight: 500;
}

.time-picker-dropdown {
    position: absolute;
    top: 110%;
    /* Slight gap */
    left: 0;
    width: 100%;
    background: var(--popup-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    /* Strong shadow for popup feel */
    z-index: 20000;
    /* Consistently King */
    display: none;
    padding: 0.75rem;
    max-height: 300px;
    flex-direction: row;
    gap: 0.5rem;
}

.time-picker-dropdown.open {
    display: flex !important;
    animation: fadeIn 0.2s ease;
}


.time-column {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    scrollbar-width: thin;
    max-height: 250px;
}

.time-column::-webkit-scrollbar {
    width: 4px;
}

.time-column::-webkit-scrollbar-thumb {
    background: var(--grey-text);
    border-radius: 4px;
}

.time-option {
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.time-option:hover {
    background: var(--primary-light);
    color: white;
}

.time-option.selected {
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 1.1em;
}

.time-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--dark-text);
    padding-bottom: 2rem;
}

/* Hybrid Time Picker Input */
.time-manual-input {
    border: none;
    background: transparent;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--dark-text);
    width: 80px;
    outline: none;
    padding: 0;
}

.time-manual-input::placeholder {
    color: var(--grey-text);
}

.time-picker-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: var(--grey-text);
}

.time-picker-icon:hover {
    background-color: var(--light-grey);
    color: var(--primary);
}

/* ============================================
   CONSOLIDATED RESPONSIVE DESIGN
   ============================================ */

/* TABLET & MOBILE (Up to 768px) */
@media (max-width: 768px) {
    .app-header {
        padding: 0.625rem 1rem;
        flex-direction: row !important;
        /* FORCE SINGLE LINE */
        justify-content: space-between;
        align-items: center;
        height: auto;
        gap: 0.5rem;
        margin: 8px 12px 0 12px;
        top: 8px;
        border-radius: 40px;
    }

    .app-header>div:first-child {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        overflow: hidden;
    }

    .app-header h1 {
        font-size: 1.15rem;
        white-space: nowrap;
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-header img {
        width: 24px !important;
        height: 24px !important;
        flex-shrink: 0;
    }

    .mobile-menu-toggle {
        display: flex;
        order: 3;
    }

    .theme-toggle {
        order: 2;
        margin-left: auto;
    }

    .app-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-color);
        flex-direction: column;
        padding: 5rem 1.5rem 2rem;
        gap: 1rem;
        z-index: 1200;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
        border-left: 1px solid var(--border-color);
    }

    .app-nav.mobile-open {
        right: 0;
    }

    .nav-link {
        color: var(--dark-text);
        font-size: 1.1rem;
        padding: 1rem;
        width: 100%;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
    }

    .nav-link.active {
        background: var(--light-grey);
        color: var(--primary);
        font-weight: 700;
    }

    main {
        padding: 0.75rem;
    }

    /* User Bar Optimization */
    .user-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 1.25rem;
    }

    .user-id-card {
        width: 100%;
        gap: 1.25rem;
    }

    .avatar-container {
        width: 64px;
        height: 64px;
    }

    .avatar-edit-badge {
        width: 20px;
        height: 20px;
        bottom: -2px;
        right: -2px;
    }

    .user-details {
        flex: 1;
        gap: 0.25rem;
    }

    .user-info {
        font-size: 1.1rem;
    }

    .user-stats-bar {
        text-align: left;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    #streak-display {
        justify-content: flex-start;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Total Page Improvement on Mobile */
    .total-subject-row .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem;
    }

    .total-subject-row .data-row-right {
        width: 100%;
        justify-content: space-around;
        margin-top: 0.5rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
        gap: 0;
    }

    .total-subject-row .count-bubble {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Settings Button Resizing */
    .settings-section .btn {
        padding: 0.5rem 0.8rem !important;
        font-size: 0.85rem !important;
    }

    .settings-header .btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    .btn-group .btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    #profile-content .btn,
    #account-management .btn,
    #notifications-content .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .settings-avatar-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    .avatar-preview-large {
        width: 120px;
        height: 120px;
    }

    .avatar-preview-large svg {
        width: 70px;
        height: 70px;
    }

    /* Hidden elements on mobile */
    .mobile-hide {
        display: none !important;
    }

    #toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .fab {
        bottom: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
    }

    /* Page specific overrides for row layout */
    [data-page="Total"] .page-header {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    [data-page="Total"] .page-header h2 {
        font-size: 1.25rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* Smaller Export Button on Mobile */
    #export-type-dropdown {
        min-width: unset !important;
    }

    #export-type-dropdown .dropdown-selected {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
        min-height: 32px !important;
        border-radius: 16px !important;
        white-space: nowrap !important;
        gap: 0.4rem !important;
    }

    #export-type-dropdown .dropdown-selected span {
        font-weight: 500 !important;
    }

    #export-type-dropdown .dropdown-selected svg {
        width: 12px !important;
        height: 12px !important;
    }
}

/* SMALL PHONES (Up to 480px) */
@media (max-width: 480px) {
    .user-bar {
        padding: 0.85rem;
        gap: 0.85rem;
    }

    .avatar-container {
        width: 56px;
        height: 56px;
    }

    .user-stats-bar {
        padding-top: 0.85rem;
    }

    .app-header h1 {
        font-size: 1.1rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .modal-content {
        padding: 1.25rem;
        width: 95%;
    }

    /* Page specific overrides for row layout */
    [data-page="Total"] .page-header {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    [data-page="Total"] .page-header h2 {
        font-size: 1.15rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* Smaller Export Button on Mobile */
    #export-type-dropdown .dropdown-selected {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.75rem !important;
        min-height: 30px !important;
        border-radius: 15px !important;
        white-space: nowrap !important;
        gap: 0.35rem !important;
    }

    #export-type-dropdown .dropdown-selected span {
        font-weight: 500 !important;
    }

    #export-type-dropdown .dropdown-selected svg {
        width: 12px !important;
        height: 12px !important;
    }
}

/* ============================================
   FOCUS PAGE STYLES
   ============================================ */
.focus-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.timer-section {
    background: var(--popup-bg);
    border-radius: 24px;
    padding: 60px 40px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 40px;
    background: var(--light-grey);
    padding: 6px;
    border-radius: 16px;
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--grey-text);
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: var(--bg-color);
    color: var(--dark-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.timer-container-circle {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 40px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform-origin: 50% 50%;
}

.time-value-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-text-large {
    font-size: 64px;
    font-weight: 600;
    color: var(--dark-text);
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

.status-text-small {
    font-size: 16px;
    color: var(--grey-text);
    margin-top: 8px;
    font-weight: 500;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    align-items: center;
    margin-bottom: 30px;
}

.control-btn-large {
    padding: 18px 48px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
}

.btn-secondary {
    background: var(--light-grey);
    color: var(--dark-text);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.icon-btn-small {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--light-grey);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    color: var(--dark-text);
}

.icon-btn-small:hover {
    background: var(--border-color);
}

.custom-time-input {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--grey-text);
}

.mini-input {
    width: 60px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--light-grey);
    color: var(--dark-text);
    text-align: center;
}

.btn-small {
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--light-grey);
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--dark-text);
}

.focus-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.focus-card {
    background: var(--popup-bg);
    border-radius: 24px;
    padding: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--dark-text);
}

.focus-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-item {
    text-align: center;
}

.stat-val {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--primary);
}

.stat-lbl {
    font-size: 12px;
    color: var(--grey-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-input-wrap {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.task-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    background: var(--light-grey);
    color: var(--dark-text);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
}

.btn-icon-only {
    width: 46px;
    border: none;
    background: var(--light-grey);
    color: var(--dark-text);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-only:hover {
    background: var(--primary);
    color: white;
}

.focus-task-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.focus-task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-grey);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.focus-task-item:hover {
    transform: translateX(4px);
    background: var(--border-color);
}

.focus-task-item.completed {
    opacity: 0.6;
}

.focus-task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--grey-text);
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--grey-text);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.focus-task-item.completed .task-checkbox {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.task-text {
    flex: 1;
    font-size: 15px;
    color: var(--dark-text);
}

.delete-task-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--grey-text);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-task-btn:hover {
    background: rgba(255, 0, 0, 0.1);
    color: var(--red);
}

.quote-card {
    padding: 24px;
    background: var(--popup-bg);
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
    font-style: italic;
    color: var(--grey-text);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow);
}

.empty-task-msg {
    text-align: center;
    color: var(--grey-text);
    font-style: italic;
    padding: 20px;
}

@media (max-width: 900px) {
    .focus-grid {
        grid-template-columns: 1fr;
    }

    .time-value {
        font-size: 80px;
    }

    .timer-section {
        padding: 40px 20px;
    }
}

/* Updated Task Styles */
.focus-task-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
    max-height: 400px;
    /* Limit height */
    overflow-y: auto;
    /* Enable scrolling */
    padding-right: 4px;
    /* Space for scrollbar */
    padding-bottom: 4px;
    /* internal padding */
}

/* Custom Scrollbar for task container */
.focus-task-container::-webkit-scrollbar {
    width: 6px;
}

.focus-task-container::-webkit-scrollbar-track {
    background: transparent;
}

.focus-task-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.focus-task-container::-webkit-scrollbar-thumb:hover {
    background: var(--grey-text);
}

.focus-task-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.focus-task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.focus-task-card.completed {
    opacity: 0.6;
    background: var(--bg-color);
}

.focus-task-card.completed .task-text {
    text-decoration: line-through;
    color: var(--grey-text);
}

/* Updated Task Checkbox */
.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    color: white;
}

.focus-task-card.completed .task-checkbox {
    background: var(--primary);
}

/* Updated Delete Button */
.delete-task-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border-radius: 50%;
}

.delete-task-btn:hover {
    background: rgba(255, 59, 48, 0.1);
    color: var(--error);
}

/* ============================================
   FOCUS PAGE STYLES - REFINED
   ============================================ */
/* Quote Card - New Placement */
.quote-card-top {
    margin-bottom: 2rem;
    text-align: center;
    max-width: 80%;
    animation: fadeIn 0.5s ease;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#quote-text-top {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--primary);
    font-family: 'Philosopher', serif;
    line-height: 1.4;
    transition: opacity 0.3s ease;
}

/* Segmented Toggle - Sliding Glider (Grid Layout) */
.focus-toggle-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Strictly equal columns */
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50px;
    padding: 4px;
    margin: 0 auto 2rem;
    /* Center it */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    position: relative;
    width: fit-content;
    /* Shrink to fit content (widest item defines scale) */
    min-width: 380px;
    /* Increased to prevent "Short Break" expansion */
    z-index: 0;
}

[data-theme="dark"] .focus-toggle-container {
    background: rgba(255, 255, 255, 0.05);
}

.focus-toggle-btn {
    padding: 0.8rem 0.5rem;
    /* Reduced horizontal padding, rely on grid width */
    border: none;
    background: transparent;
    color: var(--grey-text);
    font-weight: 500;
    cursor: pointer;
    border-radius: 40px;
    transition: color 0.3s ease;
    font-size: 0.95rem;
    text-align: center;
    white-space: nowrap;
    position: relative;
    z-index: 2;
    /* Above glider */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    /* Ensure full height */
}

[data-theme="dark"] .focus-toggle-btn {
    color: var(--light-text);
    opacity: 0.7;
}

.focus-toggle-btn:hover {
    opacity: 1;
}

.focus-toggle-btn.active {
    color: white !important;
    opacity: 1;
    font-weight: 600;
    background: transparent;
    box-shadow: none;
    transform: none;
}

.toggle-glider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    /* Use top/bottom instead of height calculation */
    left: 4px;
    width: calc((100% - 8px) / 3);
    /* 1/3 of total available width */
    background: var(--primary);
    border-radius: 40px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(calc(var(--toggle-index, 0) * 100%));
}

/* Locked Options Styles */
.dropdown-option.locked-option {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-option.locked-option:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--grey-text);
}

.lock-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--grey-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.lock-badge svg {
    width: 12px;
    height: 12px;
}

/* Forgot Password Link */
.forgot-password-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.forgot-password-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Fix excessive gap in Auth Modal */
#auth-modal .modal-header {
    border-bottom: none;
    padding-bottom: 0.5rem;
}

#auth-modal .modal-body {
    padding-top: 0.5rem;
}

/* Fix gap between password and sign in button */
#signin-form .form-group:last-of-type {
    margin-bottom: 0.25rem;
}

#signin-btn {
    margin-top: 0.5rem !important;
}

/* ============================================
   TUTORIAL OVERLAY
   ============================================ */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: auto;
}

.tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    transition: opacity 0.3s ease;
}

.tutorial-spotlight {
    position: absolute;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.85),
        0 0 0 4px rgba(255, 255, 255, 0.9),
        0 0 30px 8px rgba(255, 255, 255, 0.4),
        0 0 60px 15px rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10001;
}

.tutorial-tooltip {
    position: absolute;
    background: var(--bg-color);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 380px;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 10002;
    animation: tutorialFadeIn 0.3s ease;
}

@keyframes tutorialFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tutorial-tooltip-content {
    margin-bottom: 1.25rem;
}

.tutorial-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
    font-family: 'Iceberg', serif !important;
}

.tutorial-desc {
    font-size: 0.95rem;
    color: var(--grey-text);
    line-height: 1.5;
    margin: 0;
}

.tutorial-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.tutorial-progress {
    display: flex;
    gap: 8px;
}

.tutorial-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tutorial-dot:hover {
    background: var(--grey-text);
    transform: scale(1.2);
}

.tutorial-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.tutorial-buttons {
    display: flex;
    gap: 0.75rem;
}

.tutorial-skip-btn {
    background: transparent !important;
    color: var(--grey-text) !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
}

.tutorial-skip-btn:hover {
    color: var(--dark-text) !important;
    background: var(--light-grey) !important;
}

.tutorial-next-btn {
    padding: 0.6rem 1.5rem !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}

.tutorial-fade-out {
    animation: tutorialFadeOut 0.3s ease forwards;
}

@keyframes tutorialFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Mobile responsive tutorial */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: calc(100vw - 30px);
        min-width: 280px;
        padding: 1.25rem;
        left: 15px !important;
        right: 15px;
        width: auto;
    }

    .tutorial-title {
        font-size: 1.1rem;
    }

    .tutorial-desc {
        font-size: 0.9rem;
    }

    .tutorial-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .tutorial-progress {
        order: -1;
    }

    .tutorial-buttons {
        width: 100%;
        justify-content: space-between;
    }
}

/* ============================================
/* ============================================
   FAB REMINDER BUBBLE
   ============================================ */
.assistant-reminder {
    position: fixed;
    bottom: 100px;
    right: 25px;
    background: white;
    padding: 12px 20px;
    border-radius: 20px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1090;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: auto;
    max-width: 350px;
}

.assistant-reminder.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.reminder-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark-text);
    white-space: nowrap;
}

.reminder-caret {
    position: absolute;
    bottom: -6px;
    right: 12px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    z-index: -1;
}

[data-theme="dark"] .assistant-reminder {
    background: #2D2D2D;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .reminder-caret {
    background: #2D2D2D;
    border-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .assistant-reminder {
        bottom: 90px;
        right: 20px;
    }
}