/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Montserrat:wght@700;800;900&display=swap');

/* Global Styles */
:root {
    --primary-color: #3AB795;
    --secondary-color: #2E7D32; 
    --accent-color: #86BAA1;
    --background-color: #6D4C41;
    --card-bg: #FFF0DB; 
    
    /* Text Colors */
    --text-color: #2c1b18; /* Dark Brown */
    --text-light: #ffe5b4; /* Gold */
    --text-white: #ffffff;
    
    --border-color: #8d6e63;
    --success-color: #3AB795;
    --error-color: #d32f2f;
    --highlight-color: #FFCF56;
    --gradient-1: linear-gradient(135deg, #3AB795, #2E7D32);
    --box-shadow: 0 8px 32px rgba(58, 183, 149, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    background: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    background-image: linear-gradient(135deg, rgba(255, 229, 180, 0.97), rgba(255, 240, 219, 0.97));
    font-weight: 500;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 0;
    position: relative;
    background: linear-gradient(rgba(54, 44, 40, 0.9), rgba(54, 44, 40, 0.9)), url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 1px solid rgba(255, 213, 79, 0.2);
}

header h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 3.5rem;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    background: linear-gradient(45deg, #FFFFFF, #FFD54F);
    -webkit-background-clip: text;
    background-clip: text;         /* Standard property */
    -webkit-text-fill-color: transparent;
}

header p {
    color: #FFD54F;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    position: relative;
    z-index: 1;
}

/* --- Form Styles --- */
.form-container {
    background: #fff;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease;
}
.form-container:hover { transform: translateY(-5px); }

.form-container h2 {
    color: #3E2723;
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 700;
}

input, select, textarea, .nice-input, .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #D7CCC8;
    border-radius: 12px;
    font-size: 1rem;
    color: #3E2723 !important;
    background-color: #FAFAFA !important;
    font-weight: 600;
    margin-bottom: 1.2rem;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3E2723;
    background-color: #fff !important;
    box-shadow: 0 0 0 4px rgba(62, 39, 35, 0.1);
}

.btn-primary {
    background: #3E2723;
    color: #FFD54F;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(62, 39, 35, 0.3);
}

.btn-primary:hover {
    background: #5D4037;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(62, 39, 35, 0.4);
}

.btn-secondary {
    background: #757575;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

/* --- THEME-MATCHED LOGIN LINKS --- */
.form-links {
    margin-top: 1.5rem;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.form-links a {
    color: #3E2723;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    border-bottom: 2px solid #FFCF56;
    padding-bottom: 2px;
    transition: all 0.3s ease;
}

.form-links a:hover {
    color: #FFFFFF;
    background-color: #3E2723;
    border-color: #3E2723;
    padding: 4px 8px;
    border-radius: 4px;
}

/* --- Dashboard Navigation --- */
.dashboard-nav {
    background: #3E2723;
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid #5D4037;
}

.nav-row {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.nav-tab {
    background: rgba(255,255,255,0.05);
    color: #FFD54F;
    border: 1px solid rgba(255,213,79,0.3);
    padding: 0.8rem 1.8rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
}

.nav-tab:hover, .nav-tab.active {
    background: #FFD54F;
    color: #3E2723;
    box-shadow: 0 0 15px rgba(255, 213, 79, 0.4);
    border-color: #FFD54F;
    transform: translateY(-2px);
}

.nav-btn {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    color: white;
    border: 2px solid #ffcdd2;
    padding: 0.6rem 1.5rem;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn-download, .btn-help {
    color: white; padding: 0.6rem 1.2rem; border-radius: 20px; border: none; font-weight: 600; cursor: pointer; transition: transform 0.2s;
}
.btn-download { background: linear-gradient(135deg, #673AB7, #512DA8); box-shadow: 0 4px 10px rgba(103, 58, 183, 0.3); }
.btn-help { background: linear-gradient(135deg, #2E7D32, #1B5E20); box-shadow: 0 4px 10px rgba(46, 125, 50, 0.3); }

/* --- SECTIONS --- */
.syllabus-card {
    background: #3E2723 !important;
    border-radius: 15px !important;
    padding: 1.5rem !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    border: 2px solid #FFD54F !important;
    color: #FFF !important;
    margin-bottom: 2rem;
}
.syllabus-title { color: #FFD54F !important; font-size: 1.5rem; font-weight: 700; }
.overall-progress { color: #fff; font-size: 1.2rem; font-weight: 700; }

.chapter-item {
    background: #5D4037 !important;
    padding: 1rem !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    margin-bottom: 12px !important;
    color: #fff !important;
}
.chapter-name { font-weight: 600; font-size: 1.05rem; color: #fff !important; }
.status-select { background: #fff; color: #000; font-weight: 600; border: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; }

/* Grid Layouts */
.attendance-section, .settings-container, .subjects-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem;
}

/* --- FIX FOR ASSIGNMENT ALIGNMENT --- */
.assignments-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Keeps mobile responsive */
    gap: 15px;
    margin-bottom: 2rem;
}

/* Force the Add Assignment button to fit content, not 100% width */
.assignments-controls .btn-primary {
    width: auto !important; 
    margin: 0;
    min-width: 180px;
}

.assignment-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.assignment-filters select { margin-bottom: 0; }

/* --- FIX FOR ATTENDANCE BORDERS (Cool Look) --- */
.subject-attendance-item {
    background: #fff;
    border: 2px solid #D7CCC8; /* Visible Border in Light Mode */
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #3E2723;
    font-weight: 600;
}
.subject-attendance-item:hover {
    border-color: #3E2723;
    background: #FFF8E1;
    transform: translateX(5px);
}
.subject-attendance-item.active {
    background: #3E2723;
    color: #FFD54F;
    border-color: #FFD54F;
    box-shadow: 0 4px 15px rgba(62, 39, 35, 0.3);
}

/* Generic Cards */
.settings-card, .assignment-card, .exam-item {
    background: #fff; 
    padding: 1.5rem; 
    border-radius: 15px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    border: 1px solid #E0E0E0; 
    color: var(--text-color);
    transition: transform 0.3s;
}
.settings-card:hover, .assignment-card:hover, .exam-item:hover {
    transform: translateY(-5px);
    border-color: #D7CCC8;
}

/* Calendar */
.calendar-container { background: #3E2723; padding: 2rem; border-radius: 15px; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 1rem; }
.calendar-day-header { text-align: center; font-weight: 700; color: #FFD54F; padding: 5px; }
.calendar-day { background: #fff; color: #000; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-weight: 700; cursor: pointer; transition: transform 0.2s; }
.calendar-day:hover { transform: scale(1.1); }
.calendar-day.present { background: #3AB795; color: white; }
.calendar-day.absent { background: #FF6B6B; color: white; }
.calendar-day.today { border: 3px solid #FFCF56; }

/* Timetable */
.timetable th { background: #3E2723; color: #FFD54F; padding: 15px; font-weight: 700; border-radius: 4px; }
.timetable-cell { background: #FFF8E1; border: 1px solid #D7CCC8; padding: 10px; text-align: center; color: #000; border-radius: 8px; }
.session-time { color: #D84315; font-weight: 800; }
.session-subject { color: #000; font-weight: 700; }

/* Modal - Fixed for Safari/iOS Blur */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.6); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 2000; 
    -webkit-backdrop-filter: blur(5px); /* Added for Safari Support */
    backdrop-filter: blur(5px); 
}

.modal-content { 
    background: #fff; 
    padding: 2rem; 
    border-radius: 15px; 
    width: 90%; 
    max-width: 500px; 
    color: #333; 
    box-shadow: 0 15px 40px rgba(0,0,0,0.3); 
}
/* CHATBOT STYLES */
#chatbot-btn {
    position: fixed; bottom: 30px; right: 30px;
    background: linear-gradient(135deg, #3E2723, #5D4037); color: #FFD54F;
    width: 65px; height: 65px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 28px; cursor: pointer;
    box-shadow: 0 4px 15px rgba(62, 39, 35, 0.4);
    z-index: 9998; transition: all 0.3s ease; border: 2px solid #FFD54F;
}
#chatbot-btn:hover { transform: scale(1.1) rotate(10deg); box-shadow: 0 6px 20px rgba(62, 39, 35, 0.6); }

#chatbot-window {
    display: none; position: fixed; bottom: 110px; right: 30px;
    width: 380px; height: 550px; background: #FFF8E1;
    border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 9999; flex-direction: column; overflow: hidden;
    border: 2px solid #3E2723; font-family: 'Poppins', sans-serif;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.chat-header {
    background: #3E2723; color: #FFD54F; padding: 18px;
    display: flex; justify-content: space-between; align-items: center;
}
.chat-header button { background: none; border: none; color: #FFF; font-size: 20px; cursor: pointer; transition: color 0.2s; }
.chat-body {
    flex: 1; padding: 20px; overflow-y: auto; display: flex;
    flex-direction: column; gap: 15px; background-color: #FFF8E1; scroll-behavior: smooth;
}
.bot-msg {
    background: #FFFFFF; color: #3E2723; padding: 12px 16px;
    border-radius: 15px 15px 15px 0; max-width: 85%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); border-left: 4px solid #FFD54F; align-self: flex-start;
}
.user-msg {
    background: #3E2723; color: #FFD54F; padding: 12px 16px;
    border-radius: 15px 15px 0 15px; max-width: 85%; align-self: flex-end;
}
.chat-chips-container {
    padding: 10px 15px; display: flex; gap: 8px; overflow-x: auto;
    background: rgba(255, 255, 255, 0.5); border-top: 1px solid #e0e0e0;
}
.chat-chip {
    background: transparent; border: 1px solid #3E2723; color: #3E2723;
    padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.chat-chip:hover { background: #3E2723; color: #FFD54F; }
.chat-input-area {
    padding: 15px; background: #FFF; border-top: 1px solid #eee; display: flex; gap: 10px; align-items: center;
}
.chat-input-area input { margin-bottom: 0; }
.chat-input-area button {
    background: #3E2723; color: #FFD54F; border: none; width: 45px; height: 45px;
    border-radius: 50%; cursor: pointer; transition: transform 0.2s; display: flex; justify-content: center; align-items: center;
}

/* DARK MODE */
body.dark-mode {
    --background-color: #1a1a1a; 
    background-image: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    --text-color: #ffe5b4; 
    --card-bg: #3E2723;
    --border-color: #5D4037;
    --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
body.dark-mode .form-container,
body.dark-mode .settings-card, 
body.dark-mode .assignment-card, 
body.dark-mode .exam-item,
body.dark-mode .modal-content,
body.dark-mode .subjects-list,
body.dark-mode .dashboard-nav,
body.dark-mode .calendar-container {
    background-color: #3E2723; color: #ffe5b4; border: 1px solid #5D4037;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* Dark Mode: Attendance List Fix */
body.dark-mode .subject-attendance-item {
    background: #4E342E;
    border-color: #5D4037;
    color: #FFF;
}
body.dark-mode .subject-attendance-item:hover { border-color: #FFD54F; }
body.dark-mode .subject-attendance-item.active { background: #FFD54F; color: #3E2723; }
body.dark-mode h2, body.dark-mode h3, body.dark-mode .settings-card h3 { color: #FFD54F !important; }

/* Dark Mode Calendar/Timetable */
body.dark-mode .calendar-day { background-color: #5D4037; color: #fff; border-color: #3E2723; }
body.dark-mode .timetable-cell { background-color: #4E342E !important; border-color: #5D4037; color: #fff; }
body.dark-mode .session-subject { color: #FFD54F; }

/* Theme Button */
.btn-theme {
    background: linear-gradient(135deg, #333, #000); color: #FFD54F; border: 2px solid #FFD54F; padding: 0.6rem 1.2rem; border-radius: 20px; font-weight: 600; cursor: pointer; box-shadow: 0 0 10px rgba(255, 213, 79, 0.2); transition: all 0.3s; display: flex; align-items: center; gap: 8px;
}

/* --- NEW FEATURES STYLING --- */

/* 1. FOCUS ZONE (Pomodoro) */
.timer-container {
    text-align: center; padding: 3rem; background: #fff; border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: 2px solid #D7CCC8;
}
.timer-display {
    font-size: 5rem; font-weight: 800; color: #3E2723; margin: 2rem 0;
    font-family: 'Montserrat', sans-serif; text-shadow: 2px 2px 0px #FFD54F;
}
.timer-controls { display: flex; gap: 1rem; justify-content: center; }
.timer-btn {
    padding: 1rem 2rem; font-size: 1.2rem; border-radius: 50px; border: none;
    cursor: pointer; font-weight: 700; transition: transform 0.2s;
}
.btn-start { background: #3AB795; color: white; box-shadow: 0 4px 15px rgba(58, 183, 149, 0.4); }
.btn-reset { background: #FF6B6B; color: white; box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4); }
.btn-start:hover, .btn-reset:hover { transform: scale(1.05); }

/* 2. CGPA CALCULATOR */
.calc-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem;
    background: #FFF8E1; padding: 1.5rem; border-radius: 15px; margin-bottom: 1.5rem;
    border: 1px solid #FFD54F;
}
.calc-result {
    text-align: center; font-size: 1.5rem; font-weight: 800; color: #3E2723;
    padding: 1rem; background: #fff; border-radius: 12px; border: 2px solid #3E2723; margin-top: 1rem;
}

/* 3. PLACEMENT TRACKER */
.placement-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.placement-card { background: #fff; padding: 1.5rem; border-radius: 15px; border: 1px solid #D7CCC8; }
.task-item {
    display: flex; align-items: center; gap: 10px; padding: 10px;
    border-bottom: 1px solid #eee; transition: background 0.2s;
}
.task-item:hover { background: #FAFAFA; }
.task-checkbox { width: 20px; height: 20px; accent-color: #3E2723; }
.task-text { flex: 1; font-weight: 600; color: #5D4037; }
.task-text.completed { text-decoration: line-through; color: #9E9E9E; }
.company-badge {
    background: #3E2723; color: #FFD54F; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem;
}

/* Dark Mode Adjustments for New Features */
body.dark-mode .timer-container,
body.dark-mode .calc-result,
body.dark-mode .placement-card {
    background: #3E2723; border-color: #5D4037; color: #FFD54F;
}
body.dark-mode .timer-display { color: #FFD54F; text-shadow: 2px 2px 0px #3E2723; }
body.dark-mode .calc-grid { background: #4E342E; border-color: #5D4037; }
body.dark-mode .task-item:hover { background: #4E342E; }
body.dark-mode .task-text { color: #ffe5b4; }

/* --- FIX: Registration Button Spacing --- */
#addSubject {
    margin-bottom: 1.5rem !important; /* Pushes the REGISTER button down */
}

#regBtn {
    margin-bottom: 1rem !important;   /* Pushes the Back to Login button down */
    margin-top: 0.5rem !important;    /* Adds a little extra space above if needed */
}

/* Optional: Make the Back button distinct */
#backToLoginFromReg {
    margin-top: 0; 
}

/* =========================================
   MOBILE RESPONSIVENESS (WEBAPP MODE)
   ========================================= */

@media (max-width: 768px) {
    
    /* 1. Container & Layout */
    .container {
        padding: 1rem;
        width: 100%;
    }

    /* 2. Header Adjustments */
    header {
        padding: 2rem 1rem;
        margin-bottom: 1.5rem;
        border-radius: 0 0 20px 20px; /* Rounded only at bottom */
    }
    header h1 { font-size: 2.2rem; }
    header p { font-size: 1rem; }

    /* 3. Navigation (Scrollable Horizontal Bar) */
    .dashboard-nav {
        padding: 1rem;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 100;
        border-radius: 0 0 15px 15px;
    }
    
    .nav-row {
        justify-content: flex-start; /* Align left */
        flex-wrap: nowrap; /* Don't wrap lines */
        overflow-x: auto; /* Allow horizontal scrolling */
        padding-bottom: 5px;
        width: 100%;
    }
    
    /* Hide scrollbar but keep functionality */
    .nav-row::-webkit-scrollbar { display: none; }

    .nav-tab {
        flex: 0 0 auto; /* Don't shrink buttons */
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    /* 4. Grid Stacking (Single Column) */
    .attendance-section, 
    .settings-container, 
    .subjects-grid, 
    .calc-grid,
    .placement-container {
        grid-template-columns: 1fr !important; /* Force single column */
    }

    /* 5. Calendar & Cards */
    .calendar-days {
        gap: 4px;
    }
    .calendar-day {
        font-size: 0.8rem;
        height: 35px;
    }
    
    .section-title { font-size: 1.5rem; }

    /* 6. Form & Inputs (Prevent Zoom) */
    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* 7. Chatbot Positioning */
    #chatbot-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        z-index: 10000;
    }
    
    #chatbot-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        font-size: 24px;
    }

    /* 8. Modal Full Screen */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

/* =========================================
   DARK MODE TEXT VISIBILITY FIXES
   ========================================= */

/* 1. Fix Dashboard Titles */
body.dark-mode .section-title {
    color: #FFD54F !important; /* Forces "Syllabus Progress", "Attendance" etc. to Gold */
}

/* 2. Fix Legal Pages (Privacy, Terms, Rules) */
body.dark-mode .legal-content h2,
body.dark-mode .legal-content h3 {
    color: #FFD54F !important; /* Headers become Gold */
}

body.dark-mode .legal-content p,
body.dark-mode .legal-content li,
body.dark-mode .legal-content strong {
    color: #ffe5b4 !important; /* Paragraphs become Light Cream */
}

/* 3. General Safety Net (Catches any other hidden black text) */
body.dark-mode .settings-card,
body.dark-mode .assignment-card {
    color: #ffe5b4;
}

/* =========================================
   DARK MODE FIX: LOGIN & REGISTER FORMS
   ========================================= */

/* 1. Fix Form Labels (Email, Password, etc.) */
body.dark-mode .form-group label {
    color: #FFD54F !important; /* Forces labels to Gold */
}

/* 2. Fix Links (Forgot Password, Register) */
body.dark-mode .form-links a {
    color: #ffe5b4 !important; /* Light Cream text */
    border-bottom-color: #FFD54F !important; /* Gold underline */
}

body.dark-mode .form-links a:hover {
    background-color: #ffe5b4 !important;
    color: #3E2723 !important; /* Dark text on hover */
}

/* 3. Fix Input Text & Placeholders */
body.dark-mode input, 
body.dark-mode select {
    color: #ffffff !important; /* White text inside boxes */
    background-color: #4E342E !important; /* Darker brown background */
    border-color: #8D6E63 !important;
}

body.dark-mode input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important; /* Semi-transparent white for placeholders */
}

/* 4. Fix Section Headers inside Forms */
body.dark-mode .form-section h3 {
    color: #FFD54F !important;
    border-bottom: 1px solid #5D4037;
}

/* =========================================
   DARK MODE FIX: ENHANCED LOGIN BUTTON
   ========================================= */

/* 1. Premium Gradient & Shadow for the Main Button */
body.dark-mode .btn-primary {
    background: linear-gradient(180deg, #FFD54F 0%, #FFC107 100%) !important; /* Rich gold gradient */
    color: #3E2723 !important; /* Dark text for contrast */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important; /* Soft shadow for depth */
    border: none !important;
    font-weight: 800 !important; /* Make the text bolder */
    letter-spacing: 1px !important;
    transition: all 0.3s ease !important; /* Smooth transition for hover effect */
}

/* 2. Interactive Hover Effect */
body.dark-mode .btn-primary:hover {
    background: linear-gradient(180deg, #ffe082 0%, #FFD54F 100%) !important; /* Lighter gradient on hover */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4) !important; /* Larger shadow to make it "pop" */
    transform: translateY(-3px) !important; /* Slight lift effect */
}

/* 3. Active/Click Effect */
body.dark-mode .btn-primary:active {
    transform: translateY(-1px) !important; /* Slight press-down effect */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3) !important;
}

/* =========================================
   MODERN PASSWORD TOGGLE (EYE ICON)
   ========================================= */

/* 1. Wrapper to hold input + icon */
.password-wrapper {
    position: relative;
    width: 100%;
}

/* 2. Adjust Input to make room for the eye */
.password-wrapper input {
    padding-right: 45px !important; /* Space for the icon so text doesn't overlap */
    margin-bottom: 1.2rem; /* Keep original spacing */
}

/* 3. The Eye Icon Styling */
.toggle-icon {
    position: absolute;
    right: 15px;
    top: 35%; /* LIFTED UP: Changed from 50% to 35% to compensate for the margin */
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.1rem;
    color: #3E2723;
    transition: color 0.3s ease;
    z-index: 2;
}

.toggle-icon:hover {
    color: #d32f2f; /* Highlight color on hover */
}

/* 4. Dark Mode Support for Eye Icon */
body.dark-mode .toggle-icon {
    color: #FFD54F; /* Gold for Dark Mode */
}

body.dark-mode .toggle-icon:hover {
    color: #fff;
}

/* =========================================
   STICKY FOOTER FIX
   ========================================= */

/* 1. Make the body take up at least 100% of the screen height */
body {
    display: flex;
    flex-direction: column;
}

/* 2. Force the MAIN content to grow and fill empty space */
main {
    flex: 1; /* This is the magic line that pushes the footer down */
    width: 100%; /* Ensures full width on mobile */
}

/* 3. Ensure Footer stays at the bottom */
footer {
    margin-top: auto; /* Safety net to keep it at the bottom */
    width: 100%;
}

/* =========================================
   DARK MODE FIX: ATTENDANCE VISIBILITY
   ========================================= */

/* 1. Fix "PRESENT" (Green) in Dark Mode */
body.dark-mode .calendar-day.present {
    background-color: #00E676 !important; /* Bright Neon Green */
    color: #000000 !important; /* Black text so numbers are readable */
    font-weight: bold !important;
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.4); /* Glow effect */
}

/* 2. Fix "ABSENT" (Red) in Dark Mode */
body.dark-mode .calendar-day.absent {
    background-color: #FF5252 !important; /* Bright Neon Red */
    color: #000000 !important; /* Black text */
    font-weight: bold !important;
    box-shadow: 0 0 8px rgba(255, 82, 82, 0.4); /* Glow effect */
}

/* 3. Fix "TODAY" Border in Dark Mode */
body.dark-mode .calendar-day.today {
    border: 2px solid #FFD54F !important; /* Gold Border for today */
}

/* =========================================
   CLEAN CODE FIXES (Moved from HTML)
   ========================================= */

/* 1. Footer Styling */
.main-footer {
    margin-top: 3rem;
    background: #3E2723;
    color: #FFD54F;
    padding: 20px 0;
}

.footer-content {
    text-align: center;
}

.copyright {
    margin-bottom: 10px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #FFD54F; /* Nice gold hover effect */
}

.footer-badge {
    margin-top: 15px;
    font-size: 0.8rem;
    opacity: 0.8;
    border-top: 1px solid rgba(255, 213, 79, 0.3);
    padding-top: 10px;
}

/* 2. Loading Overlay Styling */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    /* Added glassmorphism for better look */
    -webkit-backdrop-filter: blur(5px);   
    backdrop-filter: blur(5px);
    
}

/* Helper class to show/hide via JS */
.loader-hidden {
    display: none !important; /* JS toggles this to 'flex' */
}

.loader-content {
    font-size: 2rem;
    color: #3E2723;
    font-weight: bold;
}

/* Dark Mode Support for Loader */
body.dark-mode #loading-overlay {
    background: rgba(0, 0, 0, 0.8);
}
body.dark-mode .loader-content {
    color: #FFD54F;
}