:root {
    --primary: #003366;  
    --primary-dark: #002244;
    --accent: #d4af37;    
    --text-dark: #333333;
    --text-light: #666666;
    --bg-light: #f4f7f6;
    --white: #ffffff;
    --font-heading: 'Merriweather', serif; 
    --font-body: 'Montserrat', sans-serif;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

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

body {
    font-family: var(--font-body);
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
}

a { text-decoration: none; transition: 0.3s; }
ul { list-style: none; }
.container-width { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.text-center { text-align: center; }


.hidden { display: none !important; }


.top-bar {
    background-color: var(--primary-dark);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.top-bar .container-width { display: flex; justify-content: space-between; align-items: center; }
.social-icons a { color: white; margin-left: 10px; }

header {
    background: var(--white);
    padding: 15px 0;
    position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}
.header-flex { display: flex; justify-content: space-between; align-items: center; }
.logo-area { display: flex; align-items: center; gap: 15px; }
.logo-icon {
       width: 45px; height: 45px; /*background: var(--primary); color: var(--accent);
    display: flex; align-items: center; justify-content: center; */
    font-size: 24px; font-weight: bold; font-family: var(--font-heading); border-radius: 4px; 
    background-image: url("logo.png");
    background-size: cover;
    background-position: center;
}

#text {
    font-size: 10px;
    letter-spacing: 1.5px;
    margin-top: -4px;
    font-weight: 800;
}

.logo-text h1 { font-family: var(--font-heading); font-size: 22px; color: var(--primary); line-height: 1; margin: 0; }
.logo-text p { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 2px; margin: 0; }

nav a { color: var(--text-dark); font-weight: 600; font-size: 14px; margin-left: 25px; }
nav a:hover { color: var(--primary); }
.btn-portal { background: var(--primary); color: white !important; padding: 10px 20px !important; border-radius: 4px; }
.btn-portal:hover { background: var(--primary-dark); }

.news-ticker-wrap { background: var(--primary); color: white; display: flex; height: 40px; overflow: hidden; }
.news-title { background: var(--accent); color: var(--primary); padding: 0 20px; font-weight: 700; font-size: 12px; display: flex; align-items: center; z-index: 10; }
.news-content { flex-grow: 1; display: flex; align-items: center; position: relative; overflow: hidden; }
.news-content span { white-space: nowrap; position: absolute; animation: marquee 20s linear infinite; font-size: 14px; }
@keyframes marquee { 0% { left: 100%; } 100% { left: -100%; } }

/* --- HERO SECTION FIXED --- */


/* =========================================
   PERFORMANCE HERO SECTION (LCP FIX)
   ========================================= */

.hero-section {
    position: relative;
    height: 90vh;          /* Height relative to viewport */
    min-height: 600px;     /* Minimum height to prevent collapse */
    display: flex;
    align-items: center;
    text-align: center;
    color: white;
    overflow: hidden;      /* Critical: Keeps the image inside the box */
    
    /* REMOVED: background: url(...) - We use the HTML tag now! */
}

/* The Real HTML Image acting as a Background */
.hero-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;     /* This makes it stretch perfectly like 'background-size: cover' */
    z-index: 0;            /* Sends it to the back */
}

/* The Dark Overlay */
.hero-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.4));
    z-index: 1;            /* Sits on top of the image */
}

/* The Text Content */
.hero-content {
    position: relative;
    z-index: 2;            /* Sits on top of the overlay */
    width: 100%;
}
.hero-content h1 { font-family: var(--font-heading); font-size: 3.5rem; margin-bottom: 20px; }
.btn-primary { background: var(--accent); color: var(--primary-dark); padding: 15px 35px; border-radius: 4px; font-weight: 700; display: inline-block; }
.btn-secondary { background: transparent; color: white; border: 2px solid white; padding: 13px 35px; border-radius: 4px; font-weight: 600; margin-left: 15px; display: inline-block; }

.features-section { padding: 80px 0; background: white; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 40px; }
.feature-card { padding: 40px 30px; background: var(--bg-light); border-radius: 8px; text-align: center; transition: 0.3s; }
.feature-card:hover { transform: translateY(-5px); background: white; box-shadow: var(--shadow); border-bottom: 3px solid var(--accent); }
.feature-icon { font-size: 40px; color: var(--primary); margin-bottom: 20px; }

.stats-section { background: var(--primary); padding: 60px 0; color: white; }
.stats-grid { display: flex; justify-content: space-around; text-align: center; }
.stat-box h3 { font-size: 3rem; font-weight: 700; color: var(--accent); margin-bottom: 5px; }

footer { background: #1a1a1a; color: #ccc; padding-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-bottom { background: #111; padding: 20px 0; text-align: center; font-size: 13px; border-top: 1px solid #333; }

.auth-section {
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100vh;
    background: url('https://images.unsplash.com/photo-1541339907198-e08756dedf3f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80') no-repeat center center/cover;
    display: flex; align-items: center; justify-content: center;
    z-index: 2000; 
}
.auth-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(rgba(0,51,102,0.9), rgba(0,51,102,0.8)); }
.auth-container { position: relative; z-index: 2; width: 100%; max-width: 420px; padding: 20px; }
.auth-card { background: white; padding: 40px 30px; border-radius: 8px; box-shadow: 0 15px 35px rgba(0,0,0,0.2); border-top: 5px solid var(--accent); }
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-header h2 { color: var(--primary); font-family: var(--font-heading); font-size: 1.8rem; }

.input-group { position: relative; margin-bottom: 20px; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--primary); }
.input-group input { width: 100%; padding: 12px 15px 12px 45px; border: 1px solid #ddd; border-radius: 5px; font-family: var(--font-body); font-size: 14px; }
.btn-full { width: 100%; background: var(--primary); color: white; padding: 12px; border: none; border-radius: 5px; font-weight: 600; cursor: pointer; transition: 0.3s; }
.btn-full:hover { background: var(--primary-dark); }

.admin-container { max-width: 1200px; margin: 40px auto; padding: 0 20px; }
.admin-card { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); margin-bottom: 30px; border-top: 4px solid var(--primary); }

.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.search-group { display: flex; gap: 10px; align-items: center; }
.search-group select { padding: 10px; border: 1px solid #ddd; border-radius: 4px; background: #fff; cursor: pointer; }
.search-group input { padding: 10px 15px; border: 1px solid #ddd; border-radius: 4px; width: 250px; }

.student-row { display: flex; justify-content: space-between; align-items: center; background: white; padding: 15px 20px; border-bottom: 1px solid #eee; transition: 0.2s; }
.student-row:hover { background-color: #f9fbff; }
.student-info { display: flex; align-items: center; gap: 15px; }
.student-avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.student-details h4 { margin: 0; color: var(--primary); font-size: 1rem; }
.student-details span { font-size: 0.85rem; color: #666; }

.btn-icon { border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; margin-left: 5px; }
.btn-edit { background: #e3f2fd; color: #1976d2; }
.btn-delete { background: #ffebee; color: #c62828; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); z-index: 3000;
    display: flex; justify-content: center; align-items: center; backdrop-filter: blur(3px);
}
.modal-content {
    background: white; padding: 30px; width: 90%; max-width: 700px;
    border-radius: 10px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3); animation: slideUp 0.3s ease-out;
}
.modal-header { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 20px; }
.modal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.modal-full-width { grid-column: span 2; }
.modal-label { font-size: 12px; font-weight: 700; color: #555; display: block; margin-bottom: 5px; }
.modal-input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }

@keyframes slideUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    .header-flex, .feature-grid, .stats-grid, .footer-grid, .modal-form-grid { grid-template-columns: 1fr; flex-direction: column; }
    .search-group { flex-direction: column; width: 100%; }
    .search-group input, .search-group select { width: 100%; }
}

.swal2-container {
    z-index: 10000 !important;
}

.loader-container {
    z-index: 10001 !important;
}


.mobile-menu-icon {
    display: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary);
}

/* 2. On Mobile/Tablet (Screens smaller than 768px), SHOW the icon */
@media (max-width: 768px) {
    .mobile-menu-icon {
        display: block;
    }
    
    /* Also hide the regular nav links on mobile until menu is clicked */
    header nav {
        display: none; 
        flex-direction: column;
        width: 100%;
        background: white;
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        padding: 20px 0;
        text-align: center;
    }

    /* This class is added by JavaScript when you click the icon */
    header nav.active {
        display: flex;
    }
    
    header nav a {
        margin: 10px 0;
        margin-left: 0;
    }
    
    .header-flex {
        padding: 0 15px; /* Prevent logo from touching edge on mobile */
    }
}

/* =========================================
   TEACHER DASHBOARD STYLES
   ========================================= */

/* 1. Dashboard Header & Profile Badge */
.dash-header {
    background: white;
    padding: 15px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.dash-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.teacher-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 30px;
    border: 1px solid #e0e0e0;
}

.teacher-badge img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.teacher-badge div {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

/* 2. Navigation Tabs (Switch Container) */
.switch-container {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid transparent; /* No border by default */
    background: #f4f7f6;
    color: #666;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #e2e6ea;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 51, 102, 0.3);
}

/* 3. Attendance Toggle Buttons */
.att-btn {
    padding: 8px 0;
    width: 100px; /* Fixed width for consistency */
    border-radius: 20px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.att-present {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.att-present:hover {
    background-color: #c3e6cb;
}

.att-absent {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.att-absent:hover {
    background-color: #f5c6cb;
}

/* 4. Action Buttons (Save, Load, etc.) */
.btn-full {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-full:hover {
    background: var(--primary-dark, #002244);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 5. Input Groups in Dashboard */
.search-group {
    display: flex;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.search-group select, 
.search-group input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex-grow: 1;
}

/* Mobile Responsiveness for Dashboard */

@media (max-width: 768px) {
    
    .header-flex {
        display: flex !important;
        flex-direction: row !important; /* Keep logo and menu on the same row */
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
        height: 70px; /* Fixed height for mobile header */
    }

    .logo-area {
        gap: 10px;
    }

    .logo-icon {
        width: 35px;
        height: 35px;
    }

    .logo-text h1 {
        font-size: 16px; /* Smaller text for mobile screens */
    }

    .logo-text p {
        font-size: 8px;
        letter-spacing: 1px;
    }

    /* 2. Menu Navigation Dropdown */
    header nav {
        display: none; 
        flex-direction: column;
        width: 100%;
        background: var(--white);
        position: absolute;
        top: 70px; /* Positioned right below header */
        left: 0;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        padding: 15px 0;
        text-align: center;
        z-index: 999;
    }

    header nav.active {
        display: flex; 
    }

    nav a {
        margin: 12px 0;
        margin-left: 0;
        display: block;
        font-size: 16px;
    }

    .mobile-menu-icon {
        display: block !important; 
        font-size: 22px;
        color: var(--primary);
        padding: 5px;
    }

    /* 3. Hero Section Fix - Prevent text overlap */
    .hero-section {
        height: 500px; 
        padding: 0 20px;
    }

    .hero-content h1 {
        font-size: 2.2rem; 
        line-height: 1.2;
    }

    .hero-content p {
        font-size: 14px;
        margin-bottom: 25px;
    }

    .btn-secondary {
        margin-left: 0; 
        margin-top: 15px;
        display: block; 
        width: 100%;
    }

    .btn-primary {
        display: block;
        width: 100%;
    }

    /* Grid Adjustments */
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-grid {
        flex-direction: column;
        gap: 30px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .modal-form-grid {
        grid-template-columns: 1fr; 
        gap: 15px;
    }

    .modal-full-width {
        grid-column: span 1;
    }

    /* 5. Dashboard Adjustments */
    .switch-container {
        flex-direction: column;
        gap: 10px;
    }

    .search-group {
        flex-direction: column;
        width: 100%;
    }

    .search-group input, .search-group select {
        width: 100% !important;
    }

    .student-row {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .att-btn {
        width: 100%;
    }
}

/* =========================================
   GALLERY STYLES (Fix for Broken Layout)
   ========================================= */

.gallery-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 25px; 
    margin-top: 30px; 
}

.gallery-card { 
    position: relative; 
    height: 250px; 
    border-radius: 12px; 
    overflow: hidden; 
    cursor: pointer; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
    background-color: #eee; 
}

.gallery-card img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.5s ease; 
}

.gallery-card:hover img { 
    transform: scale(1.1); 
}

.gallery-overlay { 
    position: absolute; 
    bottom: 0; left: 0; right: 0; 
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); 
    padding: 20px; 
    color: white; 
    transform: translateY(100px); 
    transition: transform 0.3s ease; 
}

.gallery-card:hover .gallery-overlay { 
    transform: translateY(0); 
}

.gallery-overlay h3 { 
    margin: 0; 
    font-size: 1.1rem; 
    font-family: var(--font-heading); 
}

/* Subtitle Style */
.subtitle { 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: var(--accent); 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    display: block; 
    margin-bottom: 10px; 
}

/* =========================================
   GALLERY STYLES (Fix for Broken Layout)
   ========================================= */

.gallery-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 25px; 
    margin-top: 30px; 
}

.gallery-card { 
    position: relative; 
    height: 250px; 
    border-radius: 12px; 
    overflow: hidden; 
    cursor: pointer; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
    background-color: #eee; 
}

.gallery-card img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.5s ease; 
}

.gallery-card:hover img { 
    transform: scale(1.1); 
}

.gallery-overlay { 
    position: absolute; 
    bottom: 0; left: 0; right: 0; 
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); 
    padding: 20px; 
    color: white; 
    transform: translateY(100px); 
    transition: transform 0.3s ease; 
}

.gallery-card:hover .gallery-overlay { 
    transform: translateY(0); 
}

.gallery-overlay h3 { 
    margin: 0; 
    font-size: 1.1rem; 
    font-family: var(--font-heading); 
}

/* Subtitle Style */
.subtitle { 
    font-size: 1.1rem; 
    font-weight: 600; 
    color: var(--accent); 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    display: block; 
    margin-bottom: 10px; 
}

/* ========================
   FINAL FOOTER FIXES
   ======================== */

/* 1. Force Links to be White (Overrides browser blue) */
.footer-col a {
    color: #ffffff !important;
    text-decoration: none;
    transition: 0.3s;
    display: block; 
    margin-bottom: 8px;
}

/* 2. Gold Hover Effect */
.footer-col a:hover {
    color: #d4af37 !important; 
    padding-left: 5px; 
}

/* 3. List Cleanup */
.footer-col ul {
    list-style: none;
    padding: 0;
}

/* 4. Three-Column Grid Layout */
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.2fr; /* Optimized widths */
    gap: 40px;
    padding-bottom: 40px;
}

/* Mobile Layout */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
}