
/* =========================================
   RESPONSIVE STYLES (Mobile & Tablet)
   ========================================= */

/* Mobile Controls (Hidden on Desktop) */
.mobile-nav-controls {
    display: none;
}

.mobile-search-overlay {
    display: none;
}

/* Tablet & Mobile Layouts */
@media screen and (max-width: 992px) {
    /* --- Navigation --- */
    .mobile-nav-controls {
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    .menu-toggle,
    .mobile-search-toggle {
        display: block;
        font-size: 1.5rem;
        color: var(--white);
        cursor: pointer;
        padding: 10px;
        z-index: 1001;
    }
    
    /* Mobile Search Overlay */
    .mobile-search-overlay {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: rgba(18, 18, 18, 0.98);
        backdrop-filter: blur(15px);
        padding: 15px 20px;
        z-index: 998;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        
        transform: translateY(-150%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    
    .mobile-search-overlay.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    body.nav-open {
        overflow: hidden;
        touch-action: none;
    }
    
    .mobile-search-form {
        display: flex;
        align-items: center;
        background: rgba(255,255,255,0.08);
        border: 1px solid var(--border-color);
        border-radius: 50px;
        padding: 8px 20px;
        width: 100%;
        position: relative;
    }
    
    .mobile-search-input {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--white);
        font-size: 1rem;
        outline: none;
        width: 100%;
    }
    
    body.light-mode .mobile-search-overlay {
        background: #ffffff !important;
        backdrop-filter: none;
        border-bottom: 1px solid rgba(0,0,0,0.08);
        box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    }
    body.light-mode .mobile-search-form {
        background: rgba(0,0,0,0.06) !important;
        border: 1px solid rgba(0,0,0,0.1) !important;
    }
    body.light-mode .mobile-search-input {
        color: var(--text-primary) !important;
    }
    
    .mobile-search-submit {
        background: transparent;
        border: none;
        color: var(--primary-yellow);
        font-size: 1.2rem;
        cursor: pointer;
        padding-left: 10px;
    }

    .navbar {
        height: 70px;
        padding: 0;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(18, 18, 18, 0.98);
        backdrop-filter: blur(15px);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 2rem 1rem;
        transition: 0.4s ease-in-out;
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
        margin-left: 0; /* Override desktop margin */
    }
    body.light-mode .nav-menu {
        background: #ffffff !important;
        backdrop-filter: none;
        border-top: 1px solid rgba(0,0,0,0.06);
        box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    }

    .nav-links, .nav-actions {
        display: flex;
        flex-direction: column;
        width: 100%;
        align-items: center;
        gap: 0;
    }

    .nav-actions {
        margin-top: 20px;
        gap: 15px;
        order: 2;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-link {
        font-size: 1.2rem;
        margin: 5px 0;
        width: 100%;
        text-align: center;
        padding: 12px;
        border-radius: 8px;
        white-space: normal; /* Allow wrapping */
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    /* Ensure dropdown toggles are also centered specifically if needed */
    .dropdown-toggle {
        justify-content: center;
        width: 100%; /* Ensure full width for clickability */
    }
    
    /* Dropdown Handling for Mobile */
    .nav-item.dropdown {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
        background: rgba(255, 255, 255, 0.03);
        box-shadow: none;
        border: none;
        text-align: center;
        padding: 0;
        display: none; /* Toggled via JS */
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 0;
    }
    
    .nav-item.dropdown:hover .dropdown-menu {
        transform: none !important;
        left: auto !important;
        right: auto !important;
    }

    .dropdown-menu.active {
        display: block;
    }

    .dropdown-item {
        padding: 12px;
        color: rgba(255, 255, 255, 0.7);
        font-size: 1rem;
        text-align: center;
        display: block;
        width: 100%;
    }
    body.light-mode .dropdown-item {
        color: var(--text-secondary) !important;
    }

    .dropdown-item:hover {
        color: var(--primary-yellow);
        background: transparent;
    }
    
    .nav-link:hover, .nav-link.active {
        background: rgba(255, 255, 255, 0.05);
    }
    body.light-mode .nav-link:hover, body.light-mode .nav-link.active {
        background: rgba(0, 0, 0, 0.06) !important;
    }

    .nav-search-box {
        width: 100%;
        max-width: 350px;
        margin-bottom: 0;
        order: 1; /* Keep search above contact button */
    }
    
    .nav-search-input {
        width: 100%;
    }

    /* --- Typography & General --- */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }
    
    .section-title h2 {
        font-size: 2rem;
    }

    /* --- Hero Section --- */
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }

    /* --- Grids & Layouts --- */
    .heads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .regular-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .school-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .identity-content-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
        padding: 30px; /* Reduced padding for mobile */
    }
    
    .large-identity-logo {
        max-width: 180px;
        margin: 0 auto;
        display: block;
    }
    
    .history-wrapper {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center; /* Center align on mobile */
    }

    .history-content .section-header.text-left {
        text-align: center !important;
        align-items: center;
    }
    
    .history-content .section-header .header-line {
        margin-left: auto;
        margin-right: auto;
    }

    .history-image {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .school-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Layouts (Phones) */
@media screen and (max-width: 576px) {
    /* --- Typography --- */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.8rem; }
    
    .section-header h2 {
        font-size: 1.8rem;
    }
    
    .history-section,
    .stats-identity-section {
        padding: 60px 0 !important;
    }
    
    /* --- Cards & Grids --- */
    .heads-grid, 
    .regular-posts-grid,
    .school-stats-row {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-col {
        margin-bottom: 20px;
        padding-top: 10px;
    }
    
    .footer-col h3::before {
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        bottom: 0;
        height: 3px;
        width: 40px;
    }
    
    .footer-col h3 {
        padding-left: 0;
        padding-bottom: 10px;
    }
    
    .footer-links a {
        justify-content: center;
    }
    
    .social-icons {
        justify-content: center;
        gap: 12px;
    }
    
    .social-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    .footer-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    
    .footer-bottom {
        padding: 1.25rem 0;
    }
    
    /* --- Hero --- */
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-btns {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-hero, .btn-outline-hero {
        width: 100%;
        text-align: center;
    }
    
    /* --- Components --- */
    .announcement-card-modern,
    .event-card-modern {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .announcement-icon {
        margin-bottom: 10px;
    }
    
    .stat-box {
        padding: 1.5rem;
    }
    
    .hymn-lyrics-box {
        padding: 1.5rem;
    }
    
    .logo-text .logo-main {
        font-size: 1.2rem;
    }
    
    .logo-text .logo-sub {
        display: none; /* Hide subtitle on very small screens if needed */
    }
}

/* =========================================
   Search Page Responsive Styles
   ========================================= */
@media screen and (max-width: 992px) {
    /* Tablet & Mobile Hero Reduction */
    .search-hero-section {
        padding: 60px 0 40px;
    }
    .search-results-section {
        padding: 40px 0;
    }
}

@media screen and (max-width: 768px) {
    /* --- Global Mobile Whitespace Reduction --- */
    .section-padding, 
    .news-section, 
    .courses-section,
    .timeline-section,
    .admission-cta,
    .search-hero-section,
    .search-results-section {
        padding: 30px 0 !important;
    }

    .section-header {
        margin-bottom: 20px !important;
    }
    
    .happenings-layout-grid,
    .news-layout-grid,
    .courses-list,
    .requirements-grid {
        gap: 20px !important;
    }

    /* Fix News Layout on Mobile */
    .news-layout-grid {
        grid-template-columns: 1fr !important;
    }

    .news-featured-large {
        min-height: 400px;
    }

    .featured-overlay {
        padding: 20px;
    }

    .featured-info h3 {
        font-size: 1.5rem;
    }
    
    .timeline-item {
        margin-bottom: 30px !important;
    }
    
    .container {
        padding: 0 15px !important;
    }

    /* Mobile Hero Compact */
    .search-hero-section {
        padding: 40px 0 30px !important;
    }

    .search-hero-content h1 {
        font-size: 2rem;
    }

    .search-hero-content .results-count {
        margin-bottom: 20px;
    }

    .search-results-section {
        padding: 30px 0 !important;
    }
    
    /* Keep the search bar unified on mobile for a professional look */
    .search-again-hero .input-group {
        flex-direction: row; /* Keep inline */
        background: rgba(255, 255, 255, 0.05);
        padding: 5px;
        gap: 0;
    }
    
    .search-again-hero input {
        width: auto; /* Let flex handle width */
        flex: 1;
        background: transparent;
        border-radius: 50px;
        box-shadow: none;
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .search-again-hero button {
        width: auto;
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Force Horizontal Scroll for Filters */
    .search-filters {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        align-items: center !important;
        padding-bottom: 15px;
        gap: 10px;
        margin-bottom: 20px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        padding-left: 20px; /* Add some side padding for easier scrolling start */
        padding-right: 20px;
        margin-left: -20px; /* Counteract container padding if needed */
        margin-right: -20px;
        width: calc(100% + 40px);
    }
    
    .search-filters::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Chrome/Safari */
    }
    
    .filter-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 8px 20px;
    }

    .search-results-grid {
        gap: 20px;
    }
}

/* =========================================
   MOBILE CALENDAR ADJUSTMENTS
   ========================================= */

/* For tablets */
@media screen and (max-width: 992px) {
    .calendar-widget-container {
        padding: 1rem;
    }
    
    .cal-days-grid,
    .cal-weekdays {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
        gap: 5px;
    }

    /* Fix for Happenings Section Grid */
    .happenings-layout-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* For mobile phones */
@media screen and (max-width: 576px) {
    .calendar-widget-container {
        padding: 0.75rem;
    }
    
    .widget-header h3 {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    /* Calendar header */
    .cal-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .cal-title {
        font-size: 1rem;
    }
    
    /* Weekday headers */
    .cal-weekdays {
        margin-bottom: 8px;
    }
    
    .cal-weekdays div {
        font-size: 0.7rem;
    }
    
    /* Day cells */
    .day-cell {
        font-size: 0.85rem;
    }

    /* Fix overlap of event dot on mobile */
    .day-cell.has-event::after {
        bottom: 2px;
        width: 3px;
        height: 3px;
    }
    
    /* Calendar legend */
    .calendar-legend {
        gap: 15px;
        margin-top: 15px;
        font-size: 0.75rem;
    }
    
    .dot {
        width: 8px;
        height: 8px;
    }

    /* Resize View All Button on Mobile */
    .btn-view-all {
        padding: 10px 25px;
        font-size: 0.85rem;
        gap: 8px;
    }
}

/* For very small screens */
@media screen and (max-width: 375px) {
    .calendar-widget-container {
        padding: 0.5rem;
    }
    
    .cal-weekdays div {
        font-size: 0.65rem;
    }
    
    .day-cell {
        font-size: 0.8rem;
    }
    
    .cal-title {
        font-size: 0.9rem;
    }
    
    .cal-nav-btn {
        width: 28px;
        height: 28px;
    }
    
    .calendar-legend {
        gap: 10px;
        font-size: 0.7rem;
    }
}
