/* ==========================================================================
   GLOBAL ADMIN DASHBOARD LAYOUT FIXES
   ========================================================================== */

/* 1. Prevent global page scroll */
html, body {
    overflow: hidden !important; 
    height: 100vh !important;
}

/* Enlarge Product Images in the Table */
.table-no-stack .avatar-md {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
}
.table-no-stack .avatar-md img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================
   Premium Filter Panel Styles (SaaS UI)
========================================= */

.filter-panel {
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    border-radius: 12px !important;
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
}

.search-group {
    background-color: #f8f9fa;
    border: 1px solid #eef2f7 !important;
    transition: all 0.2s ease;
    border-radius: 8px !important;
}

.search-group:focus-within {
    background-color: #ffffff;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1);
}

.btn-filter-chip {
    background-color: #f8f9fa;
    border: 1px solid #eef2f7 !important;
    color: #495057;
    border-radius: 8px !important;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-filter-chip:hover,
.btn-filter-chip[aria-expanded="true"] {
    background-color: #eaf1ff;
    border-color: #cce0ff !important;
    color: #0d6efd;
}

.btn-filter-chip:hover i,
.btn-filter-chip[aria-expanded="true"] i {
    color: #0d6efd !important;
}

.filter-panel .dropdown-menu {
    border: 0 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 200px;
}

.filter-panel .form-check {
    padding: 0.5rem 1rem 0.5rem 2rem;
    margin: 0;
    border-radius: 6px;
    transition: background-color 0.15s;
    cursor: pointer;
}

.filter-panel .form-check:hover {
    background-color: #f8f9fa;
}

.filter-panel .form-check-input {
    margin-left: -1.5rem;
    cursor: pointer;
}

.filter-panel .form-select-chip {
    background-color: #f8f9fa;
    border: 1px solid #eef2f7 !important;
    color: #495057;
    border-radius: 8px !important;
    padding: 0.5rem 2.2rem 0.5rem 0.8rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-panel .form-select-chip:focus {
    background-color: #eaf1ff;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1) !important;
}

.filter-action-btn {
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 0.5rem 1.25rem !important;
    transition: all 0.2s ease;
}

.filter-action-btn.btn-primary {
    box-shadow: 0 4px 10px rgba(13, 110, 253, 0.2);
}

.filter-action-btn.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(13, 110, 253, 0.3);
}

.filter-action-btn.btn-light {
    background-color: #f8f9fa;
    border-color: #eef2f7 !important;
}

.filter-action-btn.btn-light:hover {
    background-color: #e2e6ea;
}

/* Custom Prominent Slider (Scrollbar) for Horizontal Tables */
.table-responsive::-webkit-scrollbar {
    height: 8px; /* Thickness of the slider */
}
.table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #5d87ff; /* Brand primary color or similar */
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #4570ea;
}

/* 2. Main content independent scrolling */
.content-page {
    /* Override extreme min-heights (like 1900px) that cause extra blank space */
    min-height: 0 !important;
    
    /* Allow independent scrolling without breaking original margins/padding */
    height: 100vh !important;
    overflow-y: auto !important; 
    overflow-x: hidden !important;
    
    /* Keep flex behavior for footer pushing */
    display: flex !important;
    flex-direction: column !important;
}

/* Main Content Custom Scrollbar */
.content-page::-webkit-scrollbar { width: 6px; }
.content-page::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; }
.content-page::-webkit-scrollbar-track { background: transparent; }

/* 3. Push footer to bottom without forcing scroll */
.content-page > .container-fluid {
    flex: 1 0 auto !important;
}

.footer {
    flex-shrink: 0 !important;
    margin-top: auto !important; 
}

/* 4. Sidebar independent scrolling */
.sidenav-menu {
    height: 100vh !important;
    overflow-y: auto !important; 
    overflow-x: hidden !important;
}

/* Custom Scrollbar for Sidebar */
.sidenav-menu::-webkit-scrollbar { width: 5px; }
.sidenav-menu::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
.sidenav-menu::-webkit-scrollbar-track { background: transparent; }

/* Global Mobile Responsiveness */
@media screen and (max-width: 768px) {

    /* 1. Responsive Tables */
    table:not(.table-no-stack),
    table:not(.table-no-stack) thead,
    table:not(.table-no-stack) tbody,
    table:not(.table-no-stack) th,
    table:not(.table-no-stack) td,
    table:not(.table-no-stack) tr {
        display: block;
    }

    table:not(.table-no-stack) thead tr {
        display: none;
        /* Hide header rows */
    }

    table:not(.table-no-stack) tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
    }

    table:not(.table-no-stack) td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding: 10px 10px 10px 50%;
        text-align: right;
        min-height: 45px;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        flex-wrap: wrap;
    }

    table:not(.table-no-stack) td:before {
        position: absolute;
        top: 10px;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: normal;
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        color: #495057;
    }

    table:not(.table-no-stack) td:last-child {
        border-bottom: 0;
    }

    /* Fix table actions wrapper */
    table:not(.table-no-stack) td .d-flex {
        justify-content: flex-end;
    }

    /* 2. Better Buttons */
    .btn {
        min-height: 44px;
        /* Minimum touch target size */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .btn-icon {
        width: 44px;
        height: 44px;
    }

    /* 3. Footer alignment */
    .footer {
        text-align: center;
        padding-bottom: 20px;
    }

    .footer .row>div {
        margin-bottom: 10px;
    }

    .footer .justify-content-end {
        justify-content: center !important;
        display: flex !important;
    }

    /* 4. Scanner Modal & Elements Adjustments */
    #qrScannerModal .modal-dialog {
        margin: 0.5rem;
    }

    /* Display full logo in mobile */
    .logo-sm img {
        max-height: 28px;
        width: auto;
    }
}

/* 5. QR Scanner Specific Button Styles (works across all devices, highly visible on mobile) */
#qr-reader button {
    background-color: #0d6efd !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 20px !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    margin: 10px 5px !important;
    min-height: 48px;
    /* good touch target */
    box-shadow: 0 4px 6px rgba(13, 110, 253, 0.2);
    transition: all 0.2s ease;
    cursor: pointer;
}

#qr-reader button:hover {
    background-color: #0b5ed7 !important;
    transform: translateY(-1px);
}

#qr-reader button:active {
    transform: translateY(1px);
}

/* HTML5 QrCode Scanner adds a select box for camera selection */
#qr-reader select {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 15px;
    font-size: 14px;
    color: #495057;
}

/* Improve scanner UI text and links */
#qr-reader a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

#qr-reader span {
    font-size: 14px;
    color: #6c757d;
}

/* Additional UI/UX Polish */
body {
    overflow-x: hidden;
}

#qr-reader {
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    padding: 15px !important;
    background: #fff !important;
    border-radius: 12px !important;
}

#qr-reader__dashboard_section_csr span,
#qr-reader__dashboard_section_csr div {
    margin-bottom: 10px;
}

/* --- Mobile Redesign: Specific Card Layouts --- */
@media screen and (max-width: 768px) {

    /* 🛒 1. Cart Page (.table-cart) */
    .table-responsive {
        border: none !important;
        overflow-x: visible !important;
    }

    .table-cart {
        display: block;
    }

    .table-cart thead {
        display: none !important;
    }

    .table-cart tbody {
        display: block;
    }

    .table-cart tbody tr {
        display: flex !important;
        flex-wrap: wrap;
        background: #fff;
        padding: 16px;
        border-radius: 16px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        margin-bottom: 16px;
        border: 1px solid #f0f0f0;
        position: relative;
        align-items: center;
    }

    .table-cart tbody td {
        display: flex;
        padding: 0 !important;
        border: none !important;
        align-items: center;
        min-height: auto !important;
        text-align: left !important;
        justify-content: flex-start;
    }

    .table-cart tbody td:before {
        display: none !important;
    }

    /* Product Info */
    .table-cart tbody td:nth-child(1) {
        width: 100%;
        flex-direction: column;
        align-items: flex-start !important;
        margin-bottom: 16px;
        border-bottom: 1px dashed #eaeaea !important;
        padding-bottom: 16px !important;
    }

    .table-cart tbody td:nth-child(1)>a {
        width: 100%;
        margin-bottom: 12px;
    }

    .table-cart tbody td:nth-child(1) img {
        width: 100%;
        height: auto;
        max-height: 250px;
        object-fit: cover;
        border-radius: 12px;
        margin-right: 0 !important;
    }

    .table-cart tbody td:nth-child(1)>div {
        width: 100%;
        text-align: left;
    }

    .table-cart tbody td:nth-child(1) h6 {
        margin-bottom: 6px;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.4;
    }

    .table-cart tbody td:nth-child(1) small {
        font-size: 12px;
        display: block;
        color: #888;
        margin-bottom: 2px;
        text-align: left;
    }

    /* Price */
    .table-cart tbody td:nth-child(2) {
        width: 40%;
    }

    .table-cart tbody td:nth-child(2) .price-input-wrapper {
        display: flex;
        align-items: center;
    }

    .table-cart tbody td:nth-child(2) input {
        font-weight: 700 !important;
        font-size: 15px !important;
        color: #236dc9;
        width: 70px;
    }

    .table-cart tbody td:nth-child(2) .price-currency {
        color: #236dc9;
        font-weight: 700;
    }

    /* Quantity */
    .table-cart tbody td:nth-child(3) {
        width: 45%;
        justify-content: center;
    }

    .table-cart tbody td:nth-child(3) .input-group {
        max-width: 120px !important;
        background: #f8f9fa;
        border-radius: 8px;
        padding: 4px;
        display: flex;
        align-items: center;
    }

    .table-cart tbody td:nth-child(3) .btn {
        width: 32px;
        height: 32px;
        min-height: 32px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px !important;
        background: #e9ecef !important;
        border: none !important;
        color: #495057 !important;
    }

    .table-cart tbody td:nth-child(3) input {
        background: transparent;
        text-align: center;
        font-weight: 600;
        padding: 0;
        height: 32px;
        font-size: 15px;
        border: none !important;
    }

    /* Delete */
    .table-cart tbody td:nth-child(4) {
        width: 15%;
        justify-content: flex-end;
    }

    .table-cart tbody td:nth-child(4) a {
        background: rgba(236, 106, 106, 0.1);
        color: #ec6a6a !important;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    /* ðŸ“¦ 2. Orders Page (.table-orders) */
    .table-orders tr {
        display: flex !important;
        flex-wrap: wrap;
        background: #fff;
        padding: 14px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-bottom: 15px;
        border: 1px solid #eaeaea;
    }

    .table-orders td {
        display: flex;
        padding: 0 !important;
        border: none !important;
        align-items: center;
        min-height: auto !important;
        text-align: left !important;
        justify-content: flex-start;
    }

    .table-orders td:before {
        display: none !important;
    }

    .table-orders td:nth-child(1) {
        display: none !important;
    }

    .table-orders td:nth-child(2) {
        width: 50%;
        font-weight: bold;
    }

    .table-orders td:nth-child(3) {
        width: 50%;
        justify-content: flex-end;
        font-size: 13px;
        color: #6c757d;
    }

    .table-orders td:nth-child(4) {
        width: 100%;
        border-top: 1px dashed #eee !important;
        border-bottom: 1px dashed #eee !important;
        padding: 12px 0 !important;
        margin: 10px 0;
    }

    .table-orders td:nth-child(4) .d-flex {
        width: 100%;
        align-items: center;
        text-align: left;
    }

    .table-orders td:nth-child(5) {
        width: 33%;
        font-weight: bold;
        font-size: 16px;
    }

    .table-orders td:nth-child(6) {
        width: 33%;
        justify-content: center;
    }

    .table-orders td:nth-child(7) {
        width: 34%;
        justify-content: flex-end;
    }

    /* ðŸ‘¤ 3. Clients Page (.table-clients) */
    .table-clients tr {
        display: flex !important;
        flex-wrap: wrap;
        background: #fff;
        padding: 14px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-bottom: 15px;
        border: 1px solid #eaeaea;
        flex-direction: column;
    }

    .table-clients td {
        display: flex;
        padding: 0 !important;
        border: none !important;
        align-items: center;
        min-height: auto !important;
        text-align: left !important;
        justify-content: flex-start;
        width: 100%;
    }

    .table-clients td:before {
        display: none !important;
    }

    .table-clients td:nth-child(1) {
        display: none !important;
    }

    .table-clients td:nth-child(2) {
        margin-bottom: 10px;
    }

    .table-clients td:nth-child(2) .d-flex {
        align-items: center;
        text-align: left;
    }

    .table-clients td:nth-child(2) h5 {
        font-size: 16px;
        margin-bottom: 0;
    }

    .table-clients td:nth-child(3),
    .table-clients td:nth-child(4),
    .table-clients td:nth-child(5) {
        font-size: 14px;
        color: #6c757d;
        padding-left: 50px !important;
        margin-bottom: 6px;
    }

    .table-clients td:nth-child(6) {
        margin-top: 12px;
        padding-top: 12px !important;
        border-top: 1px solid #eee !important;
        justify-content: flex-start;
        padding-left: 50px !important;
    }

    .table-clients td:nth-child(6) .d-flex {
        justify-content: flex-start !important;
        gap: 8px !important;
    }

    .table-clients td:nth-child(6) .btn {
        min-height: 44px;
        padding: 0 14px;
    }
}


   .table-clients td:nth-child(6) {
         margin-top: 12px;
         padding-top: 12px !important;
         border-top: 1px solid #eee !important;
         justify-content: flex-start;
         padding-left: 50px !important;
     }

     .table-clients td:nth-child(6) .d-flex {
         justify-content: flex-start !important;
         gap: 8px !important;
     }

     .table-clients td:nth-child(6) .btn {
         min-height: 44px;
         padding: 0 14px;
     }
 


 /* Card polish */
 .card {
     border-radius: 14px;
 }

 /* Inputs */
 .form-control,
 .form-select {
     border-radius: 10px;
     /* padding: 10px; */
 }

 /* Input group */
 .input-group-text {
     border-radius: 10px 0 0 10px;
 }

 /* Buttons */
 .btn {
     border-radius: 10px;
 }

 /* Mobile fix */
 @media (max-width: 768px) {
     .card {
         padding: 15px !important;
     }

     .btn {
         width: 100%;
     }

     .input-group-lg .form-control {
         font-size: 14px;
     }
 }

 /* Reduce overall spacing */
 .card {
     border-radius: 10px;
 }

 .form-label {
     font-size: 12px;
     font-weight: 500;
 }

 /* Inputs compact */
 .form-control-sm,
 .form-select-sm {
     padding: 6px 10px;
     font-size: 13px;
 }

 /* Input groups tighter */
 .input-group-text {
     padding: 6px 10px;
 }

 /* Reduce margins */
 .mb-3 {
     margin-bottom: 10px !important;
 }

 .mt-3 {
     margin-top: 10px !important;
 }

 /* Mobile */
 @media (max-width: 768px) {
     .card {
         padding: 12px !important;
     }

     .btn {
         width: 100%;
     }
 }


 .suggestion-item {
     padding: 10px 12px;
     cursor: pointer;
     border-bottom: 1px solid #f5f5f5;
     transition: 0.2s;
 }

 .suggestion-item:hover {
     background: #f8f9fa;
 }

 .suggestion-name {
     font-weight: 600;
     font-size: 13px;
 }

 .suggestion-meta {
     font-size: 12px;
     color: #6c757d;
 }

 /* Fix dropdown width */
 .suggestion-box {
     position: absolute;
     width: 100%;
     top: 100%;
     left: 0;
     background: #fff;
     border: 1px solid #eee;
     border-radius: 8px;
     margin-top: 4px;
     z-index: 1000;
 }

 /* Mobile behavior */
 @media (max-width: 768px) {
     .input-group.flex-column {
         gap: 6px;
     }

     .btn {
         width: 100%;
     }
 }


 /* ACTIVE (Blue step) */
 .pos-steps .nav-link.active {
     background: linear-gradient(135deg, #2563eb, #3b82f6);
     color: #fff !important;
 }

 /* ACTIVE ICON */
 .pos-steps .nav-link.active i {
     color: #fff !important;
 }

 /* COMPLETED (Green step) */
 .pos-steps .nav-link.completed {
     background: #22c55e;
     color: #fff !important;
 }

 /* COMPLETED ICON */
 .pos-steps .nav-link.completed i {
     color: #fff !important;
 }

 /* REMOVE BLACK TEXT ISSUE */
 .pos-steps .nav-link span,
 .pos-steps .nav-link i {
     color: inherit !important;
 }