/* ==========================================================================
   StayNomix – Responsive Stylesheet
   Covers: Mobile (<576px), Tablet (576–991px), Desktop (992px+)
   ========================================================================== */

/* ── 1. MOBILE NAV DRAWER ──────────────────────────────────────────────── */
.mobile-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.mobile-drawer.open {
    display: block;
}

.mobile-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
}

.mobile-drawer-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: #fff;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-drawer.open .mobile-drawer-panel {
    transform: translateX(0);
}

.mobile-drawer-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    align-self: flex-end;
    margin-bottom: 1rem;
}

.mobile-drawer-panel a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
    transition: background 0.2s;
}

.mobile-drawer-panel a:hover {
    background: var(--bg-main);
    color: var(--primary-dark);
}

.mobile-drawer-panel .drawer-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.75rem 0;
}

.mobile-drawer-panel .drawer-auth {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── 2. FRONTEND NAVBAR ────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .nav-links,
    .nav-auth {
        display: none !important;
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        background: var(--bg-main);
    }

    .logo {
        font-size: 1.2rem;
    }
}

/* ── 3. HERO SECTION ───────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .hero {
        padding: 3rem 0 4rem;
        min-height: 50vh;
    }

    .hero-title {
        font-size: clamp(1.75rem, 7vw, 2.5rem);
        margin-bottom: 1.25rem;
    }
}

/* ── 4. SEARCH PILL ────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .search-pill-container {
        border-radius: 16px;
        padding: 1rem;
    }

    .search-pill-form {
        flex-direction: column;
    }

    .search-segment {
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
        padding: 0.875rem 0.5rem;
        width: 100%;
    }

    .search-segment:last-of-type {
        border-bottom: none;
    }

    .search-submit {
        width: 100%;
        border-radius: var(--radius-pill);
        height: 48px;
        margin-top: 0.75rem;
        margin-left: 0;
    }
}

/* ── 5. HOTEL CARDS GRID ───────────────────────────────────────────────── */
@media (max-width: 575px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── 6. SEARCH RESULTS LAYOUT ──────────────────────────────────────────── */
@media (max-width: 899px) {
    .layout-sidebar {
        grid-template-columns: 1fr;
    }

    .layout-sidebar-right {
        grid-template-columns: 1fr;
    }

    .filters-sidebar {
        display: none;
    }

    .filters-sidebar.mobile-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: white;
        overflow-y: auto;
        padding: 1.5rem;
    }
}

/* ── 7. HOTEL DETAIL PAGE ──────────────────────────────────────────────── */
@media (max-width: 899px) {
    .booking-sidebar {
        position: static;
        top: auto;
    }

    .booking-summary {
        position: static;
        top: auto;
    }
}

@media (max-width: 767px) {
    /* Image gallery thumbnails wrap properly */
    .gallery-thumbs {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
}

/* ── 8. BOOKING CREATE PAGE ────────────────────────────────────────────── */
@media (max-width: 767px) {
    .booking-form-layout {
        flex-direction: column !important;
    }

    .booking-form-layout > * {
        width: 100% !important;
    }
}

/* ── 9. FOOTER ─────────────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .footer .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

/* ── 10. ADMIN LAYOUT ──────────────────────────────────────────────────── */
/* Sidebar positioning & open state handled inline in layouts/admin.blade.php */
/* These are supplementary overrides for any inline-style conflicts */
@media (max-width: 991px) {
    /* Legacy fallback: support .show if old templates still use it */
    .admin-sidebar.show,
    .admin-sidebar.is-open {
        transform: translateX(0) !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.25) !important;
    }

    .admin-sidebar-overlay.show {
        display: block !important;
    }
}


/* ── 11. ADMIN STAT CARDS & DASHBOARD GRID ─────────────────────────────── */
@media (max-width: 991px) {
    /* Dashboard 2fr/1fr grid → 1 col on tablet & mobile */
    .dashboard-main-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 767px) {
    /* Admin dashboard 4-col stat grid → 2 col */
    .admin-content .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.875rem;
    }
}

@media (max-width: 575px) {
    .admin-content .grid-4 {
        grid-template-columns: 1fr !important;
    }
}

/* ── 12. ADMIN BOOKINGS STATS ──────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Inline booking stats row */
    div[style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 479px) {
    div[style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── 13. ADMIN TABLES ──────────────────────────────────────────────────── */
/* Tables scroll on all non-desktop widths (sidebar hidden ≤991px) */
@media (max-width: 991px) {
    .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 560px;
    }
}

@media (max-width: 767px) {
    /* Compact table cells on mobile */
    .table th,
    .table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

/* ── 14. ADMIN HOTEL FORM ──────────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Two column form grids inside admin → single col */
    .admin-form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Room type cards stack */
    .room-cards-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── 15. ADMIN FILTERS / SEARCH BARS ──────────────────────────────────── */
@media (max-width: 767px) {
    /* Filter forms stack vertically */
    .admin-content form[method="GET"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .admin-content form[method="GET"] input,
    .admin-content form[method="GET"] select,
    .admin-content form[method="GET"] button,
    .admin-content form[method="GET"] a.btn {
        width: 100% !important;
        min-width: unset !important;
        flex: unset !important;
    }
}

/* ── 16. ADMIN CONTENT PADDING ─────────────────────────────────────────── */
@media (max-width: 767px) {
    .admin-content {
        padding: 1rem;
    }

    .admin-header {
        padding: 0 1rem;
    }
}

@media (max-width: 479px) {
    .admin-content {
        padding: 0.75rem;
    }

    .admin-header {
        padding: 0 0.75rem;
    }
}

/* ── 17. BOOKING CONFIRMATION ──────────────────────────────────────────── */
@media (max-width: 767px) {
    .confirmation-grid {
        grid-template-columns: 1fr !important;
    }

    .confirmation-qr {
        text-align: center;
        margin: 0 auto;
    }
}

/* ── 18. ACCOUNT PAGES ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .account-layout {
        flex-direction: column !important;
    }

    .account-sidebar {
        width: 100% !important;
    }

    .account-booking-card {
        flex-direction: column !important;
    }

    .account-booking-card img {
        width: 100% !important;
        height: 180px !important;
        object-fit: cover;
    }
}

/* ── 19. MISC UTILITIES ────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }

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

    /* Text size adjustments */
    h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
    h2 { font-size: clamp(1.25rem, 5vw, 1.75rem); }
    h3 { font-size: clamp(1rem, 4vw, 1.375rem); }

    .section {
        padding: 2.5rem 0;
    }
}

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

/* Ensure images never overflow on any device */
img {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal overflow globally */
html, body {
    overflow-x: clip;
    max-width: 100%;
}

/* Touch-friendly tap targets */
@media (max-width: 767px) {
    .btn, button, a.btn {
        min-height: 44px;
        min-width: 44px;
    }

    select, input[type="text"], input[type="email"],
    input[type="password"], input[type="number"],
    input[type="date"], textarea {
        font-size: 16px; /* prevent iOS auto-zoom */
        min-height: 26px;
    }
    .premium-input-box{
        padding: 8px !important;
    }

    /* 1. Global Footer Column Stacking */
    .footer .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center;
    }
    .footer .opacity-0 {
        opacity: 1 !important;
        transform: none !important;
    }
    .footer-bottom {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1.5rem !important;
    }

    /* 2. Homepage Hero Search Widget Alignment & Centering */
    .search-floating-widget {
        transform: none !important;
        animation: none !important;
    }
    .search-hero-btn {
        width: 100% !important;
        justify-content: center !important;
        margin-left: 0 !important;
        margin-top: 1rem !important;
    }
    
    #city-autocomplete-dropdown {
        width: calc(100vw - 32px) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 380px !important;
    }

    .SearchBarDesktop-popup-a860,
    #mw-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -48%) !important;
        width: calc(100vw - 32px) !important;
        max-width: 440px !important;
        padding: 15px !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
        z-index: 99999 !important;
        box-sizing: border-box !important;
    }

    .SearchBarDesktop-popup-a860.is-open,
    #mw-dropdown.is-open {
        transform: translate(-50%, -50%) !important;
    }

    .slider-split-row {
        flex-direction: column !important;
        gap: 12px !important;
    }

    #slider-date-tabs {
        flex-direction: row !important;
    }

    .range-slider-wrapper {
        margin: 5px 0 25px 0 !important;
    }

    /* 3. Browse Hotels Top Search Strip Form Wrapping */
    .strip-form {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    .strip-seg {
        width: 100% !important;
        border: 1.5px solid #e2e8f0 !important;
        border-radius: 12px !important;
        background-color: #f8fafc !important;
        padding: 0.6rem 1rem !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        box-sizing: border-box !important;
        transition: all 0.2s ease !important;
    }
    .strip-seg:focus-within {
        border-color: var(--primary-color, #1EBEA5) !important;
        background-color: #ffffff !important;
        box-shadow: 0 0 0 3px rgba(30, 190, 165, 0.15) !important;
    }
    #mw-widget-container.strip-seg {
        padding: 0 !important;
    }
    .strip-input {
        flex: 1 !important;
        min-width: 0 !important;
        width: auto !important;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
    }
    .strip-divider {
        display: none !important;
    }
    .strip-btn {
        width: 100% !important;
        text-align: center !important;
    }

    .mw-portal-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -48%) !important;
        width: calc(100vw - 32px) !important;
        max-width: 440px !important;
        padding: 15px !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
        z-index: 99999 !important;
        box-sizing: border-box !important;
    }

    .mw-portal-dropdown.is-open {
        transform: translate(-50%, -50%) !important;
    }

    /* 4. Search Results Hotel Cards Stacking */
    .result-card {
        flex-direction: column !important;
    }
    .result-img {
        width: 100% !important;
        height: 200px !important;
    }
    .result-body {
        flex-direction: column !important;
    }
    .result-price-col {
        width: 100% !important;
        border-left: none !important;
        border-top: 1.5px solid #eee !important;
        background: #f8fafc !important;
        padding: 1rem !important;
        text-align: left !important;
        align-items: stretch !important;
    }
    .result-price-col div {
        text-align: left !important;
    }
    .result-price-col .rpc-price {
        text-align: left !important;
    }

    /* 5. Partner Page & Contact Page & General Grids Stack */
    #partner-form form > div[style*="display: grid"],
    .container form > div[style*="display: grid"],
    #bookingForm .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    #partner-form div[style*="padding: 3rem"],
    .container div[style*="padding: 2.5rem"],
    #partner-form div[style*="background: white"],
    .container div[style*="background: white"],
    .bg-white.p-4 {
        padding: 1.5rem !important;
    }

    .container > div[style*="grid-template-columns: 1fr 1.5fr"],
    .container > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .container h1[style*="font-size: 4rem"] {
        font-size: 2.25rem !important;
        line-height: 1.2 !important;
    }
    .container h1[style*="font-size: 3rem"] {
        font-size: 1.85rem !important;
    }
    .container h1[style*="font-size: 2.8rem"] {
        font-size: 1.85rem !important;
    }
    .container h2[style*="font-size: 2.5rem"],
    .container h2[style*="font-size: 2.6rem"] {
        font-size: 1.6rem !important;
    }
    .container h2[style*="font-size: 2.4rem"] {
        font-size: 1.5rem !important;
    }
    .container h2[style*="font-size: 2.25rem"] {
        font-size: 1.45rem !important;
    }
    p[style*="font-size: 1.25rem"] {
        font-size: 1.05rem !important;
    }

    section[style*="padding: 8rem 0 6rem"],
    section[style*="padding: 6rem 0"] {
        padding: 3.5rem 0 !important;
    }
    .container div[style*="grid-template-columns: 1.25fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        padding: 1.5rem !important;
    }

    .container[style*="max-width: 600px"] {
        padding: 0 1rem !important;
    }

    /* 6. Booking Creation Page Stacking */
    .layout-sidebar-right {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    .booking-summary {
        position: static !important;
        margin-top: 1rem !important;
    }
}
