/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Base responsive adjustments for all viewports */
* {
    box-sizing: border-box;
}

/* ============================================
   TABLET & MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

    /* --- SIDEBAR & NAVIGATION --- */
    .vertical-nav#sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1050;
        height: 100vh;
        overflow-y: auto;
        width: 280px !important;
    }

    .vertical-nav#sidebar.active {
        left: 0;
    }

    .page-content#content {
        width: 100% !important;
        padding: 15px !important;
        margin-left: 0 !important;
    }

    /* Hide desktop toggle button on mobile */
    #sidebarCollapse {
        display: none !important;
    }

    /* Hamburger menu button */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1051;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px 14px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .mobile-menu-toggle i {
        font-size: 22px;
        color: #333;
    }

    /* Overlay when menu is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1049;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* --- FORMS --- */
    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .form-control,
    .form-control-lg,
    select.form-control,
    textarea.form-control {
        font-size: 16px !important;
        /* Prevent iOS zoom */
        min-height: 44px;
        /* Touch-friendly */
    }

    /* --- BUTTONS --- */
    .btn {
        min-height: 44px;
        min-width: 44px;
        font-size: 14px;
        padding: 10px 16px;
    }

    .btn-sm {
        min-height: 38px;
        padding: 8px 12px;
    }

    .btn-block {
        width: 100%;
        margin-bottom: 10px;
    }

    /* --- TABLES --- */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 13px;
        min-width: 600px;
        /* Force horizontal scroll for wide tables */
    }

    .table th,
    .table td {
        padding: 8px 6px;
        white-space: nowrap;
    }

    /* --- CARDS --- */
    .card {
        margin-bottom: 15px;
    }

    .card-body {
        padding: 15px;
    }

    /* --- MODALS --- */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-lg {
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        padding: 15px;
    }

    /* --- ALERTS --- */
    .alert {
        font-size: 14px;
        padding: 10px 15px;
    }

    /* --- TYPOGRAPHY --- */
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 22px;
    }

    h3 {
        font-size: 20px;
    }

    h4 {
        font-size: 18px;
    }

    h5 {
        font-size: 16px;
    }

    h6 {
        font-size: 14px;
    }

    /* --- UTILITY TOTAL (DASHBOARD) --- */
    .row.mb-4 .col-md-4,
    .row.mb-4 .col-md-6,
    .row.mb-4 .col-md-12 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        margin-bottom: 15px;
    }

    /* Chart container */
    canvas {
        max-height: 300px !important;
    }

    /* --- POS FORM SPECIFIC --- */
    #ventas table {
        font-size: 12px;
    }

    #ventas table th,
    #ventas table td {
        padding: 6px 4px;
    }

    #sumaTotal {
        font-size: 32px;
    }

    /* --- INPUT GROUPS --- */
    .input-group {
        flex-wrap: nowrap;
    }

    .input-group .form-control {
        min-width: 0;
    }

    /* --- PAGINATION --- */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .page-item {
        margin: 2px;
    }
}

/* ============================================
   SMALL MOBILE (max-width: 576px)
   ============================================ */
@media (max-width: 576px) {

    /* Even more compact spacing */
    #page-content-wrapper {
        padding: 10px !important;
    }

    .container,
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Smaller buttons on very small screens */
    .btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    /* Stack button groups vertically */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        border-radius: 4px !important;
        margin-bottom: 5px;
    }

    /* Smaller table text */
    .table {
        font-size: 11px;
    }

    /* Card titles */
    .card-title {
        font-size: 16px;
    }

    /* Total display */
    #sumaTotal {
        font-size: 28px;
    }
}

/* ============================================
   DESKTOP ONLY (min-width: 769px)
   ============================================ */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* ============================================
   TOUCH OPTIMIZATIONS
   ============================================ */
/* Larger touch targets */
a,
button,
.btn,
input[type="checkbox"],
input[type="radio"] {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Prevent text selection on buttons */
.btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth scrolling */
html {
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    #sidebar-wrapper,
    .mobile-menu-toggle,
    .btn,
    .pagination {
        display: none !important;
    }

    #page-content-wrapper {
        width: 100% !important;
        padding: 0 !important;
    }
}