/*
===============================================
AL WADHA WEBSITE - COMPREHENSIVE MOBILE RESPONSIVE CSS
===============================================
This file contains enhanced mobile responsiveness fixes and improvements
for the Al Wadha website to ensure optimal user experience across all devices.
===============================================
*/

/* ===== GLOBAL MOBILE FIXES ===== */

/* Prevent horizontal scrolling */
html, body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Ensure all containers are responsive */
.container, .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
    overflow-x: hidden;
}

/* Fix any potential fixed widths that might cause issues */
* {
    box-sizing: border-box;
}

/* Ensure images are always responsive */
img {
    max-width: 100%;
    height: auto;
}

/* ===== ENHANCED MOBILE BREAKPOINTS ===== */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {

    /* Typography improvements */
    h1, .h1 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
    }

    h2, .h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }

    h3, .h3 {
        font-size: 1.3rem !important;
        line-height: 1.4 !important;
    }

    h4, .h4 {
        font-size: 1.1rem !important;
        line-height: 1.4 !important;
    }

    h5, .h5 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }

    h6, .h6 {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }

    /* Body text minimum size for readability */
    p, .lead, body {
        font-size: 14px !important;
        line-height: 1.6 !important;
    }

    /* Small text should still be readable */
    small, .small {
        font-size: 12px !important;
    }

    /* ===== NAVIGATION FIXES ===== */

    /* Enhanced navbar for mobile */
    .navbar {
        padding: 0.5rem 1rem !important;
    }

    .navbar-brand {
        padding: 0 !important;
    }

    .navbar-brand img {
        height: 50px !important;
        max-height: 50px !important;
    }

    /* Improved mobile menu */
    .navbar-toggler {
        border: none !important;
        padding: 0.25rem 0.5rem !important;
        font-size: 1.1rem !important;
        line-height: 1 !important;
        background-color: transparent !important;
        border-radius: 0.375rem !important;
    }

    .navbar-toggler:focus {
        box-shadow: none !important;
        outline: 2px solid #D3BF97 !important;
        outline-offset: 2px !important;
    }

    .navbar-collapse {
        margin-top: 1rem !important;
        background-color: #ffffff !important;
        border-radius: 0.5rem !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        padding: 1rem !important;
    }

    .navbar-nav {
        text-align: center !important;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        margin: 0.25rem 0 !important;
        border-radius: 0.375rem !important;
        transition: all 0.3s ease !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
    }

    .navbar-nav .nav-link:hover {
        background-color: #f8f9fa !important;
        color: #D3BF97 !important;
    }

    /* ===== HERO SECTION FIXES ===== */

    .gov-hero-modern {
        padding-top: 70px !important;
        min-height: 70vh !important;
        padding-bottom: 2rem !important;
    }

    .text-column {
        min-height: auto !important;
        padding: 2rem 1rem !important;
    }

    .image-column {
        min-height: 300px !important;
        padding: 1rem !important;
    }

    .headline1 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }

    .description {
        font-size: 14px !important;
        line-height: 1.6 !important;
        margin-bottom: 1.5rem !important;
    }

    .hero-badge {
        font-size: 0.8rem !important;
        padding: 8px 16px !important;
        margin-bottom: 1rem !important;
    }

    /* ===== BUTTON IMPROVEMENTS ===== */

    /* Ensure touch targets are at least 44x44px */
    .btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 12px 20px !important;
        font-size: 1rem !important;
        border-radius: 0.375rem !important;
        transition: all 0.3s ease !important;
    }

    .btn-sm {
        min-height: 38px !important;
        min-width: 38px !important;
        padding: 8px 16px !important;
        font-size: 0.9rem !important;
    }

    .btn-lg {
        min-height: 50px !important;
        min-width: 50px !important;
        padding: 16px 32px !important;
        font-size: 1.1rem !important;
    }

    .btn-action {
        width: 100% !important;
        max-width: 280px !important;
        margin: 0 auto !important;
        display: block !important;
        font-size: 1rem !important;
        padding: 14px 24px !important;
    }

    /* ===== FORM IMPROVEMENTS ===== */

    .form-control, .form-select {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px 16px !important;
        border-radius: 0.375rem !important;
    }

    .form-label {
        font-size: 14px !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
    }

    .input-group {
        flex-wrap: nowrap !important;
    }

    /* ===== SERVICE CARDS FIXES ===== */

    .service-card, .services-section .card {
        margin-bottom: 1.5rem !important;
        border-radius: 0.75rem !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.3s ease !important;
    }

    .service-card .card-body {
        padding: 1.5rem 1rem !important;
    }

    .service-card h4, .service-card h5 {
        font-size: 1.1rem !important;
        margin-bottom: 0.75rem !important;
    }

    .service-card p {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* ===== CAROUSEL FIXES ===== */

    .carousel-inner {
        overflow: hidden !important;
    }

    .carousel-item {
        transition: transform 0.6s ease-in-out !important;
    }

    .carousel-control-prev, .carousel-control-next {
        width: 44px !important;
        height: 44px !important;
        background-color: rgba(0, 0, 0, 0.5) !important;
        border-radius: 50% !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }

    .carousel-control-prev {
        left: 10px !important;
    }

    .carousel-control-next {
        right: 10px !important;
    }

    /* ===== MODAL IMPROVEMENTS ===== */

    .modal-dialog {
        margin: 1rem !important;
        max-width: calc(100vw - 2rem) !important;
    }

    .modal-content {
        border-radius: 0.75rem !important;
    }

    .modal-header {
        padding: 1rem 1.5rem !important;
        border-bottom: 1px solid #dee2e6 !important;
    }

    .modal-body {
        padding: 1.5rem !important;
    }

    .modal-footer {
        padding: 1rem 1.5rem !important;
        border-top: 1px solid #dee2e6 !important;
    }

    /* ===== FOOTER IMPROVEMENTS ===== */

    .footer {
        padding: 2rem 0 1rem !important;
    }

    .footer-content {
        display: block !important;
        text-align: center !important;
    }

    .footer-section {
        margin-bottom: 2rem !important;
        padding: 0 1rem !important;
    }

    .footer-section h5 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
    }

    .footer-section p, .footer-section a {
        font-size: 14px !important;
        line-height: 1.6 !important;
    }

    /* ===== WHATSAPP WIDGET FIXES ===== */

    .whatsapp-chat, .whatsapp-widget {
        bottom: 20px !important;
        right: 20px !important;
        left: auto !important;
        z-index: 1050 !important;
        position: fixed !important;
    }

    .whatsapp-chat .btn, .whatsapp-widget .btn {
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
        font-size: 1.5rem !important;
        padding: 0 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }

    /* ===== SPACING IMPROVEMENTS ===== */

    .section {
        padding: 2rem 0 !important;
    }

    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .my-5 {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }

    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* ===== TABLE RESPONSIVENESS ===== */

    .table-responsive {
        border: none !important;
        margin-bottom: 1rem !important;
    }

    .table {
        font-size: 14px !important;
        margin-bottom: 0 !important;
    }

    .table th, .table td {
        padding: 0.75rem 0.5rem !important;
        vertical-align: middle !important;
    }

    /* ===== ACCESSIBILITY IMPROVEMENTS ===== */

    /* Focus indicators */
    a:focus, button:focus, .btn:focus, .form-control:focus {
        outline: 2px solid #D3BF97 !important;
        outline-offset: 2px !important;
        box-shadow: 0 0 0 0.2rem rgba(211, 191, 151, 0.25) !important;
    }

    /* Skip link for accessibility */
    .skip-link {
        position: absolute !important;
        top: -40px !important;
        left: 6px !important;
        background: #D3BF97 !important;
        color: white !important;
        padding: 8px !important;
        z-index: 9999 !important;
        text-decoration: none !important;
        border-radius: 0 0 4px 4px !important;
    }

    .skip-link:focus {
        top: 0 !important;
    }
}

/* ===== SMALL DEVICES (576px - 767.98px) ===== */
@media (min-width: 576px) and (max-width: 767.98px) {

    .navbar-brand img {
        height: 60px !important;
        max-height: 60px !important;
    }

    .headline1 {
        font-size: 2.2rem !important;
    }

    .description {
        font-size: 15px !important;
    }

    .btn-action {
        max-width: 320px !important;
    }

    .service-card {
        max-width: 280px !important;
        margin: 0 auto 1.5rem !important;
    }

    .modal-dialog {
        max-width: 500px !important;
    }

    .container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

/* ===== MEDIUM DEVICES (768px - 991.98px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {

    .navbar-brand img {
        height: 70px !important;
        max-height: 70px !important;
    }

    .headline1 {
        font-size: 2.5rem !important;
    }

    .description {
        font-size: 16px !important;
    }

    .btn-action {
        max-width: 350px !important;
    }

    .service-card {
        max-width: 320px !important;
    }

    .container {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    /* Tablet-specific improvements */
    .navbar-collapse {
        background-color: transparent !important;
        box-shadow: none !important;
    }

    .navbar-nav .nav-link {
        margin: 0 0.5rem !important;
    }
}

/* ===== LARGE DEVICES (992px - 1199.98px) ===== */
@media (min-width: 992px) and (max-width: 1199.98px) {

    .navbar-brand img {
        height: 80px !important;
        max-height: 80px !important;
    }

    .container {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* ===== EXTRA LARGE DEVICES (1200px and up) ===== */
@media (min-width: 1200px) {

    .navbar-brand img {
        height: 90px !important;
        max-height: 90px !important;
    }

    .container {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor !important;
    }

    .card {
        border: 2px solid currentColor !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .whatsapp-chat,
    .whatsapp-widget,
    .modal,
    .carousel-control-prev,
    .carousel-control-next {
        display: none !important;
    }

    body {
        font-size: 12pt !important;
        line-height: 1.4 !important;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid !important;
    }

    .card, .service-card {
        page-break-inside: avoid !important;
    }
}

/* ===== UTILITY CLASSES FOR MOBILE ===== */

.mobile-hidden {
    display: none !important;
}

@media (min-width: 768px) {
    .mobile-hidden {
        display: block !important;
    }
}

.mobile-only {
    display: block !important;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}

.mobile-center {
    text-align: center !important;
}

@media (min-width: 768px) {
    .mobile-center {
        text-align: left !important;
    }
}

.mobile-full-width {
    width: 100% !important;
}

@media (min-width: 768px) {
    .mobile-full-width {
        width: auto !important;
    }
}

/* ===== LANDSCAPE ORIENTATION FIXES ===== */
@media (max-width: 767.98px) and (orientation: landscape) {
    .gov-hero-modern {
        min-height: 50vh !important;
        padding-top: 60px !important;
    }

    .navbar {
        padding: 0.25rem 1rem !important;
    }

    .navbar-brand img {
        height: 40px !important;
    }

    .modal-dialog {
        margin: 0.5rem !important;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for touch devices */
    .btn, .nav-link, a[href] {
        min-height: 44px !important;
        min-width: 44px !important;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-link:hover,
    .card:hover {
        transform: none !important;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .navbar-collapse {
        background-color: #1a1a1a !important;
        color: #ffffff !important;
    }

    .modal-content {
        background-color: #1a1a1a !important;
        color: #ffffff !important;
    }

    .card, .service-card {
        background-color: #2a2a2a !important;
        color: #ffffff !important;
        border-color: #444444 !important;
    }
}