/* FxPOS Mobile Responsive Improvements */

/* GLOBAL STYLES (Apply to Desktop and Mobile) */
/* Category Horizontal Scroll */
.category-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 5px 2px 15px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
.category-scroll-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}
.category-pill {
    flex: 0 0 auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.category-pill.active {
    background: transparent;
    color: #ea580c;
    border-color: #ea580c;
    background-color: #fff7ed;
}

/* App Search Bar */
.app-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 25px;
    padding: 5px 15px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}
.app-search-bar .search-icon {
    color: #9ca3af;
    margin-right: 10px;
    font-size: 16px;
}
.app-search-bar .form-control {
    border: none !important;
    background: transparent !important;
    padding: 8px 0;
    font-size: 14px;
    box-shadow: none !important;
}
.app-search-bar .form-control:focus {
    box-shadow: none !important;
}

/* Product Box Global */
.product_box {
    background: #ffffff !important;
    border-radius: 20px !important;
    padding: 8px !important;
    border: 2px solid transparent !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important;
    position: relative;
    overflow: visible !important;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.product_box:active {
    border-color: #ea580c !important;
    transform: scale(0.98);
}
.product_box .text_div {
    padding: 8px 4px 0 4px !important;
    text-align: left !important;
    background: transparent !important;
}
.product_box .text_div .text-muted {
    font-size: 11px;
    color: #9ca3af !important;
}
.product_box::after {
    content: '+';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #ea580c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(234, 88, 12, 0.3);
    transition: all 0.2s ease;
}

/* Base Mobile Styles */
@media (max-width: 768px) {
    /* Body and Layout */
    body {
        font-size: 14px;
        line-height: 1.4;
    }
    
    /* Dynamic Island UI */
    .main-header, #navbarBlur, #sidenav-main, .sidenav, .mobile-nav-toggle {
        display: none !important;
    }

    #dynamic-island {
        position: fixed;
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
        min-width: 160px;
        height: 44px;
        background: linear-gradient(310deg, #141727 0%, #3a416f 100%);
        border: none;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-radius: 22px;
        z-index: 105000 !important;
        display: flex;
        flex-direction: column;
        overflow: visible;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
        transition: all 0.5s cubic-bezier(0.32, 0.72, 0, 1);
        color: #fff;
    }

    .di-compact {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        height: 44px;
        padding: 0 15px;
        transition: opacity 0.3s;
        cursor: pointer;
    }

    .di-compact .di-icon {
        color: #fff;
        font-size: 16px;
    }
    
    .di-compact .di-title {
        font-weight: 600;
        font-size: 14px;
    }

    #dynamic-island.expanded {
        width: 90vw;
        height: 80vh;
        border-radius: 30px;
        top: 20px;
        padding: 20px 0;
    }

    #dynamic-island.expanded .di-compact,
    #pos-dynamic-island.expanded .di-compact {
        opacity: 0;
        pointer-events: none;
        position: absolute;
    }

    .di-expanded {
        display: none;
        opacity: 0;
        width: 100%;
        height: 100%;
        flex-direction: column;
    }

    #dynamic-island.expanded .di-expanded,
    #pos-dynamic-island.expanded .di-expanded {
        display: flex;
        animation: fadeInDI 0.4s 0.2s forwards;
    }

    @keyframes fadeInDI {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .di-expanded-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding: 0 20px 15px 20px;
    }

    .di-close-btn {
        background: rgba(255,255,255,0.2);
        border: none;
        color: #fff;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .di-menu-container {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-right: 5px;
    }

    /* Style the cloned navbar-nav inside DI */
    .di-menu-container .navbar-nav {
        flex-direction: column !important;
        padding-left: 0;
        margin-bottom: 0;
        list-style: none;
    }

    .di-menu-container .nav-item {
        margin-bottom: 5px;
        width: 100%;
    }

    .di-menu-container .nav-link {
        color: #fff !important;
        font-size: 15px;
        font-weight: 400;
        display: flex;
        align-items: center;
        text-decoration: none;
        padding: 12px 20px;
        border-radius: 0 24px 24px 0;
        background: transparent;
        border: none;
        box-shadow: none;
        transition: all 0.2s ease;
        margin-right: 15px;
    }

    .di-menu-container .nav-link[aria-expanded="true"],
    .di-menu-container .nav-link:active,
    .di-menu-container .nav-link.active {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .di-menu-container .nav-link i, .di-menu-container .nav-link .icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border-radius: 0;
        margin-right: 20px;
        font-size: 18px;
        color: #fff !important;
        box-shadow: none;
    }
    
    .di-menu-container .nav-link .nav-link-text {
        color: #fff !important;
        font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    }

    /* Strip glass block from Soft UI icons */
    .di-menu-container .icon-container {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        width: 24px !important;
        height: 24px !important;
        margin-right: 15px !important;
    }
    .di-menu-container .icon-container::before {
        display: none !important;
    }
    .di-menu-container .icon-container svg {
        width: 20px !important;
        height: 20px !important;
        fill: none !important;
        stroke: #fff !important;
        filter: none !important;
    }

    /* Hide existing carets */
    .di-menu-container .nav-link::after {
        display: none !important;
    }
    .di-menu-container .nav-link i.pull-right,
    .di-menu-container .nav-link i.fa-angle-left,
    .di-menu-container .nav-link i.fa-angle-down,
    .di-menu-container .nav-link i.fa-chevron-down {
        display: none !important;
    }

    /* Add Minimalist Carets for Dropdowns */
    .di-menu-container .nav-link[data-bs-toggle="collapse"]::after,
    .di-menu-container .nav-link[data-toggle="collapse"]::after {
        content: '\f105' !important;
        font-family: 'Font Awesome 5 Free' !important;
        font-weight: 900 !important;
        display: inline-block !important;
        margin-left: auto !important;
        font-size: 14px !important;
        color: rgba(255, 255, 255, 0.7) !important;
        transition: transform 0.3s ease !important;
    }

    /* Expanded Caret */
    .di-menu-container .nav-link[aria-expanded="true"]::after {
        content: '\f106' !important;
        color: #fff !important;
    }

    /* Sub item Carets (always right) */
    .di-menu-container .collapse .nav-link::after {
        content: '\f105' !important;
        font-family: 'Font Awesome 5 Free' !important;
        font-weight: 900 !important;
        display: inline-block !important;
        margin-left: auto !important;
        font-size: 12px !important;
        color: rgba(255, 255, 255, 0.7) !important;
    }

    .di-menu-container .collapse {
        background: transparent;
        border-radius: 0;
        margin-top: 5px;
        padding: 0;
        position: relative;
    }
    
    .di-menu-container .collapse::before {
        content: '';
        position: absolute;
        left: 31px;
        top: 0;
        bottom: 10px;
        width: 1px;
        background: rgba(255, 255, 255, 0.2);
    }

    .di-menu-container .collapse .nav-link {
        background: transparent;
        padding: 10px 15px 10px 60px;
        font-size: 14px;
        border-radius: 24px;
        margin-left: 15px;
    }
    
    .di-menu-container .collapse .nav-link:active,
    .di-menu-container .collapse .nav-link.active {
        background: rgba(255, 255, 255, 0.1);
    }

    .di-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 104990;
        display: none;
        opacity: 0;
        transition: all 0.4s ease;
    }
    .di-overlay.show {
        display: block;
        opacity: 1;
    }



    /* App Product Card */
    .product_list {
        padding: 0 8px;
        margin-bottom: 16px;
        width: 50% !important;
        flex: 0 0 50% !important;
    }
    .product_box {
        background: #ffffff !important;
        border-radius: 20px !important;
        padding: 8px !important;
        border: 2px solid transparent !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important;
        position: relative;
        overflow: visible !important;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    .product_box .image-container {
        border-radius: 15px !important;
        height: 120px !important;
        margin-bottom: 8px;
    }
    .product_box .text_div {
        text-align: left !important;
        padding: 0 4px;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }
    .product_box .text_div .text {
        font-weight: 700;
        color: #1f2937 !important;
        font-size: 14px;
        line-height: 1.2;
        margin-bottom: 5px;
        display: block;
    }
    .product_box .text_div .text-muted {
        color: #4b5563 !important;
        font-size: 13px;
        font-weight: 600;
    }
    
    /* App-style Orange Add Button */
    .product_box::after {
        content: '+';
        position: absolute;
        bottom: 5px;
        right: 5px;
        width: 32px;
        height: 32px;
        background: #ea580c;
        color: #fff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        font-weight: 400;
        box-shadow: 0 4px 10px rgba(234, 88, 12, 0.3);
        z-index: 5;
        transition: all 0.2s ease;
    }
    
    /* Active/Selected State */
    .product_box:active {
        border-color: #ea580c !important;
        transform: scale(0.98);
    }
    .product_box:active::after {
        background: #c2410c;
        transform: scale(0.9);
    }

    /* Cart Table Mobile Override */
    .pos_product_div {
        margin-top: 15px;
    }
    #pos_table {
        display: block !important;
        width: 100% !important;
        min-width: unset !important;
        background: transparent !important;
        border: none !important;
    }
    #pos_table thead {
        display: none !important;
    }
    #pos_table tbody {
        display: block !important;
        width: 100% !important;
    }
    #pos_table tbody tr {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: #ffffff !important;
        border-radius: 15px !important;
        padding: 10px 10px !important;
        margin-bottom: 12px !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important;
        border: 1px solid #f3f4f6 !important;
        position: relative;
        gap: 5px !important;
    }
    
    /* Hide ALL tds by default, we'll selectively show the ones we need */
    #pos_table tbody td {
        display: none !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }
    
    /* Product Name TD */
    #pos_table tbody td:has(.product_type) {
        display: block !important;
        width: 35% !important;
        font-weight: 700;
        color: #1f2937;
        font-size: 14px;
        padding-right: 0 !important;
        margin-bottom: 0 !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Quantity TD */
    #pos_table tbody td:has(.pos_quantity) {
        display: block !important;
        width: auto !important;
    }
    #pos_table tbody td:has(.pos_quantity) .input-group {
        width: 90px !important;
    }
    #pos_table tbody td:has(.pos_quantity) input {
        border-radius: 20px !important;
        text-align: center;
        height: 28px;
        font-weight: 600;
        padding: 0;
    }
    #pos_table tbody td:has(.pos_quantity) .input-group-btn .btn {
        border-radius: 50% !important;
        width: 28px;
        height: 28px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff7ed !important;
        color: #ea580c !important;
        border: 1px solid #ffedd5 !important;
    }
    
    /* Subtotal TD */
    #pos_table tbody td:has(.pos_line_total) {
        display: block !important;
        width: auto !important;
        position: static !important;
        font-weight: 700;
        color: #ea580c;
        font-size: 14px;
    }
    
    /* Remove Button TD */
    #pos_table tbody td:has(.pos_remove_row) {
        display: block !important;
        width: auto !important;
        position: static !important;
        padding: 0 !important;
    }
    #pos_table tbody td:has(.pos_remove_row) i {
        color: #dc2626;
        background: #fee2e2;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        cursor: pointer;
    }

    /* Pill Form Controls for mobile */
    .pos-page .form-control, 
    .pos-page .select2-container--default .select2-selection--single {
        border-radius: 20px !important;
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
        min-height: 42px;
        display: flex;
        align-items: center;
        background-color: #ffffff !important;
    }
    
    /* Input Groups as cohesive pills */
    .pos-page .input-group {
        border-radius: 20px !important;
        border: 1px solid #e5e7eb !important;
        background: #ffffff !important;
        display: flex !important;
        align-items: stretch !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.02);
        overflow: visible !important;
    }
    .pos-page .input-group .input-group-addon {
        border: none !important;
        background: transparent !important;
        color: #6b7280;
        padding: 10px 15px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        border-right: 1px solid transparent !important; /* override default */
    }
    .pos-page .input-group .form-control,
    .pos-page .input-group .select2-container,
    .pos-page .input-group .select2-selection {
        border: none !important;
        background: transparent !important;
        flex-grow: 1;
        width: 100% !important;
    }
    
    /* Ensure select2 text is aligned inside the pill */
    .pos-page .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 42px;
        padding-left: 0;
        color: #4b5563;
    }
    .pos-page .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 40px;
    }
    
    /* Form Spacing adjustments */
    .pos-page .form-group {
        margin-bottom: 12px !important;
    }
    
    /* Better Checkboxes */
    .pos-page input[type="checkbox"] {
        width: 20px;
        height: 20px;
        accent-color: #ea580c;
        margin-right: 8px;
        cursor: pointer;
        border-radius: 4px;
    }
    
    /* Optional iCheck override if iCheck is active */
    .pos-page .icheckbox_square-blue {
        border-radius: 6px !important;
        background-color: #fff7ed !important;
        border: 2px solid #ea580c !important;
        background-image: none !important;
    }
    .pos-page .icheckbox_square-blue.checked {
        background-color: #ea580c !important;
        position: relative;
    }
    .pos-page .icheckbox_square-blue.checked::after {
        content: '✓';
        color: white;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 14px;
    }
    
    /* Sleek buttons */
    .pos-page .btn {
        border-radius: 20px !important;
    }
    .pos-page .btn-primary, 
    .pos-page .btn-success {
        background: #ea580c !important;
        border-color: #ea580c !important;
        box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3) !important;
        color: #fff !important;
    }

    /* App Tab Logic */
    .app-tab-content:not(.active) {
        display: none !important;
    }
} /* Close the @media (max-width: 768px) block correctly here */

/* GLOBAL POS Dynamic Island (Visible only on mobile via display:none on desktop) */
    #pos-dynamic-island {
        position: fixed;
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        background: #111827;
        border-radius: 35px;
        color: white;
        z-index: 105000 !important;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
        width: auto;
        min-width: 260px;
        height: 44px;
    }
    #pos-dynamic-island.expanded {
        width: 90vw;
        height: auto;
        border-radius: 25px;
        max-width: 400px;
        padding-bottom: 20px;
    }
    #pos-dynamic-island .di-menu-grid {
        display: none;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 0 20px;
        margin-top: 15px;
    }
    #pos-dynamic-island.expanded .di-menu-grid {
        display: grid;
        animation: fadeIn 0.4s ease-out forwards;
    }
    #pos-dynamic-island .di-btn {
        background: #1f2937;
        border: none;
        border-radius: 15px;
        padding: 12px 5px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #f3f4f6;
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
        transition: transform 0.2s;
        text-align: center;
    }
    #pos-dynamic-island .di-btn:active {
        transform: scale(0.95);
        background: #374151;
    }
    #pos-dynamic-island .di-btn i {
        font-size: 20px;
        margin-bottom: 8px;
    }

    /* Recent Transactions App Cards */
    #recent_transactions_modal .table {
        display: block;
        background: transparent;
    }
    #recent_transactions_modal .table tbody {
        display: block;
    }
    #recent_transactions_modal .table tr {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    #recent_transactions_modal .table td {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 4px 0 !important;
        white-space: normal !important;
        text-align: left;
    }
    #recent_transactions_modal .table td:first-child {
        display: none !important;
    }
    #recent_transactions_modal .table td:nth-child(2) {
        font-weight: 700;
        color: #1f2937;
        font-size: 15px;
    }
    #recent_transactions_modal .table td:nth-child(3) {
        font-weight: 700;
        color: #ea580c;
        font-size: 16px;
    }
    #recent_transactions_modal .table td:last-child {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-top: 10px !important;
    }
    #recent_transactions_modal .table td:last-child .tw-dw-btn {
        flex: 1;
        min-width: 80px;
        margin: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 20px;
    }

    /* Floating Animated Bottom Navigation Bar */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 15px;
        left: 15px;
        right: 15px;
        height: 70px;
        background: #ffffff;
        box-shadow: 0 10px 30px rgba(0,0,0,0.08);
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 1040;
        border-radius: 35px;
        padding: 0 10px;
    }

    .mobile-bottom-nav .app-nav-item {
        display: flex;
        align-items: center;
        justify-content: center;
        color: #4b5563;
        text-decoration: none;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        cursor: pointer;
    }

    .mobile-bottom-nav .app-nav-item i {
        font-size: 20px;
        transition: all 0.3s ease;
    }

    .mobile-bottom-nav .app-nav-item span {
        font-size: 14px;
        font-weight: 600;
        transition: all 0.3s ease;
        opacity: 0;
        width: 0;
        overflow: hidden;
        white-space: nowrap;
    }

    .mobile-bottom-nav .app-nav-item.active {
        color: #ffffff;
        background: #ea580c;
        border-radius: 25px;
        width: auto;
        padding: 0 20px;
        box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
    }
    
    .mobile-bottom-nav .app-nav-item.active span {
        opacity: 1;
        width: max-content;
        margin-left: 8px;
    }

    /* Push POS content up so it's not hidden behind nav */
    .pos-page {
        padding-bottom: 100px !important;
        background: #fdfcfb;
    }

    .content-wrapper {
        padding-top: 1rem;
    }
    
    /* Dark mode sticky header */
    @media (prefers-color-scheme: dark) {
        .main-header {
            background: rgba(33, 37, 41, 0.95);
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
    }
}
    
    /* Main Content Adjustments */
    .main-content {
        margin-left: 0 !important;
        padding: 60px 15px 15px 15px;
        width: 100% !important;
    }
    
    /* Cards and Boxes */
    .card, .box {
        margin-bottom: 15px;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .card-body, .box-body {
        padding: 15px;
    }
    
    /* Tables Mobile Responsive */
    .table-responsive {
        border: none;
        margin-bottom: 0;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 8px 4px;
        white-space: nowrap;
    }
    
    /* DataTables Mobile Pagination Fix */
    @media (max-width: 768px) {
        .dataTables_wrapper .dataTables_paginate {
            margin-top: 15px;
            text-align: center;
        }
        
        .dataTables_wrapper .dataTables_paginate .pagination {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 4px;
            margin: 0;
        }
        
        .dataTables_wrapper .dataTables_paginate .pagination li {
            margin: 0 !important;
        }
    }

    /* Buttons Mobile */
    .btn {
        padding: 8px 16px;
        font-size: 14px;
        margin: 2px;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: 120px;
    }
    
    /* Forms Mobile */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
        border-radius: 8px;
    }
    
    .input-group {
        flex-wrap: wrap;
    }
    
    .input-group .form-control {
        min-width: 0;
        flex: 1 1 auto;
    }
    
    /* Modal Mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* POS Layout Mobile Specific */
@media (max-width: 768px) {
    .pos-layout {
        padding: 0;
    }
    
    .pos-layout .main-content {
        padding: 10px;
    }
    
    /* Product Grid Mobile */
    .product_list {
        padding: 5px;
    }
    
    .product_box {
        margin-bottom: 8px;
        padding: 6px;
        min-height: 80px;
    }
    
    .product_box .image-container {
        height: 40px;
        margin-bottom: 5px;
    }
    
    .product_box .text {
        font-size: 11px;
        line-height: 12px;
        max-height: 24px;
        -webkit-line-clamp: 2;
    }
    
    /* POS Cart Mobile */
    .pos-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 2px solid #dee2e6;
        z-index: 1000;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .pos-cart-toggle {
        display: block;
        width: 100%;
        padding: 10px;
        background: #344767;
        color: white;
        border: none;
        font-weight: bold;
    }
    
    .pos-cart-content {
        display: none;
        padding: 15px;
    }
    
    .pos-cart.expanded .pos-cart-content {
        display: block;
    }
    
    /* POS Totals Mobile */
    .pos-total {
        padding: 6px 8px;
        margin: 2px;
        border-radius: 6px;
        background: #f8f9fa;
    }
    
    .pos-total span.number {
        font-size: 18px;
    }
    
    .pos-total span.text {
        width: auto;
        font-size: 12px;
    }
    
    /* POS Form Actions */
    .pos-form-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px;
        border-top: 2px solid #dee2e6;
        z-index: 999;
    }
    
    .pos-form-actions .btn {
        width: 100%;
        margin-bottom: 10px;
        padding: 12px;
        font-size: 16px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    /* Extra small adjustments */
    .sidenav {
        width: 260px !important;
    }
    
    .main-content {
        padding: 50px 10px 10px 10px;
    }
    
    .card-body, .box-body {
        padding: 10px;
    }
    
    .table {
        font-size: 11px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .form-control {
        padding: 10px;
        font-size: 14px;
    }
    
    /* Product grid extra small */
    .product_box {
        padding: 4px;
        min-height: 70px;
    }
    
    .product_box .image-container {
        height: 35px;
    }
    
    .product_box .text {
        font-size: 10px;
        line-height: 11px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidenav {
        width: 250px !important;
    }
    
    .main-content {
        padding: 50px 10px 10px 10px;
    }
    
    .pos-cart {
        max-height: 40vh;
    }
    
    .modal-body {
        max-height: 50vh;
    }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch-friendly sizing */
    .btn, .form-control, .nav-link {
        min-height: 44px;
    }
    
    .table td, .table th {
        min-height: 40px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover, .nav-link:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Better touch targets */
    .product_box {
        min-height: 60px;
        touch-action: manipulation;
    }
    
    .sidebar-toggle, .mobile-nav-toggle {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Dark Mode Mobile Adjustments */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .main-content {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .card, .box {
        background-color: #2d2d2d;
        border-color: #404040;
    }
    
    .table {
        color: #ffffff;
    }
    
    .table th {
        border-color: #404040;
    }
    
    .form-control {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
}

/* Print Styles for Mobile */
@media print {
    .sidenav, .mobile-nav-toggle, .pos-form-actions {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .table {
        font-size: 10px;
    }
    
    .card, .box {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Accessibility Improvements */
@media (max-width: 768px) {
    /* Focus indicators */
    .btn:focus, .form-control:focus, .nav-link:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
    
    /* High contrast mode */
    @media (prefers-contrast: high) {
        .btn {
            border: 2px solid currentColor;
        }
        
        .card, .box {
            border: 2px solid #000;
        }
    }
    
    /* Reduced motion */
    @media (prefers-reduced-motion: reduce) {
        .sidenav, .modal, .btn {
            transition: none;
        }
    }
}