* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    padding-top: 70px;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column; 
}

/* Header */
header {
    background-color: #003366; /* Navy blue for school theme */
    color: white;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
}

/* Main Content */
main {
    flex: 1;
    max-width: auto;
    padding: 40px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Add to your style.css or index.php style tag */
.container-fluid {
    max-width: 1600px; /* Adjust as needed */
    margin: 0 auto;
}

.upper{
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.upper .carousel {
    width: 55%;
    margin-left: 20px;
}

section {
    margin-bottom: 40px;
}

h2 {
    color: #003366;
    margin-bottom: 10px;
}

.news h3 {
    margin-top: 10px;
}
.news article {
    margin-bottom: 15px;
    padding: 10px;
    border-left: 5px solid #003366;
    background-color: #f9f9f9;
}

/* Forms */
form {
    max-width: 400px;
    margin: 20px 0;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Footer */
footer {
    text-align: center;
    padding: 10px;
    background-color: #003366;
    color: white;
}

:root {
    color-scheme: light dark;
}

/* ========== MOBILE OPTIMIZATION ========== */
/* These styles should ONLY apply on mobile (max-width: 768px) */
@media (max-width: 768px) {
    /* Main content spacing */
    main {
        padding: 10px !important;
    }
    
    /* Learning materials page specific - aggressive padding */
    .learning-materials-page .container-fluid,
    .learning-materials-page .container,
    main.learning-materials-page .container-fluid,
    main.learning-materials-page .container {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }
    
    .learning-materials-page .row,
    main.learning-materials-page .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .learning-materials-page .col-12, 
    .learning-materials-page [class*="col-"],
    main.learning-materials-page .col-12, 
    main.learning-materials-page [class*="col-"] {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }
    
    /* Header adjustments */
    header {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 0.5rem 1rem;
    }

    .logo {
        flex: 1;
        justify-content: flex-start;
    }

    nav {
        flex: 1;
        justify-content: center;
    }

    nav ul li {
        margin: 10px 4px;
        text-align: left;
    }

    .menu-toggle {
        display: flex;
        justify-self: flex-end;
    }

    .upper{
        flex-direction: column;
        margin-bottom: 20px;
    }

    .upper .carousel {
        width: 100%;
        margin-left: 0;
    }
    
    /* Typography adjustments for mobile */
    h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    h4 {
        font-size: 1.1rem;
    }
    
    /* Make text more readable on mobile */
    p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    /* Mobile Responsive Styles */
    @media (max-width: 768px) {
        .resource-links {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        
        .resource-link {
            flex: 1 0 auto;
            padding: 0.75rem;
            margin-bottom: 0.5rem;
            text-align: center;
        }
        
        .upcoming-events-list {
            max-height: 250px;
        }
        
        .event-item {
            padding: 0.75rem !important;
            margin-bottom: 0.75rem !important;
        }
        
        .event-item h6 {
            font-size: 0.9rem;
        }
        
        .badge-sm {
            font-size: 0.65rem;
            padding: 0.15rem 0.4rem;
        }
        
        .section-card {
            padding: 1.25rem !important;
            margin-bottom: 1rem !important;
        }
    }

    @media (max-width: 576px) {
        .resource-links {
            grid-template-columns: 1fr;
        }
        
        .event-item {
            flex-direction: column;
        }
        
        .event-item .d-flex {
            flex-direction: column;
            align-items: flex-start !important;
        }
        
        .event-date {
            flex-wrap: wrap;
        }
        
        .event-date .badge {
            margin-top: 0.25rem;
        }
        
        .featured-event-card {
            margin-bottom: 1rem;
        }
        
        .btn-sm {
            padding: 0.25rem 0.5rem;
            font-size: 0.8rem;
        }
    }
}

/* Small mobile devices */
@media (max-width: 576px) {
    main {
        padding: 8px !important;
    }
    
    /* Learning materials page specific */
    .learning-materials-page .container-fluid,
    .learning-materials-page .container,
    main.learning-materials-page .container-fluid,
    main.learning-materials-page .container {
        padding-left: 1px !important;
        padding-right: 1px !important;
    }
    
    header {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    /* Learning materials page specific */
    .learning-materials-page .container-fluid,
    .learning-materials-page .container,
    main.learning-materials-page .container-fluid,
    main.learning-materials-page .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    header {
        padding: 0.3rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
}
