/**
 * Comprehensive Responsive Fixes for ANF Travel
 * Addresses all responsive design issues across breakpoints
 */

/* Enhanced Viewport and Base Responsive Settings */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Container Fixes */
.container-fluid {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

.container {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

/* Enhanced Breakpoint System */

/* Extra Large Devices (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-content h1 {
        font-size: 3.5rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
}

/* Large Devices (1200px to 1399px) */
@media (max-width: 1399.98px) {
    .container {
        max-width: 1140px;
    }
    
    .hero-content h1 {
        font-size: 3rem;
    }
    
    .nav-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Medium-Large Devices (992px to 1199px) */
@media (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    .hero-content h1 {
        font-size: 2.75rem;
    }
    
    .nav-link {
        font-size: 0.8rem;
        padding: 0.5rem 0.7rem;
    }
    
    .search-hub-card {
        max-width: 95%;
        margin: 0 auto;
    }
    
    .search-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
}

/* Medium Devices (768px to 991px) */
@media (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    
    /* Typography adjustments */
    body {
        font-size: 14px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.1rem; }
    h6 { font-size: 1rem; }
    
    .hero-content h1 {
        font-size: 2.25rem;
    }
    
    .hero-content .lead {
        font-size: 1rem;
    }
    
    /* Navigation fixes */
    .nav-link {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
    }
    
    /* Search form adjustments */
    .search-hub-container {
        margin-top: -80px;
        padding: 0 20px;
    }
    
    .search-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }
    
    .search-tab {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
    
    .tab-icon {
        width: 35px;
        height: 35px;
    }
    
    /* Card adjustments */
    .card {
        margin-bottom: 1.5rem;
    }
    
    .tour-card .card-img-top {
        height: 220px;
    }
}

/* Small-Medium Devices (576px to 767px) */
@media (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }
    
    /* Hero section mobile optimization */
    .hero-slide {
        height: 400px;
    }
    
    .hero-content {
        padding-top: 60px;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-content .lead {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-btns {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .hero-btns .btn {
        width: 200px;
        margin-right: 0 !important;
    }
    
    .hero-features {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    /* Navigation mobile fixes */
    .nav-link {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        width: 100%;
        text-align: left;
    }
    
    .mobile-toggle {
        display: flex !important;
    }
    
    /* Search form mobile optimization */
    .search-hub-container {
        margin-top: -60px;
        padding: 0 15px;
    }
    
    .search-hub-card {
        max-width: 100%;
        border-radius: 12px;
    }
    
    .search-tabs {
        flex-wrap: wrap;
        gap: 5px;
        padding: 0 15px 10px;
    }
    
    .search-tab {
        flex: 1;
        min-width: calc(33.333% - 5px);
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    
    .tab-icon {
        width: 30px;
        height: 30px;
        margin-bottom: 5px;
    }
    
    .search-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 40px 12px 16px;
    }
    
    /* Card improvements */
    .card {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .tour-card .card-img-top {
        height: 200px;
    }
    
    /* Button improvements */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .btn-lg {
        min-height: 48px;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    /* Modal improvements */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }
    
    .modal-content {
        border-radius: 0;
        height: 100%;
    }
}

/* Extra Small Devices (up to 575px) */
@media (max-width: 575.98px) {
    .container {
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* Typography for mobile */
    body {
        font-size: 13px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }
    
    /* Hero section extra small */
    .hero-slide {
        height: 350px;
    }
    
    .hero-content {
        padding-top: 40px;
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
        line-height: 1.1;
    }
    
    .hero-content .lead {
        font-size: 0.9rem;
    }
    
    .hero-btns .btn {
        width: 100%;
        font-size: 0.85rem;
    }
    
    /* Search form extra small */
    .search-hub-container {
        margin-top: -40px;
        padding: 0 10px;
    }
    
    .search-title {
        font-size: 1.25rem;
    }
    
    .search-subtitle {
        font-size: 0.8rem;
    }
    
    .search-tabs {
        padding: 0 10px 10px;
    }
    
    .search-tab {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    .tab-icon {
        width: 25px;
        height: 25px;
    }
    
    /* Form improvements */
    .form-control,
    .form-select,
    .search-input {
        font-size: 16px; /* Prevents zoom */
        padding: 12px 16px;
        min-height: 44px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .input-group {
        flex-direction: column;
        width: 100%;
    }
    
    .input-group > * {
        width: 100% !important;
        margin-bottom: 10px;
        flex: none;
    }
    
    .input-group > *:last-child {
        margin-bottom: 0;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 5px;
        border-radius: 0.375rem !important;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Navigation brand */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Footer adjustments */
    .footer {
        padding: 30px 0 15px;
        text-align: center;
    }
    
    .footer .row > div {
        margin-bottom: 25px;
    }
    
    .footer h5 {
        font-size: 1rem;
    }
}

/* Landscape Phone Orientation */
@media (max-width: 767.98px) and (orientation: landscape) {
    .hero-slide {
        height: 300px;
    }
    
    .hero-content {
        padding-top: 30px;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .search-hub-container {
        margin-top: -30px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Improve touch targets */
    .btn,
    .nav-link,
    .search-tab,
    .card {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .card:hover,
    .nav-link:hover {
        transform: none;
    }
    
    /* Improve scroll behavior */
    .modal-body,
    .search-results {
        -webkit-overflow-scrolling: touch;
    }
}

/* High DPI Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-slide {
        background-size: cover;
        background-attachment: scroll; /* Better performance on mobile */
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .search-hub-container,
    .btn,
    .modal {
        display: none !important;
    }
    
    .hero-slide {
        height: auto;
        background: none;
    }
    
    .hero-content {
        color: black;
    }
    
    .container {
        max-width: 100%;
    }
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .search-hub-card {
        background-color: rgba(30, 30, 30, 0.95);
        color: white;
    }
    
    .search-input {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
        border-color: rgba(255, 255, 255, 0.2);
    }
}

/* Fix for specific responsive issues */

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

/* Fix table responsiveness */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix for long content */
.text-break {
    word-wrap: break-word;
    word-break: break-word;
}

/* Utility classes for responsive design */
.d-mobile-none {
    display: block;
}

.d-mobile-block {
    display: none;
}

@media (max-width: 767.98px) {
    .d-mobile-none {
        display: none;
    }
    
    .d-mobile-block {
        display: block;
    }
}

/* Fix for overflow issues */
.overflow-hidden {
    overflow: hidden;
}

.overflow-x-hidden {
    overflow-x: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

/* Responsive spacing utilities */
@media (max-width: 767.98px) {
    .py-mobile-3 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .px-mobile-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .mb-mobile-2 {
        margin-bottom: 0.5rem !important;
    }
    
    .mt-mobile-3 {
        margin-top: 1rem !important;
    }
}