/* ---- Google Font Import ---- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables for Blue Theme ---- */
:root {
    --primary-blue: #007BFF;
    --primary-blue-dark: #0056b3;
    --secondary-blue: #e7f3ff;
    --dark-navy: #0d244f;
    --text-dark: #1a202c;
    --text-light: #4a5568;
    --background-light: #f7fafc;
    --white: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.1);
    --table-header-bg: #f1f8ff;
    --table-border: #d1e7dd;
}

/* ---- General Reset & Body Styles ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--background-light);
    color: var(--text-dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary-blue);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-blue-dark);
}

img {
    max-width: 100%;
    display: block;
}

/* ---- Header Styles (Same as main page) ---- */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.leftheader {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.leftheader img {
    height: 50px;
}

.leftheader h4 {
    font-size: 1.2rem;
    color: var(--dark-navy);
}

.midheader nav ul,
.rightheader nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.midheader nav a,
.rightheader nav a {
    color: var(--text-light);
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
}

.midheader nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-blue);
    transition: width 0.3s ease;
}

.midheader nav a:hover::after {
    width: 100%;
}

.rightheader {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.noticeboard {
    display: flex;
    align-items: center;
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 0.7rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.noticeboard:hover {
    background-color: var(--primary-blue-dark);
}

.noticeboard a {
    color: var(--white);
}

.newgif {
    background-color: #ff4757;
    color: var(--white);
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.floatingbanner {
    background-color: var(--dark-navy);
    color: var(--white);
    padding: 0.5rem 0;
}

#menuicon {
    display: none;
    cursor: pointer;
}

#menuicon img {
    height: 30px;
}

/* ---- Main Container Styles ---- */
main {
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--background-light) 0%, rgba(231, 243, 255, 0.3) 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.headingefa {
    text-align: center;
    margin-bottom: 3rem;
}

.headingefa h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-navy);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 4px solid var(--primary-blue);
    display: inline-block;
    padding-bottom: 0.5rem;
}

/* ---- Section Headings ---- */
.teachers h3,
.primarytimetable h3,
.timetable h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-navy);
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.teachers h3::after,
.primarytimetable h3::after,
.timetable h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 2px;
}

/* ---- Section Containers ---- */
.teachers,
.primarytimetable,
.timetable {
    overflow-x: scroll;
    background-color: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.teachers:hover,
.primarytimetable:hover,
.timetable:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* ---- Table Styles ---- */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
}

thead {
    background-color: var(--dark-navy);
    color: var(--white);
}

th {
    background-color: var(--dark-navy);
    color: var(--white);
    font-weight: 600;
    font-size: 1rem;
    padding: 1.2rem 1rem;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

th:last-child {
    border-right: none;
}

td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s ease;
    vertical-align: middle;
}

td:last-child {
    border-right: none;
}

tr:last-child td {
    border-bottom: none;
}

/* ---- Row Alternating Colors ---- */
tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

tbody tr:nth-child(odd) {
    background-color: var(--white);
}

tbody tr:hover {
    background-color: var(--secondary-blue);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

/* ---- Special Styling for Different Tables ---- */

/* Teachers Table */
.teachers table th:first-child {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
}

.teachers table td:first-child {
    font-weight: 600;
    color: var(--dark-navy);
    background-color: rgba(231, 243, 255, 0.3);
}

/* Primary Timetable */
.primarytimetable table th {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.primarytimetable table td {
    font-weight: 500;
}

/* Main Timetable */
.timetable table th:first-child {
    background: linear-gradient(135deg, var(--dark-navy), #1a365d);
    writing-mode: horizontal-tb;
    text-align: center;
}

.timetable table td:first-child {
    font-weight: 700;
    color: var(--dark-navy);
    background: linear-gradient(135deg, rgba(231, 243, 255, 0.8), rgba(231, 243, 255, 0.4));
}

/* Sunday row special styling */
.timetable table tbody tr:last-child {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.timetable table tbody tr:last-child td {
    font-weight: 600;
    color: #92400e;
    font-size: 1.1rem;
}

.timetable table tbody tr:last-child:hover {
    background: linear-gradient(135deg, #fcd34d, #fbbf24);
}

/* ---- Responsive Design ---- */
@media (max-width: 992px) {
    .header {
        padding: 1rem;
    }

    #menuicon {
        display: block;
    }

    .rightheader {
        order: 2;
        gap: 1rem;
    }

    .rightheader nav {
        display: none;
    }

    .midheader {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--white);
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s ease-in-out;
    }

    .midheader.active {
        max-height: 100vh;
        box-shadow: var(--shadow);
    }
    
    .midheader nav ul {
        flex-direction: column;
        padding: 1rem 0;
        gap: 0;
    }

    .midheader nav li {
        text-align: center;
    }

    .midheader nav a {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .midheader nav a:hover {
        background-color: var(--secondary-blue);
    }

    .midheader nav a::after {
        display: none;
    }

    .headingefa h2 {
        font-size: 2rem;
    }

    .teachers,
    .primarytimetable,
    .timetable {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    main {
        padding: 2rem 1rem;
    }

    .headingefa h2 {
        font-size: 1.5rem;
    }

    .teachers h3,
    .primarytimetable h3,
    .timetable h3 {
        font-size: 1.2rem;
    }

    /* Make tables horizontally scrollable on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    th, td {
        padding: 0.8rem 0.5rem;
        font-size: 0.9rem;
    }

    /* Smaller spacing for mobile tables */
    .timetable table th:first-child {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        min-width: 60px;
    }
}

@media (max-width: 480px) {
    .leftheader h4 {
        display: none;
    }

    .headingefa h2 {
        font-size: 1.3rem;
    }

    .teachers,
    .primarytimetable,
    .timetable {
        padding: 1rem;
        margin-bottom: 2rem;
    }

    th, td {
        padding: 0.6rem 0.3rem;
        font-size: 0.8rem;
    }
}

/* ---- Additional Enhancement: Table Wrapper for Better Mobile Experience ---- */
@media (max-width: 768px) {
    .teachers,
    .primarytimetable,
    .timetable {
        position: relative;
    }
    
    .teachers::after,
    .primarytimetable::after,
    .timetable::after {
        content: "← Swipe to see more →";
        position: absolute;
        bottom: 10px;
        right: 15px;
        font-size: 0.7rem;
        color: var(--text-light);
        font-style: italic;
    }
}