/* ============================================
   PR/PO Application - Glassmorphism Theme
   Color Palette:
   - Primary Blue: #1B4C8C
   - Secondary Blue: #1A447E
   - Error: #F20505
   - Accent/CTA: #F23054
   ============================================ */

:root {
    --primary-blue: #1b4c8c;
    --secondary-blue: #1a447e;
    --error-red: #f20505;
    --accent-pink: #f23054;
    --glass-bg: rgba(27, 76, 140, 0.15);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-white: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --sidebar-width: 260px;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", sans-serif;
    background: linear-gradient(135deg, #1a447e 0%, #0d2340 50%, #1b4c8c 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-white);
}

/* ============================================
   Layout
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: #0f325d; /* Solid background - no transparency */
    border-right: 1px solid var(--glass-border);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1050; /* Higher than topbar and content */
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #0f325d;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 25px;
    position: sticky;
    top: 0;
    z-index: 1021;
}

.topbar-user-btn {
    padding: 6px 12px !important;
    height: 35px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.content-area {
    padding: 25px;
}

/* ============================================
   Glass Card Component
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    color: var(--text-white);
}

.glass-card .card-header {
    border-bottom: 1px solid var(--glass-border);
    background: transparent;
}

.glass-card .card-title {
    color: var(--text-white);
    margin-bottom: 0;
}

/* ============================================
   Glass Modal
   ============================================ */
.glass-modal {
    z-index: 1060 !important;
}

.glass-modal .modal-content {
    background: rgba(26, 68, 126, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    color: var(--text-white);
}

.glass-modal .modal-header {
    border-bottom: 1px solid var(--glass-border);
}

.glass-modal .modal-footer {
    border-top: 1px solid var(--glass-border);
}

/* Ensure modal backdrop is above split-view */
.modal-backdrop {
    z-index: 1055 !important;
}

/* ============================================
   Glass Input
   ============================================ */
.glass-input {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-white) !important;
    border-radius: 8px;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--accent-pink) !important;
    box-shadow: 0 0 0 0.2rem rgba(242, 48, 84, 0.25) !important;
    color: var(--text-white) !important;
}

.glass-input::placeholder {
    color: var(--text-muted) !important;
}

/* Fix for Select Options Visibility */
.glass-input option {
    color: #333 !important;
    background-color: #fff !important;
}

/* Discount Input Group */
.discount-input-group {
    width: 50%;
}

.discount-input {
    border-right: 0 !important;
}

.discount-type-select {
    max-width: 60px;
    border-left: 0 !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    background-position: right 2px center !important;
}

/* Table Column Widths */
.col-item-detail {
    width: 50%;
}

.col-quantity {
    width: 15%;
}

.col-rate {
    width: 15%;
}

.col-amount {
    width: 15%;
}

.col-action {
    width: 5%;
}

/* Form Validation States */
.formerror {
    border-color: var(--error-red) !important;
    box-shadow: 0 0 0 0.2rem rgba(242, 5, 5, 0.25) !important;
}

.formvalid {
    border-color: rgba(25, 135, 84, 0.5) !important;
}

/* ============================================
   Glass Offcanvas
   ============================================ */
.glass-offcanvas {
    background: rgba(26, 68, 126, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border) !important;
    color: var(--text-white);
    width: 450px !important;
}

.glass-offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--glass-border);
}

.glass-offcanvas .offcanvas-title {
    color: var(--text-white);
    font-weight: 700;
}

.glass-offcanvas .offcanvas-body {
    padding: 25px;
}

/* ============================================
   Stat Cards
   ============================================ */
.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    padding: 20px;
    transition: all 0.3s ease;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.stat-card .icon-box {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   Glass Table
   ============================================ */
.glass-table {
    color: var(--text-white);
    table-layout: fixed !important;
    /* LOCKS COLUMN WIDTHS */
    width: 100% !important;
    background-color: transparent !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.glass-table thead th {
    background: rgba(255, 255, 255, 0.1) !important;
    border-bottom: 2px solid var(--glass-border) !important;
    color: var(--text-white) !important;
    font-weight: 600;
    padding: 12px 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Force all table cells and rows to be TRANSPARENT to avoid bleaching inputs */
.glass-table tbody,
.glass-table tr,
.glass-table td {
    background-color: transparent !important;
    background: transparent !important;
    border-bottom: 1px solid var(--glass-border) !important;
    /* padding: 12px 15px; */
    vertical-align: middle;
    overflow: hidden;
    /* Prevent cell expansion */
}

.glass-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Ensure all inputs inside the glassy table match the theme perfectly */
.glass-table .glass-input,
.glass-table .form-control.glass-input,
.glass-table textarea.glass-input {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: var(--text-white) !important;
    border-radius: 8px !important;
    min-height: 38px;
    width: 100% !important;
    box-shadow: none !important;
}

.glass-table .glass-input:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--accent-pink) !important;
    box-shadow: 0 0 0 0.2rem rgba(242, 48, 84, 0.25) !important;
}

/* ============================================
   Select2 Glassmorphism - DEFINITIVE NUCLEAR FIX
   ============================================ */

/* 1. Force Container to be a block and match 100% width */
.select2-container,
.select2-container--default,
.select2-container .select2-selection--single {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    outline: none !important;
}

/* 2. SPECIFIC SELECTION BOX - MIRROR .glass-input EXACTLY */
.select2-container--default .select2-selection--single {
    background-color: rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 8px !important;
    height: 38px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    transition: all 0.2s ease !important;
    overflow: hidden !important;
    /* STOPS WIDTH EXPANSION */
    box-shadow: none !important;
    color: #ffffff !important;
}

/* 3. Text Visibility & Truncation - MIRROR .glass-input TEXT */
.select2-container--default
    .select2-selection--single
    .select2-selection__rendered {
    color: #ffffff !important;
    padding-left: 12px !important;
    padding-right: 25px !important;
    /* Space for arrow */
    line-height: normal !important;
    font-size: 1rem !important;
    width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    /* ENFORCE ... */
    display: block !important;
}

/* Ensure placeholder matches */
.select2-container--default
    .select2-selection--single
    .select2-selection__placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* 4. Match Focus state of .glass-input */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: #f23054 !important;
    box-shadow: 0 0 0 0.2rem rgba(242, 48, 84, 0.25) !important;
}

/* 5. Minimalist Glass Arrow */
.select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    height: 36px !important;
    top: 1px !important;
    right: 5px !important;
    width: 20px !important;
}

.select2-container--default
    .select2-selection--single
    .select2-selection__arrow
    b {
    border-color: #ffffff transparent transparent transparent !important;
    border-width: 5px 4px 0 4px !important;
}

/* 7. Dropdown List - Consistent Theme */
.select2-dropdown {
    background: #1a447e !important;
    background: rgba(26, 68, 126, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    z-index: 9999 !important;
}

/* 8. Results & Options */
.select2-results__option {
    color: #ffffff !important;
    padding: 8px 12px !important;
}

.select2-container--default
    .select2-results__option--highlighted[aria-selected] {
    background-color: #f23054 !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* 9. Search field in dropdown */
.select2-container--default .select2-search--dropdown .select2-search__field {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    border-radius: 4px !important;
}

/* 10. Hide default clear button which might break layout */
.select2-container--default
    .select2-selection--single
    .select2-selection__clear {
    display: none !important;
}

/* ============================================
   Glass Buttons
   ============================================ */
.btn-glass-primary {
    background: var(--primary-blue);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-glass-primary:hover {
    background: var(--secondary-blue);
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(27, 76, 140, 0.4);
}

.btn-check:checked + .btn-glass-secondary,
.btn-check:checked + .btn-glass-primary,
.btn-glass-secondary:active {
    background: #0d6efd !important;
    color: #ffffff !important;
    border-color: var(--glass-border);
    box-shadow: 0 0 15px rgba(27, 76, 140, 0.5);
}

.btn-check:checked + .btn-glass-secondary,
.btn-check:checked + .btn-glass-primary,
.btn-glass-secondary:hover {
    color: #ffffff !important;
    border-color: var(--glass-border);
    box-shadow: 0 0 15px rgba(27, 76, 140, 0.5);
}

.btn-glass-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-glass-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    transform: translateY(-2px);
}

.btn-glass-success {
    background: rgba(25, 135, 84, 0.8);
    border: 1px solid rgba(25, 135, 84, 0.5);
    color: var(--text-white);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-glass-success:hover {
    background: rgba(25, 135, 84, 1);
    color: var(--text-white);
    transform: translateY(-2px);
}

.btn-glass-warning {
    background: rgba(255, 193, 7, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.5);
    color: #000;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-glass-warning:hover {
    background: rgba(255, 193, 7, 1);
    color: #000;
    transform: translateY(-2px);
}

.btn-glass-danger {
    background: rgba(242, 5, 5, 0.8);
    border: 1px solid rgba(242, 5, 5, 0.5);
    color: var(--text-white);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-glass-danger:hover {
    background: var(--error-red);
    color: var(--text-white);
    transform: translateY(-2px);
}

.btn-glass-info {
    background: rgba(13, 202, 240, 0.8);
    border: 1px solid rgba(13, 202, 240, 0.5);
    color: #000;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-glass-info:hover {
    background: rgba(13, 202, 240, 1);
    color: #000;
    transform: translateY(-2px);
}

/* ============================================
   Glass Dropdown
   ============================================ */
.glass-dropdown {
    background: rgba(26, 68, 126, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
}

.glass-dropdown .dropdown-item {
    color: var(--text-white);
    padding: 10px 20px;
}

.glass-dropdown .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.glass-dropdown .dropdown-divider {
    border-color: var(--glass-border);
}

/* ============================================
   Form Switch
   ============================================ */
.form-check-input:checked {
    background-color: var(--accent-pink);
    border-color: var(--accent-pink);
}

/* ============================================
   DataTables Override
   ============================================ */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    border-radius: 8px;
    padding: 5px 10px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: var(--text-muted);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-white) !important;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 5px;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-blue) !important;
    color: var(--text-white) !important;
    border-color: var(--primary-blue) !important;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    gap: 5px;
}

.pagination .page-item .page-link {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    border-radius: 8px !important;
    padding: 8px 14px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.pagination .page-item .page-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-pink);
    color: #fff;
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background: var(--accent-pink) !important;
    border-color: var(--accent-pink) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(242, 48, 84, 0.3);
}

.pagination .page-item.disabled .page-link {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    z-index: 9999;
}

.toast {
    background: rgba(26, 68, 126, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-blue);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ============================================
   Floating Calculator Styles
   ============================================ */
.floating-calculator {
    position: fixed;
    top: 100px;
    right: 50px;
    width: 280px;
    min-width: 220px;
    max-width: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    resize: both;
    overflow: hidden;
}

.calc-header {
    background: rgba(27, 76, 140, 0.6);
    padding: 10px 15px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: bold;
    border-radius: 12px 12px 0 0;
}

.calc-body {
    padding: 15px;
}

.calc-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
}

/* Calculator History Panel */
.calc-history-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.calc-history-list {
    padding: 8px;
}

.calc-history-item {
    padding: 4px 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.calc-history-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.calc-history-item .expression {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

.calc-history-item .result {
    color: #fff;
    font-weight: 600;
}

/* Calculator Memory Indicator */
.calc-memory-indicator {
    text-align: right;
    padding-right: 5px;
}

/* Calculator Keyboard Shortcut Hint */
.calc-shortcut-hint {
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.calc-shortcut-hint kbd {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Calculator Copy Success Animation */
.calc-copy-success {
    animation: calcCopyFlash 0.3s ease;
}

@keyframes calcCopyFlash {
    0% {
        background: rgba(25, 135, 84, 0.5);
    }
    100% {
        background: transparent;
    }
}

/* Glass Tabs (Settings) */
.glass-tabs .nav-link {
    color: var(--text-white);
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 10px 10px 0 0;
    margin-right: 5px;
}

.glass-tabs .nav-link.active {
    background: var(--glass-bg);
    border-bottom-color: transparent;
}

.glass-tabs .nav-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

.glass-footer {
    background: #0f325d;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
    padding: 1.25rem 1rem;
    margin-top: auto;
    width: 100%;
    z-index: 10;
}

.glass-footer p {
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    margin: 0;
}

.my-text-muted {
    color: #c9dfff !important;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* ============================================
   Split View Layout (Outlook-style)
   ============================================ */
.split-view-container {
    height: calc(100vh - 140px);
    overflow: hidden;
}

.estimates-list-panel,
.invoices-list-panel,
.payments-list-panel,
.salespersons-list-panel {
    height: 100%;
    overflow-y: auto;
    padding-right: 5px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.estimates-list-panel::-webkit-scrollbar,
.invoices-list-panel::-webkit-scrollbar,
.payments-list-panel::-webkit-scrollbar {
    width: 6px;
}

.estimates-list-panel::-webkit-scrollbar-track,
.invoices-list-panel::-webkit-scrollbar-track,
.payments-list-panel::-webkit-scrollbar-track,
.expenses-list-panel::-webkit-scrollbar-track,
.customers-list-panel::-webkit-scrollbar-track,
.po-list-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.estimates-list-panel::-webkit-scrollbar-thumb,
.invoices-list-panel::-webkit-scrollbar-thumb,
.payments-list-panel::-webkit-scrollbar-thumb,
.po-list-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.estimates-list-panel::-webkit-scrollbar-thumb:hover,
.invoices-list-panel::-webkit-scrollbar-thumb:hover,
.payments-list-panel::-webkit-scrollbar-thumb:hover,
.po-list-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.estimate-item,
.invoice-item,
.proforma-item,
.payment-item,
.customer-item,
.salesperson-item,
.expense-item,
.po-item,
.ri-item,
.rpo-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.estimate-item:hover,
.invoice-item:hover,
.proforma-item:hover,
.payment-item:hover,
.expense-item:hover,
.customer-item:hover,
.salesperson-item:hover,
.po-item:hover,
.ri-item:hover,
.rpo-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.estimate-item.active,
.invoice-item.active,
.proforma-item.active,
.payment-item.active,
.expense-item.active,
.customer-item.active,
.po-item.active,
.ri-item.active,
.rpo-item.active {
    background: rgba(255, 255, 255, 0.15) !important;
    border-left: 3px solid #00d2ff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.estimate-details-panel,
.invoice-details-panel,
.proforma-details-panel,
.payment-details-panel,
.expense-details-panel,
.customer-details-panel,
.po-details-panel {
    height: 100%;
    overflow-y: auto;
    position: relative;
    padding-left: 15px;
}

@media (max-width: 768px) {
    .split-view-container {
        height: auto;
        overflow: visible;
    }

    .estimates-list-panel,
    .invoices-list-panel,
    .payments-list-panel,
    .expenses-list-panel,
    .customers-list-panel,
    .po-list-panel {
        height: auto;
        border-right: none;
        padding-right: 0;
    }

    .estimate-details-panel,
    .invoice-details-panel,
    .payment-details-panel,
    .expense-details-panel,
    .customer-details-panel,
    .po-details-panel {
        display: none;
    }

    .estimate-details-panel.show-mobile,
    .invoice-details-panel.show-mobile,
    .payment-details-panel.show-mobile,
    .expense-details-panel.show-mobile,
    .customer-details-panel.show-mobile,
    .po-details-panel.show-mobile {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #0f325d;
        z-index: 1050;
        padding: 20px;
        overflow-y: auto;
    }
}

/* ============================================
   Select2 Glassmorphism - NUCLEAR OVERRIDE
   ============================================ */

/* Force Container Width and Layout */
.select2-container,
.select2-container--default,
.items-table .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* THE SELECTION BOX - Match .glass-input exactly */
.select2-container--default .select2-selection--single,
.glass-modal .select2-container--default .select2-selection--single,
.glass-card .select2-container--default .select2-selection--single,
#estimateForm .select2-container--default .select2-selection--single {
    background-color: rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 8px !important;
    height: 38px !important;
    outline: none !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
    overflow: hidden !important;
}

/* Selection Text */
.select2-container--default
    .select2-selection--single
    .select2-selection__rendered {
    color: #ffffff !important;
    padding-left: 12px !important;
    padding-right: 30px !important;
    line-height: normal !important;
    display: block !important;
    width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Placeholder */
.select2-container--default
    .select2-selection--single
    .select2-selection__placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* The Arrow */
.select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    height: 36px !important;
    top: 1px !important;
    right: 5px !important;
    width: 20px !important;
}

.select2-container--default
    .select2-selection--single
    .select2-selection__arrow
    b {
    border-color: #ffffff transparent transparent transparent !important;
    border-width: 5px 4px 0 4px !important;
}

/* Focus / Active state */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: #f23054 !important;
    box-shadow: 0 0 0 0.2rem rgba(242, 48, 84, 0.25) !important;
}

/* Dropdown Wrapper */
.select2-dropdown {
    background: #1a447e !important;
    background: rgba(26, 68, 126, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    z-index: 9999 !important;
}

/* Results */
.select2-results__option {
    color: #ffffff !important;
    padding: 8px 12px !important;
}

.select2-container--default
    .select2-results__option--highlighted[aria-selected] {
    background-color: #f23054 !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Dropdown Search */
.select2-container--default .select2-search--dropdown .select2-search__field {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    border-radius: 4px !important;
}

/* ============================================
   Flatpickr Date Picker - Glass Theme
   ============================================ */
.flatpickr-calendar {
    background: rgba(27, 76, 140, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    border-radius: 10px !important;
}

.flatpickr-months {
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px 10px 0 0 !important;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month {
    color: #ffffff !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months option {
    background-color: #1b4c8c !important; /* Solid dark blue for visibility */
    color: #ffffff !important;
}

.flatpickr-current-month input.cur-year {
    color: #ffffff !important;
    background: transparent !important;
}

.flatpickr-weekdays {
    background: rgba(255, 255, 255, 0.1) !important;
}

span.flatpickr-weekday {
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 600 !important;
}

.flatpickr-day {
    color: #ffffff !important;
    border-radius: 6px !important;
}

.flatpickr-day:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: transparent !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: #f23054 !important;
    border-color: #f23054 !important;
    color: #ffffff !important;
}

.flatpickr-day.today {
    border-color: #f23054 !important;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: rgba(255, 255, 255, 0.4) !important;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: #ffffff !important;
    fill: #ffffff !important;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: #f23054 !important;
}

.flatpickr-input {
    cursor: pointer !important;
}

.pointer {
    cursor: pointer;
}

/* ============================================
   Sidebar Enhancement (Icon-Only + Hover)
   ROOT FIX: Scroll on INNER menu, not container
   ============================================ */
@media (min-width: 992px) {
    :root {
        --sidebar-collapsed-width: 80px;
        --sidebar-expanded-width: 260px;
        --sidebar-header-height: 70px;
    }

    /* CONTAINER: Fixed position, NO scroll */
    .sidebar {
        width: var(--sidebar-collapsed-width);
        height: 100vh;
        overflow: hidden;
        white-space: nowrap;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
    }

    .sidebar:hover {
        width: var(--sidebar-expanded-width);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.4);
    }

    /* HEADER styling */
    .sidebar .sidebar-header {
        flex-shrink: 0;
        height: var(--sidebar-header-height);
        padding: 0 10px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar .sidebar-header h4 {
        margin: 0;
        display: flex;
        align-items: center;
    }

    .sidebar .sidebar-header h4 i {
        font-size: 1.5rem;
        flex-shrink: 0;
    }

    /* MENU AREA: THIS scrolls */
    .sidebar .sidebar-menu {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        margin-top: 0 !important;
        padding-bottom: 20px;
    }

    /* Scrollbar styling for menu */
    .sidebar .sidebar-menu::-webkit-scrollbar {
        width: 4px;
    }

    .sidebar .sidebar-menu::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar .sidebar-menu::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }

    .sidebar:hover .sidebar-menu::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.4);
    }

    /* NAV LINKS - Icon centering in collapsed mode */
    .sidebar .nav-link {
        display: flex;
        align-items: center;
        padding: 10px 0;
        justify-content: center;
    }

    .sidebar .nav-link i {
        width: 30px;
        text-align: center;
        flex-shrink: 0;
        margin: 0 !important;
    }

    .sidebar:hover .nav-link {
        justify-content: flex-start;
        padding: 10px 15px;
    }

    .sidebar:hover .nav-link i {
        margin-right: 10px !important;
    }

    /* Main content margin */
    .main-content {
        margin-left: var(--sidebar-collapsed-width);
        transition: margin-left 0.3s ease;
    }

    /* Toggle Text Visibility - HIDE by default */
    .sidebar .nav-text {
        display: none;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    /* Show text on hover */
    .sidebar:hover .nav-text {
        display: inline;
        opacity: 1;
    }

    /* Hide toggle button in collapsed mode */
    .sidebar .sidebar-toggle-btn {
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar:hover .sidebar-toggle-btn {
        opacity: 1;
    }

    /* ============================================
       PINNED STATE - Sidebar stays expanded
       ============================================ */
    .sidebar.pinned {
        width: var(--sidebar-expanded-width);
    }

    .sidebar.pinned .nav-text {
        display: inline;
        opacity: 1;
    }

    .sidebar.pinned .nav-link {
        justify-content: flex-start;
        padding: 10px 15px;
    }

    .sidebar.pinned .nav-link i {
        margin-right: 10px !important;
    }

    .sidebar.pinned .sidebar-toggle-btn {
        opacity: 1;
    }

    .sidebar.pinned ~ .main-content,
    body:has(.sidebar.pinned) .main-content {
        margin-left: var(--sidebar-expanded-width);
    }

    /* ============================================
       INSTANT PINNED STATE - Prevents flash on page load
       Applied via html class before JS runs
       ============================================ */
    html.sidebar-pinned .sidebar {
        width: var(--sidebar-expanded-width);
    }

    html.sidebar-pinned .sidebar .nav-text {
        display: inline;
        opacity: 1;
    }

    html.sidebar-pinned .sidebar .nav-link {
        justify-content: flex-start;
        padding: 10px 15px;
    }

    html.sidebar-pinned .sidebar .nav-link i {
        margin-right: 10px !important;
    }

    html.sidebar-pinned .sidebar .sidebar-toggle-btn {
        opacity: 1;
    }

    html.sidebar-pinned .main-content {
        margin-left: var(--sidebar-expanded-width);
    }
}
