/* Responsive Design Improvements for School Websites */

/* Mobile Navigation Enhancements */
.navbar {
    padding: 0.5rem 0;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 600;
    transition: all 0.3s ease;
}

.navbar-brand img {
    transition: all 0.3s ease;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    background: transparent;
    transition: all 0.3s ease;
    border-radius: 0.375rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.navbar-toggler:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    transition: all 0.3s ease;
    width: 1.5em;
    height: 1.5em;
}

.navbar-collapse {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 10px;
    margin-top: 1rem;
    padding: 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

.navbar-nav {
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

.nav-link:focus {
    background-color: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Desktop Navbar - Horizontal */
@media (min-width: 992px) {
    .navbar-expand-lg .navbar-collapse {
        display: flex !important;
    }
    
    .navbar-expand-lg .navbar-toggler {
        display: none !important;
    }
    
    .navbar-nav {
        flex-direction: row !important;
        gap: 0.5rem;
        width: auto;
        text-align: left;
    }
    
    .nav-link {
        padding: 0.5rem 1rem !important;
        text-align: center;
        border-radius: 0.375rem;
        display: inline-block;
        width: auto;
        transition: all 0.3s ease;
        color: #000000 !important;
        background-color: transparent !important;
        font-weight: 500 !important;
    }
    
    .nav-link:hover {
        background-color: rgba(13, 110, 253, 0.1) !important;
        color: #0d6efd !important;
        transform: translateY(-2px);
    }
    
    .nav-link:focus {
        background-color: rgba(13, 110, 253, 0.1) !important;
        color: #0d6efd !important;
    }
    
    .navbar-brand img {
        height: 50px;
        transition: all 0.3s ease;
    }
}

/* Mobile Navbar - Vertical */
@media (max-width: 991.98px) {
    .navbar-expand-lg .navbar-collapse {
        display: none !important;
    }
    
    .navbar-expand-lg .navbar-toggler {
        display: block !important;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 0.375rem;
        padding: 0.25rem 0.5rem;
        background-color: transparent;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    }
    
    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
        width: 1.5em !important;
        height: 1.5em !important;
        display: inline-block !important;
        vertical-align: middle;
        background-repeat: no-repeat !important;
        background-position: center !important;
        background-size: 100% !important;
        border: none !important;
        outline: none !important;
        background-color: transparent !important;
    }
    
    /* Force hamburger icon to show */
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        content: '';
        display: none;
    }
    
    /* Alternative hamburger icon using CSS */
    .navbar-toggler-icon.alternative {
        background-image: none;
        position: relative;
        width: 30px;
        height: 30px;
        border: none;
    }
    
    .navbar-toggler-icon.alternative::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 0;
        right: 0;
        height: 3px;
        background-color: #333;
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .navbar-toggler-icon.alternative::after {
        content: '';
        position: absolute;
        bottom: 6px;
        left: 0;
        right: 0;
        height: 3px;
        background-color: #333;
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .navbar-toggler-icon.alternative {
        background: linear-gradient(to bottom, 
            transparent 6px, 
            #333 6px, 
            #333 9px, 
            transparent 9px, 
            transparent 15px, 
            #333 15px, 
            #333 18px, 
            transparent 18px, 
            transparent 24px, 
            #333 24px, 
            #333 27px, 
            transparent 27px
        );
        background-size: 100% 30px;
        background-repeat: no-repeat;
        background-position: center;
    }
    
    .navbar-collapse.show {
        display: block !important;
        background: #ffffff !important;
        border-radius: 10px;
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
        animation: slideDown 0.3s ease-out;
        opacity: 1;
        visibility: visible;
    }
    
    .navbar-collapse:not(.show) {
        display: none !important;
        opacity: 0;
        visibility: hidden;
        height: 0;
        overflow: hidden;
    }
    
    /* Force close animation */
    .navbar-collapse {
        transition: all 0.3s ease;
    }
    
    .navbar-collapse.show {
        height: auto;
        overflow: visible;
    }
    
    .navbar-nav {
        flex-direction: column !important;
        gap: 0.25rem;
        width: 100%;
        text-align: center;
    }
    
    .nav-link {
        padding: 0.75rem 1rem !important;
        text-align: center;
        border-radius: 0.5rem;
        display: block;
        width: 100%;
        transition: all 0.3s ease;
        color: #000000 !important;
        background-color: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        margin-bottom: 0.25rem;
        font-weight: 500 !important;
    }
    
    .nav-link:hover {
        background-color: rgba(13, 110, 253, 0.1);
        color: #0d6efd !important;
        transform: translateX(-5px);
        border-color: rgba(13, 110, 253, 0.3);
    }
    
    .nav-link:focus {
        background-color: rgba(13, 110, 253, 0.1);
        color: #0d6efd !important;
        border-color: rgba(13, 110, 253, 0.3);
    }
    
    .navbar-brand img {
        height: 50px;
        transition: all 0.3s ease;
    }
}

/* Tablet */
@media (max-width: 991.98px) and (min-width: 768px) {
    .navbar-collapse.show {
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .nav-link {
        padding: 0.875rem 1.25rem !important;
        font-size: 1rem;
    }
    
    .navbar-brand img {
        height: 50px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .navbar {
        padding: 0.25rem 0;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-brand img {
        height: 40px;
    }
    
    .navbar-toggler {
        padding: 0.5rem;
        border: 2px solid #dee2e6;
        border-radius: 0.375rem;
    }
    
    .navbar-collapse.show {
        margin-top: 0.25rem;
        padding: 0.75rem;
        max-width: 100%;
    }
    
    .nav-link {
        padding: 0.75rem !important;
        font-size: 0.95rem;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    .navbar-brand img {
        height: 35px;
    }
    
    .navbar-toggler {
        padding: 0.375rem;
        border: 2px solid #dee2e6;
        border-radius: 0.375rem;
    }
    
    .navbar-toggler-icon {
        width: 1.25em;
        height: 1.25em;
    }
    
    .nav-link {
        padding: 0.625rem !important;
        font-size: 0.9rem;
    }
    
    .navbar-collapse.show {
        padding: 0.5rem;
    }
}

/* Hero Section Mobile Optimizations */
@media (max-width: 768px) {
    .hero-section {
        background-attachment: scroll !important;
        min-height: 90vh;
        padding: 2rem 0;
    }
    
    .hero-section.has-banner {
        background-attachment: scroll !important;
        background-size: cover !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
    }
    
    .hero-content {
        text-align: center;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-top: 2rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        border-radius: 25px;
    }
}

/* Banner Image Responsive Fixes */
@media (max-width: 1200px) {
    .hero-section.has-banner {
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
    }
}

@media (max-width: 992px) {
    .hero-section.has-banner {
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
    }
}

@media (max-width: 768px) {
    .hero-section.has-banner {
        background-size: cover !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
        background-attachment: scroll !important;
    }
}

@media (max-width: 576px) {
    .hero-section.has-banner {
        background-size: cover !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
        background-attachment: scroll !important;
        min-height: 80vh;
    }
}

@media (max-width: 400px) {
    .hero-section.has-banner {
        background-size: cover !important;
        background-position: center center !important;
        background-repeat: no-repeat !important;
        background-attachment: scroll !important;
        min-height: 70vh;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section.has-banner {
        background-size: cover !important;
        background-position: center center !important;
        min-height: 100vh;
    }
}

/* Responsive Banner Images */
.hero-section.has-banner {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* Desktop Banner (large image) */
@media (min-width: 769px) {
    .hero-section.has-banner {
        background-image: var(--banner-desktop, url('/static/images/Banner.jpg'));
        background-size: cover;
        background-position: center center;
        background-attachment: fixed;
    }
}

/* Tablet Banner (medium image) */
@media (max-width: 768px) and (min-width: 481px) {
    .hero-section.has-banner {
        background-image: var(--banner-tablet, url('/static/images/Banner.jpg'));
        background-size: cover;
        background-position: center center;
        background-attachment: scroll;
    }
}

/* Mobile Banner (small image) */
@media (max-width: 480px) {
    .hero-section.has-banner {
        background-image: var(--banner-mobile, url('/static/images/Banner.jpg'));
        background-size: cover;
        background-position: center center;
        background-attachment: scroll;
    }
}

/* High DPI Banner Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    @media (min-width: 769px) {
        .hero-section.has-banner {
            background-image: var(--banner-desktop-2x, url('/static/images/Banner.jpg'));
        }
    }
    
    @media (max-width: 768px) and (min-width: 481px) {
        .hero-section.has-banner {
            background-image: var(--banner-tablet-2x, url('/static/images/Banner.jpg'));
        }
    }
    
    @media (max-width: 480px) {
        .hero-section.has-banner {
            background-image: var(--banner-mobile-2x, url('/static/images/Banner.jpg'));
        }
    }
}

/* Touch-friendly Interface */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
    }
    
    .navbar-toggler {
        min-height: 44px;
        min-width: 44px;
    }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-section::before {
        background-size: 2000px 2000px;
    }
    
    .navbar-brand img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Performance Optimizations */
.hero-section {
    will-change: transform;
}

.navbar {
    will-change: background-color, box-shadow;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .hero-section::before {
        animation: none;
    }
    
    .navbar-collapse {
        animation: none;
    }
    
    * {
        transition: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .navbar-collapse {
        background: rgba(30, 41, 59, 0.98);
        color: white;
    }
    
    .navbar-collapse .nav-link {
        color: white !important;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .hero-buttons,
    .btn {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        background: none !important;
        color: black !important;
    }
    
    .hero-title,
    .hero-subtitle {
        color: black !important;
    }
}

/* Force navbar colors - Override any conflicting styles */
.navbar {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

.navbar.navbar-light {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

.navbar.bg-white {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

.navbar .nav-link {
    color: #000000 !important;
}

.navbar .nav-link:hover {
    color: #0d6efd !important;
}

.navbar .nav-link:focus {
    color: #0d6efd !important;
}

/* Mobile menu specific overrides */
@media (max-width: 991.98px) {
    .navbar-collapse.show {
        background-color: #ffffff !important;
        background: #ffffff !important;
    }
    
    .navbar-collapse.show .nav-link {
        color: #000000 !important;
        background-color: #ffffff !important;
    }
    
    .navbar-collapse.show .nav-link:hover {
        color: #0d6efd !important;
        background-color: rgba(13, 110, 253, 0.1) !important;
    }
}

/* Ultra-strong navbar background override */
nav.navbar {
    background-color: #ffffff !important;
    background: #ffffff !important;
    background-image: none !important;
}

nav.navbar.navbar-light {
    background-color: #ffffff !important;
    background: #ffffff !important;
    background-image: none !important;
}

nav.navbar.bg-white {
    background-color: #ffffff !important;
    background: #ffffff !important;
    background-image: none !important;
}
