/* ============================================================================
   MOBILE-FIRST RESPONSIVE DESIGN
   Beautiful, modern mobile experience for Ma Nox Booking System
   ============================================================================ */

/* ============================================================================
   MOBILE NAVIGATION & HAMBURGER MENU
   ============================================================================ */

/* Hamburger Menu Button - Hidden by default, shows on mobile */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    padding: 0.875rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    color: white;
    display: block;
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ============================================================================
   TABLET BREAKPOINT (768px - 1024px)
   ============================================================================ */

@media (max-width: 1024px) {
    :root {
        --sidebar-w: 240px;
    }

    .main-content {
        margin-left: calc(var(--sidebar-w) + 1.5rem);
        padding: 1.5rem;
    }

    /* Slightly smaller text */
    .page-title {
        font-size: 1.75rem;
    }

    /* Adjust grid layouts */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Tables remain readable */
    .data-table {
        font-size: 0.875rem;
    }
}

/* ============================================================================
   MOBILE BREAKPOINT (max-width: 768px) - THE REAL MAGIC ✨
   ============================================================================ */

@media (max-width: 768px) {

    /* ========================================
       SHOW MOBILE CONTROLS
       ======================================== */

    .mobile-menu-toggle {
        display: block;
    }

    .mobile-overlay {
        display: block;
    }

    /* ========================================
       SIDEBAR - SLIDE FROM LEFT
       ======================================== */

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        margin: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: none;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    }

    /* ========================================
       MAIN CONTENT - FULL WIDTH MOBILE
       ======================================== */

    body {
        padding-top: 0;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 5rem 1rem 1rem 1rem;
        width: 100%;
        max-width: 100%;
    }

    /* ========================================
       PAGE HEADERS - COMPACT & BEAUTIFUL
       ======================================== */

    .page-header {
        padding: 1.5rem 0;
        margin-bottom: 1.5rem;
        text-align: left;
        background: none;
        border: none;
    }

    .page-title {
        font-size: 1.75rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
        line-height: 1.2;
    }

    .page-subtitle {
        font-size: 0.9375rem;
        color: var(--text-secondary);
        line-height: 1.5;
    }

    /* ========================================
       SECTION HEADERS - MOBILE OPTIMIZED
       ======================================== */

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 1.25rem;
        font-weight: 600;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        font-weight: 500;
    }

    /* ========================================
       CONTENT SECTIONS - CARD STYLE
       ======================================== */

    .content-section {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* ========================================
       STATS CARDS - BEAUTIFUL MOBILE LAYOUT
       ======================================== */

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
        border-radius: 14px;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }

    .stat-card h3 {
        font-size: 2rem;
        font-weight: 700;
        margin-bottom: 0.25rem;
    }

    .stat-card p {
        font-size: 0.9375rem;
        color: var(--text-secondary);
        font-weight: 500;
    }

    /* ========================================
       TABLES - MOBILE RESPONSIVE
       ======================================== */

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    /* Default: horizontal scroll for tables on mobile */
    .data-table {
        min-width: 600px;
        font-size: 0.8125rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.8125rem;
    }

    /* Enhanced mobile card view (when JavaScript adds the class) */
    .data-table.mobile-cards {
        display: block;
        width: 100%;
        min-width: auto;
    }

    .data-table.mobile-cards thead {
        display: none;
    }

    .data-table.mobile-cards tbody {
        display: block;
    }

    .data-table.mobile-cards tr {
        display: block;
        background: white;
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        border: 1px solid rgba(0, 0, 0, 0.06);
        transition: all 0.2s ease;
    }

    .data-table.mobile-cards tr:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }

    .data-table.mobile-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.625rem 0;
        border: none;
        font-size: 0.9375rem;
    }

    .data-table.mobile-cards td:not(:last-child) {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .data-table.mobile-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.8125rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        margin-right: 1rem;
    }

    .data-table.mobile-cards td:last-child {
        padding-top: 1rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        justify-content: center;
    }

    .data-table.mobile-cards td:last-child::before {
        display: none;
    }

    /* Action buttons in mobile cards */
    .data-table.mobile-cards td button,
    .data-table.mobile-cards td .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        border-radius: 8px;
        min-height: 36px;
    }

    .data-table.mobile-cards td .btn + .btn {
        margin-left: 0.5rem;
    }

    /* ========================================
       FORMS - MOBILE OPTIMIZED
       ======================================== */

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group label {
        font-size: 0.9375rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: var(--text-primary);
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="tel"],
    select,
    textarea {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 16px !important; /* Prevents iOS zoom */
        border-radius: 10px;
        border: 1.5px solid rgba(0, 0, 0, 0.1);
        background: white;
        transition: all 0.2s ease;
    }

    input:focus,
    select:focus,
    textarea:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
        outline: none;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        width: 100%;
    }

    /* ========================================
       BUTTONS - MOBILE FRIENDLY
       ======================================== */

    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
        font-weight: 600;
        border-radius: 10px;
        min-height: 44px;
        transition: all 0.2s ease;
    }

    .btn:active {
        transform: scale(0.96);
    }

    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin: 0;
    }

    /* ========================================
       MODALS - FULL SCREEN ON MOBILE
       ======================================== */

    .modal {
        padding: 0;
    }

    .modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 1.25rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        flex-shrink: 0;
    }

    .modal-header h2,
    .modal-header h3 {
        font-size: 1.375rem;
        font-weight: 700;
    }

    .modal-body {
        padding: 1.25rem;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        padding: 1.25rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        flex-direction: column-reverse;
        gap: 0.75rem;
        flex-shrink: 0;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }

    .close-modal {
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ========================================
       FILTERS - MOBILE STACK
       ======================================== */

    .filter-section {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
        border-radius: 12px;
    }

    .modern-filter-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filter-buttons {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .filter-buttons .btn {
        width: 100%;
    }

    /* ========================================
       TABS - HORIZONTAL SCROLL
       ======================================== */

    .tabs {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding-bottom: 4px;
        margin-bottom: 1.25rem;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        flex-shrink: 0;
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
        font-weight: 600;
        border-radius: 10px;
        min-width: auto;
        white-space: nowrap;
    }

    /* ========================================
       BULK ACTIONS - MOBILE BAR
       ======================================== */

    .bulk-actions-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 1rem;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 100;
        display: flex;
        gap: 0.75rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .bulk-actions-bar .btn {
        flex: 1;
        padding: 0.875rem;
        font-size: 0.875rem;
    }

    /* ========================================
       PRICING CARDS - MOBILE OPTIMIZED
       ======================================== */

    .pricing-card {
        margin-bottom: 1.25rem;
        border-radius: 14px;
    }

    .pricing-card-header {
        padding: 1.25rem;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .pricing-card-header h3 {
        font-size: 1.25rem;
    }

    .pricing-card-header .btn {
        width: 100%;
    }

    /* ========================================
       TOUR CARDS - MOBILE LAYOUT
       ======================================== */

    .tour-card {
        margin-bottom: 1.25rem;
        border-radius: 14px;
    }

    .tour-header {
        padding: 1.25rem;
    }

    .tour-header h3 {
        font-size: 1.25rem;
        font-weight: 700;
    }

    .tour-body {
        padding: 1.25rem;
    }

    /* ========================================
       BADGES - MOBILE SIZED
       ======================================== */

    .badge {
        font-size: 0.8125rem;
        padding: 0.375rem 0.75rem;
        border-radius: 6px;
        font-weight: 600;
    }

    /* ========================================
       PAGINATION - MOBILE FRIENDLY
       ======================================== */

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        padding: 1rem 0;
    }

    .pagination button {
        min-width: 40px;
        height: 40px;
        padding: 0.5rem;
        font-size: 0.9375rem;
        border-radius: 8px;
    }

    /* Hide page numbers on small mobile, keep only prev/next */
    .pagination button:not(:first-child):not(:last-child):not(.active) {
        display: none;
    }

    /* ========================================
       CALENDAR - MOBILE OPTIMIZED
       ======================================== */

    .calendar-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .calendar-controls {
        width: 100%;
        justify-content: space-between;
    }

    .calendar-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1.25rem;
        padding: 0 1.25rem;
    }

    .calendar-grid {
        min-width: 500px;
        font-size: 0.8125rem;
    }

    /* ========================================
       SIDEBAR - MOBILE STYLED
       ======================================== */

    .sidebar-logo {
        padding: 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-user {
        padding: 1rem 1.25rem;
    }

    .user-info-compact {
        gap: 0.75rem;
    }

    .user-name {
        font-size: 0.9375rem;
    }

    .user-role {
        font-size: 0.8125rem;
    }

    .sidebar-nav {
        padding: 0.5rem 0;
    }

    .nav-item {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        margin: 0.25rem 0.75rem;
        border-radius: 10px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* ========================================
       BULK ACTIONS - MOBILE POSITIONING
       ======================================== */

    .bulk-actions-compact {
        position: relative;
        flex-shrink: 0;
    }

    /* Ensure hidden class works on mobile */
    .bulk-actions-compact.u-hidden {
        display: none !important;
    }

    .modern-section-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        flex-wrap: nowrap;
    }

    .modern-section-header .modern-section-title {
        flex: 1;
        min-width: 0;
    }

    /* ========================================
       UTILITY ADJUSTMENTS
       ======================================== */

    /* Hide desktop-only elements */
    .hide-mobile {
        display: none !important;
    }

    /* Show mobile-only elements */
    .show-mobile {
        display: block !important;
    }

    /* Full width on mobile */
    .full-width-mobile {
        width: 100% !important;
    }

    /* Center text on mobile */
    .text-center-mobile {
        text-align: center !important;
    }
}

/* ============================================================================
   SMALL MOBILE (max-width: 480px) - EXTRA COMPACT
   ============================================================================ */

@media (max-width: 480px) {

    .main-content {
        padding: 4.5rem 0.75rem 1rem 0.75rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .page-subtitle {
        font-size: 0.875rem;
    }

    .content-section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .section-title {
        font-size: 1.125rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 1.75rem;
    }

    .data-table.mobile-cards tr {
        padding: 0.875rem;
    }

    .data-table.mobile-cards td {
        font-size: 0.875rem;
        padding: 0.5rem 0;
    }

    .data-table.mobile-cards td::before {
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }

    .sidebar {
        width: 260px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .calendar-grid {
        min-width: 400px;
        font-size: 0.75rem;
    }
}

/* ============================================================================
   LANDSCAPE ORIENTATION
   ============================================================================ */

@media (max-height: 600px) and (orientation: landscape) {

    .sidebar {
        overflow-y: auto;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-body {
        max-height: 70vh;
    }

    .main-content {
        padding-top: 3.5rem;
    }
}

/* ============================================================================
   TOUCH DEVICE ENHANCEMENTS
   ============================================================================ */

@media (hover: none) and (pointer: coarse) {

    /* Increase all touch targets */
    button,
    .btn,
    .nav-item,
    .tab-button,
    a {
        min-height: 44px;
    }

    /* Remove hover effects, add active states */
    .btn:hover,
    .nav-item:hover {
        transform: none;
    }

    .btn:active,
    .nav-item:active {
        opacity: 0.8;
    }

    /* Larger form inputs */
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 22px;
        min-height: 22px;
    }

    /* Better tap spacing */
    .data-table.mobile-cards td button {
        margin: 0.25rem;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .mobile-menu-toggle,
    .mobile-overlay,
    .sidebar,
    .btn,
    .bulk-actions-bar {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}
