/* ============================================================
   mobile.css — global mobile improvements
   RULE: every rule must live inside a @media query.
   This file makes zero changes to the desktop experience.
   ============================================================ */

/* ---- Touch targets ---- */
@media (pointer: coarse) {
    .btn,
    .dropdown-item,
    .nav-link,
    .drop-down-link,
    button,
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    input[type="text"],
    input[type="number"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* prevents iOS auto-zoom */
    }

    /* Stop table horizontal scroll from triggering browser back gesture */
    .table-responsive,
    .dataTables_scrollBody {
        overscroll-behavior-x: contain;
    }
}

/* ---- Screens up to 768px ---- */
@media (max-width: 768px) {
    /* Table font: slightly larger than the desktop 10px */
    .table-sm {
        font-size: 12px;
    }

    /* Controls panel stacks vertically */
    .controls-panel {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .controls-panel > *,
    .controls-panel .form-group,
    .controls-panel .btn {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* DataTables length/filter positioning */
    .dataTables_length {
        margin-left: 0 !important;
        margin-bottom: 8px;
    }

    /* Card headers padding */
    .card-header {
        padding: 0.5rem 0.75rem;
    }

    /* Page header spacing */
    .h3.text-gray-800 {
        font-size: 1.2rem;
    }
}

/* ---- Screens up to 576px ---- */
@media (max-width: 576px) {
    /* Container: remove horizontal padding to maximise screen use */
    #wraper .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Card body: reduce padding */
    .card-body {
        padding: 0.5rem;
    }

    /* Hide exchange rate on tiny screens — it's not actionable */
    #exchange {
        display: none !important;
    }

    /* Make the DataTables scrollable wrapper use the full width */
    .dataTables_wrapper {
        overflow-x: auto;
    }
}

/* ---- Mobile drawer — hidden by default on all screen sizes ---- */
#mobile-drawer,
#mobile-drawer-backdrop {
    display: none;
}

@media (max-width: 1250px) {
    #mobile-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    #mobile-drawer-backdrop.open {
        opacity: 1;
        pointer-events: all;
    }

    #mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(80vw, 320px);
        background: #fff;
        z-index: 1050;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
    }

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

    .mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        border-bottom: 1px solid #e3e6f0;
        background: #f8f9fc;
        flex-shrink: 0;
    }

    .mobile-drawer-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        line-height: 1;
        color: #6c757d;
        padding: 4px 8px;
        cursor: pointer;
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-drawer-nav {
        flex: 1;
        padding: 8px 0;
        overflow-y: auto;
    }

    .mobile-drawer-section {
        margin-bottom: 4px;
    }

    .mobile-drawer-section-title {
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #858796;
        padding: 10px 20px 4px;
    }

    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 20px;
        color: #5a5c69;
        text-decoration: none;
        font-size: 14px;
        min-height: 44px;
        transition: background 0.15s;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
        cursor: pointer;
    }

    .mobile-menu-item:hover,
    .mobile-menu-item:active {
        background: #f8f9fc;
        color: #4e73df;
        text-decoration: none;
    }

    .mobile-menu-item i {
        width: 18px;
        text-align: center;
        color: #4e73df;
        flex-shrink: 0;
    }

    .mobile-drawer-divider {
        border-top: 1px solid #e3e6f0;
        margin: 6px 0;
    }

    /* Highlight the "Mobile" sections */
    .mobile-menu-item.mobile-highlight {
        color: #4e73df;
        font-weight: 600;
    }
}
