/**
 * MOBILE PANEL STYLES
 * Universal CSS for mobile responsiveness across vendor, admin, and rider panels
 */

/* ========================================
   MOBILE MENU BUTTON
   ======================================== */

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 2001;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.mobile-menu-btn:hover {
    transform: scale(1.05);
}

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

@media (max-width: 1023px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================
   MOBILE OVERLAY
   ======================================== */

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================
   RESPONSIVE SIDEBAR - CRITICAL FIX
   ======================================== */

@media (max-width: 1023px) {

    /* Ensure sidebars are positioned correctly and hidden by default */
    .sidebar,
    .admin-sidebar,
    .rider-sidebar,
    [class$="-sidebar"] {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        height: 100vh !important;
        width: 260px !important;
        z-index: 2002 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        box-shadow: none !important;
    }

    /* Show sidebar when .mobile-open class is added */
    .sidebar.mobile-open,
    .admin-sidebar.mobile-open,
    .rider-sidebar.mobile-open,
    [class$="-sidebar"].mobile-open {
        left: 0 !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4) !important;
    }

    /* Adjust main content area */
    .main-content,
    .main-wrapper,
    body>main {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 70px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Hide sidebar wrapper if exists */
    .sidebar-wrapper {
        position: fixed !important;
        left: -280px !important;
        width: 260px !important;
        z-index: 2002 !important;
        transition: left 0.3s ease !important;
    }

    .sidebar-wrapper.mobile-open {
        left: 0 !important;
    }
}

/* ========================================
   RESPONSIVE TABLES
   ======================================== */

@media (max-width: 767px) {

    .mobile-table,
    table {
        display: block;
        width: 100%;
    }

    .mobile-table thead {
        display: none;
    }

    .mobile-table tr {
        display: block;
        margin-bottom: 15px;
        background: white;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        border: 1px solid #eee;
    }

    .mobile-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        text-align: right;
    }

    .mobile-table td:before {
        content: attr(data-label);
        font-weight: 700;
        color: #666;
        margin-right: 10px;
        text-align: left;
        flex: 1;
    }

    .mobile-table td:last-child {
        border-bottom: none;
    }
}

/* ========================================
   RESPONSIVE GRIDS
   ======================================== */

@media (max-width: 1023px) {

    .stats-grid,
    .dashboard-grid,
    [class*="-grid"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .dashboard-row,
    [class*="-row"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 767px) {

    /* Stack cards vertically */
    .stat-card,
    .content-card,
    [class*="-card"] {
        margin-bottom: 15px;
    }
}

/* ========================================
   MOBILE-FRIENDLY FORMS
   ======================================== */

@media (max-width: 767px) {

    input,
    select,
    textarea,
    button {
        font-size: 16px !important;
        /* Prevent zoom on iOS */
    }

    .form-row,
    [class*="form-row"] {
        flex-direction: column !important;
    }

    .form-row>* {
        width: 100% !important;
        margin-bottom: 15px;
    }
}

/* ========================================
   RESPONSIVE BUTTONS
   ======================================== */

@media (max-width: 767px) {

    .btn,
    button:not(.mobile-menu-btn),
    [class*="btn-"]:not(.mobile-menu-btn) {
        width: 100%;
        margin-bottom: 10px;
    }

    .btn-group {
        flex-direction: column;
    }
}

/* ========================================
   HIDE/SHOW ON MOBILE
   ======================================== */

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

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