/* ========================================
   ENHANCED MOBILE RESPONSIVE CSS
   ======================================== */

/* Prevent horizontal scrolling on all devices */
html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    :root {
        --fluid-h1: clamp(1.75rem, 8vw, 2.5rem);
        --fluid-h2: clamp(1.5rem, 6vw, 2rem);
    }
}

/* Medium Screens / Split Screen (768px to 1100px) */
@media (min-width: 768px) and (max-width: 1100px) {
    .navbar {
        padding: 0.75rem 1.5rem !important;
    }

    .nav-links {
        gap: 1rem !important;
    }

    .nav-link {
        font-size: 0.9rem !important;
        gap: 0.35rem !important;
    }

    .nav-link i {
        font-size: 0.9rem;
    }

    #headerSearchForm {
        width: 150px;
    }

    #headerSearchForm input {
        width: 100px !important;
        font-size: 0.8rem !important;
    }

    .page-title {
        font-size: 1.75rem !important;
    }

    .page-header {
        flex-direction: row;
        gap: 1rem;
    }
}

/* Tablet and below (< 1250px) */
@media (max-width: 1249px) {
    .navbar {
        padding: 0.75rem 1rem !important;
        justify-content: space-between !important;
    }

    .nav-links {
        display: none !important;
        /* Hide desktop links, use hamburger */
    }

    .mobile-menu-toggle {
        display: flex !important;
        /* Show hamburger */
    }

    .logo {
        padding-left: 0.5rem !important;
        font-size: 1.4rem !important;
        gap: 0.75rem !important;
    }

    .logo img {
        height: 40px !important;
    }

    .main-content {
        padding: 0 1rem;
        margin: 1.5rem auto;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    table {
        min-width: 600px;
    }
}

/* Force links to stay on one line globally */
.nav-link {
    white-space: nowrap !important;
}

/* Mobile (< 768px) Specific Adjustments */
@media (max-width: 767px) {
    .logo span {
        display: none;
        /* Hide text, show only logo on very small screens */
    }

    .logo img {
        height: 50px !important;
    }

    /* Main content */
    .main-content {
        padding: 0 0.75rem;
        margin: 1rem auto;
    }

    /* Hero section */
    .hero-section {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .hero-section h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }

    .hero-section p {
        font-size: 0.95rem !important;
    }

    /* Buttons */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem !important;
    }

    /* Page headers */
    .page-header {
        margin-bottom: 2rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1.25rem !important;
    }

    .page-title {
        font-size: 2rem !important;
        line-height: 1.1 !important;
        width: 100%;
    }
}

/* Small mobile (< 576px) */
@media (max-width: 575px) {
    .navbar {
        padding: 0.75rem;
    }

    .logo {
        font-size: 1.25rem !important;
    }

    .logo img {
        height: 40px !important;
    }
}

/* Extra small mobile (< 400px) */
@media (max-width: 399px) {
    .logo span {
        font-size: 1.1rem !important;
    }

    .btn {
        font-size: 0.9rem !important;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 0.5rem 1rem;
    }
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .nav-link,
    a.btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Autocomplete Dropdown Styles */
.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.autocomplete-item {
    padding: 0.75rem 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.autocomplete-item:hover {
    background: var(--nav-hover);
    color: var(--primary-color);
}