:root {
    --sidebar-width: 250px;
    --primary-color: #0d7ff2;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}
body {
    background-color: #0a0f14;
    background-image: radial-gradient(circle at 20% 30%, rgba(13, 127, 242, 0.15) 0%, transparent 40%),
                      radial-gradient(circle at 80% 70%, rgba(13, 127, 242, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
    color: #e2e8f0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    position: relative;
}
/* Bootstrap 5 Modal Fixes */
.modal {
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050 !important;
}
.modal-backdrop {
    z-index: 1040 !important;
}
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Fix Select2 height */
.select2-container .select2-selection--single {
    min-height: 38px;
    border: 1px solid var(--glass-border) !important;
    padding: 5px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    min-height: 36px;
}
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: rgba(13, 127, 242, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    color: white;
    transition: all 0.3s;
    z-index: 1000;
}
@media (max-width: 991.98px) {
    #sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    #content {
        margin-left: 0 !important;
    }
    #sidebar.active {
        left: 0;
    }
}
#content {
    margin-left: var(--sidebar-width);
    padding: 20px;
    transition: all 0.3s;
}
#sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 15px 20px;
}
#sidebar .nav-link:hover, #sidebar .nav-link.active {
    background: #343a40;
    color: white;
}
.card {
    border: 1px solid var(--glass-border);
    background: rgba(25, 30, 36, 0.8);
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    border-radius: 12px;
    color: #e2e8f0;
}
/* Glass effect specifically for large distinctive elements to avoid GPU lag */
.glass-card, .glass-panel {
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    color: #e2e8f0;
}
.navbar {
    background: rgba(10, 15, 20, 0.6) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}
.table { color: #cbd5e1; }
.table thead th {
    background-color: rgba(255,255,255,0.02);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #94a3b8;
    border-bottom: 1px solid var(--glass-border);
}
.table td {
    border-color: rgba(255,255,255,0.05);
}
.table-danger,
.priority-high-row {
    --priority-row-bg: rgba(255, 255, 255, 0.055);
    --priority-row-bg-hover: rgba(255, 255, 255, 0.095);
    --priority-row-border: rgba(255, 196, 162, 0.14);
    color: #eef4fb !important;
}

.table-danger > th,
.table-danger > td,
.priority-high-row > th,
.priority-high-row > td {
    color: inherit !important;
    background-color: var(--priority-row-bg) !important;
    background-image: none !important;
    border-color: var(--priority-row-border) !important;
}

.table-danger > td:first-child,
.priority-high-row > td:first-child {
    position: relative;
}

.table-danger > td:first-child::before,
.priority-high-row > td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: #ff9968;
    box-shadow: 1px 0 0 rgba(255, 239, 229, 0.18);
    pointer-events: none;
}

.table tbody tr.table-danger:hover > td,
.table tbody tr.priority-high-row:hover > td {
    background-color: var(--priority-row-bg-hover) !important;
    background-image: none !important;
}

.priority-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding: 0.28rem 0.72rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 173, 122, 0.28);
    background: rgba(255, 128, 74, 0.12);
    box-shadow: 0 8px 18px rgba(255, 120, 72, 0.10);
    color: #ffd9c5;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    width: fit-content;
}

.priority-chip i {
    color: #ffb07b;
    font-size: 0.72rem;
}

.priority-chip-animated {
    animation: priorityChipShake 2.8s ease-in-out infinite;
    transform-origin: center;
}

@keyframes priorityChipShake {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    6% {
        transform: translateX(-1px) rotate(-1deg);
    }
    12% {
        transform: translateX(1.5px) rotate(1deg);
    }
    18% {
        transform: translateX(-1.5px) rotate(-0.8deg);
    }
    24% {
        transform: translateX(1px) rotate(0.6deg);
    }
    30% {
        transform: translateX(0) rotate(0deg);
    }
}

.dashboard-orders-card .card-body {
    padding: 0;
}

.dashboard-orders-table-wrap {
    max-height: 700px;
    overflow-y: auto;
}

.dashboard-orders-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(18, 24, 31, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dashboard-orders-table td {
    vertical-align: middle;
}

.dashboard-orders-table .problem-snippet {
    max-width: 240px;
    line-height: 1.45;
    white-space: normal;
}

@media (max-width: 991.98px) {
    .dashboard-orders-table .problem-snippet {
        max-width: 180px;
    }
}

/* Custom text class to replace low contrast text-white-50 */
.text-white-75 {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* Fancybox dark theme fix */
.fancybox__backdrop {
    background: rgba(10, 15, 20, 0.85) !important;
}

/* Pagination */
.pagination .page-link {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e2e8f0;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}
.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.pagination .page-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Phone QR Popover */
.phone-qr-trigger:hover {
    color: var(--primary-color) !important;
    text-decoration: underline;
}
.qr-popover {
    position: fixed;
    background: #1a1f24 !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 1045 !important;
    display: none;
    text-align: center;
    color: #e2e8f0;
}
.qr-popover #qrContainer { margin: 0 auto 8px; }
.qr-popover #qrContainer img { display: block; border-radius: 4px; }
.qr-popover .qr-phone-label { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.qr-popover .qr-call-btn { display: inline-block; margin-top: 6px; font-size: 12px; }

/* SLA badges */
.sla-warning { background-color: rgba(255, 193, 7, 0.2) !important; }
.sla-danger { background-color: rgba(220, 53, 69, 0.2) !important; }

/* Customer option in Select2 */
.customer-option .meta { display: block; font-size: 12px; color: #94a3b8; }
.badge {
    font-weight: 500;
    padding: 0.5em 0.8em;
}
.status-new { color: #0d6efd; }
.status-progress { color: #fd7e14; }
.status-waiting { color: #6c757d; }
.status-completed { color: #198754; }
.status-collected { color: #0dcaf0; }

/* Select2 Dark Mode Override */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: #fff !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}
.select2-dropdown {
    background-color: #1a1f24 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    backdrop-filter: blur(15px);
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff !important;
}
.select2-container--default .select2-results__option {
    color: #fff !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: rgba(255, 255, 255, 0.5) transparent transparent transparent !important;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent rgba(255, 255, 255, 0.5) transparent !important;
}

/* Match highlighting in Select2 search results */
.select2-results__option .match {
    background: rgba(255, 255, 0, 0.2);
    color: #fff;
    padding: 0 2px;
    border-radius: 3px;
}
.select2-results__option--highlighted .match {
    background: rgba(255, 255, 255, 0.2);
    color: #fff !important;
}

/* Animations from view_order.php */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}
.animate-shake { animation: shake 0.6s ease-in-out; }

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
.animate-pulse { animation: pulse 0.5s ease-in-out; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.animate-bounce { animation: bounce 1s ease-in-out infinite; }

/* Select2 Multiple dark theme fixes */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgba(13, 127, 242, 0.3) !important;
    border: 1px solid rgba(13, 127, 242, 0.5) !important;
    color: #fff !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff !important;
    border-right: 1px solid rgba(13, 127, 242, 0.5) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background-color: rgba(13, 127, 242, 0.5) !important;
    color: #fff !important;
}

/* Inventory button styles */
.btn-white { background: white; }
.ring-2 { box-shadow: 0 0 0 2px currentColor; }

/* Glow badge variants */
.bg-success-glow {
    background-color: rgba(25, 135, 84, 0.25) !important;
    color: #75b798 !important;
    box-shadow: 0 0 8px rgba(25, 135, 84, 0.4);
}
.bg-info-glow {
    background-color: rgba(13, 202, 240, 0.25) !important;
    color: #6edff6 !important;
    box-shadow: 0 0 8px rgba(13, 202, 240, 0.4);
}
