/* Mobile-Specific Fixes for Bhanubhakta School Website */

/* Critical Mobile Fixes */
@media (max-width: 768px) {
    /* Fix horizontal scrolling issues */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    /* Ensure all containers fit within viewport */
    .container, .container-fluid {
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Fix row overflow */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Hero section mobile fixes */
    .hero-section {
        padding: 2rem 0 !important;
        min-height: 80vh !important;
    }
    
    .hero-title {
        font-size: 2.5rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-subtitle {
        font-size: 1.1rem !important;
        margin-bottom: 2rem !important;
    }
    
    /* Navigation mobile fixes */
    .navbar-brand-modern {
        font-size: 1.3rem !important;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem !important;
        border: none !important;
    }
    
    .navbar-collapse {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        border-radius: 15px !important;
        margin-top: 1rem !important;
        padding: 1rem !important;
        backdrop-filter: blur(10px) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    
    .navbar-nav {
        text-align: center !important;
        width: 100% !important;
    }
    
    .navbar-nav .nav-link {
        padding: 0.8rem 1rem !important;
        text-align: center !important;
        margin: 0.2rem auto !important;
        border-radius: 10px !important;
        color: rgba(255, 255, 255, 0.9) !important;
        transition: all 0.3s ease !important;
        display: block !important;
        width: 100% !important;
    }
    
    .navbar-nav .nav-link:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: #ffffff !important;
        transform: translateX(5px) !important;
    }
    
    .navbar-nav .nav-link.active {
        background: rgba(255, 255, 255, 0.2) !important;
        color: #ffffff !important;
        font-weight: 600 !important;
    }
    
    /* Button mobile fixes */
    .btn-modern, .btn-hero-primary, .btn-hero-outline {
        width: 100% !important;
        margin-bottom: 1rem !important;
        padding: 1rem 1.5rem !important;
        font-size: 0.9rem !important;
        min-height: 50px !important;
    }
    
    /* Card mobile fixes */
    .feature-card, .contact-card, .team-card {
        margin-bottom: 2rem !important;
        padding: 1.5rem !important;
    }
    
    .glass-card {
        padding: 2rem !important;
        margin: 1rem 0 !important;
    }
    
    /* Form mobile fixes */
    .form-control {
        padding: 1rem !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
        min-height: 50px !important;
    }
    
    .form-label {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Icon mobile fixes */
    .feature-icon, .contact-icon {
        width: 70px !important;
        height: 70px !important;
        font-size: 1.8rem !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-icon-bg, .contact-icon-hero {
        width: 90px !important;
        height: 90px !important;
        font-size: 2rem !important;
    }
    
    /* Stats mobile fixes */
    .stat-number {
        font-size: 2.5rem !important;
    }
    
    .stat-item {
        margin-bottom: 2rem !important;
        padding: 1.5rem !important;
    }
    
    /* Timeline mobile fixes */
    .timeline::before {
        left: 20px !important;
    }
    
    .timeline-content {
        width: calc(100% - 60px) !important;
        margin-left: 60px !important;
    }
    
    .timeline-dot {
        left: 20px !important;
    }
    
    /* Gallery mobile fixes */
    .gallery-item {
        margin-bottom: 1rem !important;
    }
    
    .gallery-image {
        height: 200px !important;
        object-fit: cover !important;
    }
    
    /* Footer mobile fixes */
    .footer {
        text-align: center !important;
        padding: 3rem 0 1rem !important;
    }
    
    .footer .col-md-6 {
        margin-bottom: 2rem !important;
    }
    
    /* Hide decorative elements on mobile */
    .floating-element,
    .achievement-card {
        display: none !important;
    }
    
    /* Disable complex animations on mobile */
    .hero-main-card {
        transform: none !important;
        animation: none !important;
    }
    
    /* Text alignment fixes */
    .hero-content {
        text-align: center !important;
    }
    
    /* Spacing fixes */
    .section-padding {
        padding: 60px 0 !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    .mt-5 {
        margin-top: 2rem !important;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
    }
    
    .btn-modern, .btn-hero-primary, .btn-hero-outline {
        padding: 0.8rem 1.2rem !important;
        font-size: 0.85rem !important;
    }
    
    .feature-icon, .contact-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
    }
    
    .hero-icon-bg, .contact-icon-hero {
        width: 80px !important;
        height: 80px !important;
        font-size: 1.8rem !important;
    }
    
    .stat-number {
        font-size: 2rem !important;
    }
    
    .glass-card {
        padding: 1.5rem !important;
    }
    
    .contact-hero-card {
        padding: 1.5rem !important;
    }
    
    .section-padding {
        padding: 40px 0 !important;
    }
    
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-title {
        font-size: 2.2rem !important;
    }
    
    .btn-modern, .btn-hero-primary, .btn-hero-outline {
        width: auto !important;
        margin-right: 1rem !important;
        margin-bottom: 1rem !important;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .hero-section {
        min-height: 85vh !important;
    }
    
    .hero-content {
        text-align: center !important;
        margin-bottom: 3rem !important;
    }
    
    .btn-modern, .btn-hero-primary, .btn-hero-outline {
        width: auto !important;
        margin-right: 1rem !important;
    }
    
    .section-padding {
        padding: 80px 0 !important;
    }
}

/* Landscape orientation fixes */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: 60vh !important;
        padding: 1rem 0 !important;
    }
    
    .navbar-collapse {
        max-height: 50vh !important;
        overflow-y: auto !important;
    }
    
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Improve touch targets */
    .btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 0.8rem 1.5rem !important;
    }
    
    .nav-link {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .form-control {
        min-height: 50px !important;
    }
    
    /* Reduce hover effects for touch devices */
    .card:hover {
        transform: translateY(-2px) !important;
    }
    
    .btn:hover {
        transform: none !important;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-container img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .glass-card {
        background: rgba(0,0,0,0.3) !important;
        border-color: rgba(255,255,255,0.1) !important;
    }
}

/* Print optimizations */
@media print {
    .navbar, .floating-element, .btn, .hero-section::before {
        display: none !important;
    }
    
    .hero-section {
        background: none !important;
        color: black !important;
        min-height: auto !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .section-padding {
        padding: 1rem 0 !important;
    }
}

/* Fix for iOS Safari viewport issues */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        min-height: -webkit-fill-available !important;
    }
}

/* Fix for Chrome mobile address bar */
@media screen and (max-width: 768px) {
    .hero-section {
        min-height: calc(100vh - 60px) !important;
    }
}

/* Utility classes for mobile */
@media (max-width: 768px) {
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-hide {
        display: none !important;
    }
    
    .mobile-show {
        display: block !important;
    }
    
    .mobile-flex-column {
        flex-direction: column !important;
    }
    
    .mobile-gap-1 {
        gap: 1rem !important;
    }
    
    .mobile-mb-2 {
        margin-bottom: 2rem !important;
    }
    
    .mobile-p-1 {
        padding: 1rem !important;
    }
}