:root {
    --primary-color: #4e73df; /* A slightly more modern blue */
    --secondary-color: #00d4ff; /* A vibrant cyan for highlights */
    --dark-bg: #0a192f; /* Deep navy blue, almost black */
    --sidebar-bg: #0F2140; /* Slightly lighter navy for the sidebar */
    --card-bg: #1e2a47; /* Card background color */
    --text-color: #ccd6f6; /* Light gray-blue for main text */
    --light-text-color: #8892b0; /* Softer gray for subtitles and secondary text */
    --border-color: #30416a; /* Subtle border color */
    --success-color: #1cc88a;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --info-color: #36b9cc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    line-height: 1.6;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =================================== */
/* Sidebar                           */
/* =================================== */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
}

.sidebar-header {
    padding: 25px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: white;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .fas {
    color: var(--secondary-color);
}

.sidebar-nav {
    flex-grow: 1;
    padding: 20px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: var(--light-text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: background-color 0.3s, color 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background-color: var(--dark-bg);
    color: white;
}

.sidebar-nav a.active {
    background-color: var(--dark-bg);
    color: var(--secondary-color);
    border-left-color: var(--secondary-color);
}

.sidebar-nav a .fas {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* =================================== */
/* Main Content Area                 */
/* =================================== */
.main-content {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.welcome-message h1 {
    font-family: 'Orbitron', sans-serif;
    color: white;
    margin: 0;
    font-size: 2.2rem;
}

.welcome-message p {
    color: var(--light-text-color);
    margin: 5px 0 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* =================================== */
/* Reusable Components (Buttons, Etc)*/
/* =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { filter: brightness(1.2); }
.btn-danger { background: var(--danger-color); color: white; }
.btn-danger:hover { filter: brightness(1.2); }
.view-all-link { color: var(--secondary-color); text-decoration: none; font-weight: 500; transition: color 0.3s; }
.view-all-link:hover { color: white; }


/* =================================== */
/* Cards                             */
/* =================================== */
.dashboard-card, .stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 25px;
    transition: transform 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.dashboard-card:hover, .stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--secondary-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h4 {
    margin: 0;
    color: var(--text-color);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header .fas {
    color: var(--secondary-color);
}

.card-body {
    padding: 25px;
}

/* Stat Cards (Top Row) */
.stat-card .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
}

.stat-card .stat-icon {
    font-size: 2.2rem;
    padding: 1rem;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
}

/* Gradients for Stat Icons */
.icon-primary { background: linear-gradient(45deg, #4e73df, #224abe); }
.icon-success { background: linear-gradient(45deg, #1cc88a, #13855c); }
.icon-info   { background: linear-gradient(45deg, #36b9cc, #2a96a5); }
.icon-warning { background: linear-gradient(45deg, #f6c23e, #dda20a); }
.icon-danger  { background: linear-gradient(45deg, #e74a3b, #be2617); }

.stat-card .stat-text { text-align: right; }
.stat-card .stat-text .text-xs {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--light-text-color);
    margin-bottom: 5px;
}

.stat-card .stat-text .h5 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Specific Card Content Styling */
.list-group-flush .list-group-item {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
}

.top-agent-card .fa-award {
    font-size: 4rem;
    color: var(--warning-color);
    text-shadow: 0 0 15px rgba(246, 194, 62, 0.5);
}

/* =================================== */
/* Tables                            */
/* =================================== */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table thead th {
    font-weight: 700;
    color: var(--light-text-color);
    text-transform: uppercase;
    font-size: 0.85rem;
}

.admin-table tbody tr:hover {
    background-color: rgba(30, 42, 71, 0.7);
}


/* =================================== */
/* Media Queries & Responsive Design   */
/* =================================== */
@media (max-width: 992px) {
    .sidebar { width: 70px; }
    .sidebar-header span, .sidebar-nav span, .sidebar-footer span { display: none; }
    .sidebar-header { justify-content: center; }
}

@media (max-width: 768px) {
    .admin-wrapper { flex-direction: column; }
    .sidebar { width: 100%; height: auto; flex-direction: row; align-items: center; }
    .sidebar-header { border-bottom: none; border-right: 1px solid var(--border-color); }
    .sidebar-nav { display: flex; flex-direction: row; overflow-x: auto; padding: 0;}
    .sidebar-nav a { border-left: none; border-bottom: 3px solid transparent; }
    .sidebar-nav a.active { border-bottom-color: var(--secondary-color); }
    .sidebar-footer { display: none; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 15px; }

    /* Responsive Table Styles */
    .admin-table thead { display: none; }
    .admin-table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--sidebar-bg);
    }
   .admin-table td {
    display: block;
    text-align: right;
    padding-left: 50%;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    white-space: normal; /* Add this line */
    word-break: break-word; /* Add this line */
}
    .admin-table td:last-child { border-bottom: 0; }
    .admin-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: calc(50% - 30px);
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 700;
        color: var(--text-color);
    }
}

/* =================================== */
/* Enhanced Modal Styles             */
/* =================================== */

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px; /* Softer corners */
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3); /* Pop it off the page */
    color: var(--text-color);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    transition: transform 0.3s ease;
}
.modal-header .btn-close:hover {
    transform: rotate(90deg);
}

.modal-title {
    color: var(--secondary-color);
    font-family: 'Orbitron', sans-serif; /* Consistent with card headers */
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background-color: rgba(0,0,0,0.2); /* Slightly different footer bg */
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* Custom notice box inside modals */
.modal-notice {
    background-color: rgba(23, 162, 184, 0.1);
    border-left: 4px solid var(--info-color);
    color: var(--info-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-notice small {
    color: var(--light-text-color);
}


/* =================================== */
/* Table Text Color & Contextual Fixes */
/* =================================== */

/* Set the default text color for all data cells in the table body */
.admin-table tbody td {
    color: var(--text-color);
}

/* Override Bootstrap's default styles for warning/danger rows to match our dark theme */
.admin-table tr.table-warning,
.admin-table tr.table-warning:hover {
    background-color: rgba(246, 194, 62, 0.1); /* Faint yellow background */
}
.admin-table tr.table-warning td {
    color: var(--warning-color); /* Bright yellow text */
}

.admin-table tr.table-danger,
.admin-table tr.table-danger:hover {
    background-color: rgba(231, 74, 59, 0.1); /* Faint red background */
}
.admin-table tr.table-danger td {
    color: var(--danger-color); /* Bright red text */
}


/* ========================================= */
/* ===== Point of Sale (POS) Page Styles ===== */
/* ========================================= */

#pos-container {
    display: flex;
    flex-wrap: wrap; /* Allows panels to wrap on smaller screens */
    gap: 25px;
    /* Full viewport height minus the top header and some padding */
    height: calc(100vh - 120px); 
}

#left-panel, #right-panel {
    display: flex;
    flex-direction: column;
    padding: 0; /* Remove padding from dashboard-card to allow full height content */
}

#left-panel {
    flex: 3; /* Takes up more space */
    min-width: 350px;
}
#right-panel {
    flex: 2; /* Takes up less space */
    min-width: 320px;
}

#search-results, #cart-items {
    overflow-y: auto;
    flex-grow: 1;
}

/* Custom styling for list items in POS */
.pos-list-item {
    background-color: var(--sidebar-bg);
    border-color: var(--border-color);
    color: var(--text-color);
    transition: background-color 0.2s ease;
    padding: 1rem;
}

.pos-list-item:hover {
    background-color: var(--dark-bg);
    cursor: pointer;
}

#total-display {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    color: var(--secondary-color);
    letter-spacing: 1px;
}

.qty-input {
    width: 60px;
    background-color: var(--dark-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
}

#cart-items strong {
    color: white;
}
#cart-items small {
    color: var(--light-text-color);
}
.remove-item-btn {
    width: 32px;
    height: 32px;
    line-height: 1;
    font-size: 1.2rem;
}
.pos-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--light-text-color);
}

/* --- Responsive Styles for Mobile & Tablet --- */
@media (max-width: 992px) {
    #pos-container {
        flex-direction: column; /* Stack panels vertically */
        height: auto; /* Let height be natural on mobile */
    }

    #left-panel, #right-panel {
        flex: 1; /* Make panels take full width */
        min-height: 400px; /* Ensure they have some height */
    }
}

/* ========================================= */
/* ===== Select2 Dark Theme Override     ===== */
/* ========================================= */
.select2-container--default .select2-selection--single {
    background-color: var(--dark-bg);
    border: 1px solid var(--border-color);
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    border-radius: 8px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-color);
    line-height: 1.5;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--light-text-color) transparent transparent transparent;
}
.select2-dropdown {
    background-color: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.select2-search--dropdown .select2-search__field {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 6px;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color);
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--border-color);
}

/* ========================================= */
/* ===== Custom Instruction List Styles  ===== */
/* ========================================= */
.instruction-list {
    list-style: none;
    padding-left: 0;
}
.instruction-list li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}
.instruction-list .icon-circle {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background-color: var(--sidebar-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 1.2rem;
    border: 1px solid var(--border-color);
}

/* ========================================= */
/* ===== Status Badge Styles             ===== */
/* ========================================= */
.status-badge { 
    padding: 5px 12px; 
    border-radius: 50rem; /* pill shape */
    font-size: 0.8rem; 
    font-weight: 700; 
    text-transform: capitalize; 
    display: inline-block;
}
.status-badge.status-active { 
    background: rgba(28, 200, 138, 0.15); /* --success-color with opacity */
    color: var(--success-color); 
}
.status-badge.status-inactive { 
    background: rgba(231, 74, 59, 0.15); /* --danger-color with opacity */
    color: var(--danger-color); 
}

/* ========================================= */
/* ===== Report Page Enhancements        ===== */
/* ========================================= */

.report-controls {
    flex-wrap: wrap; /* Allow items to wrap on small screens */
    gap: 15px;
}
.admin-table tr.out-of-stock td {
    color: var(--danger-color);
    opacity: 0.7;
}

/* ========================================= */
/* ===== Print-Specific Styles         ===== */
/* ========================================= */
@media print {
    body {
        background-color: #fff !important;
        color: #000 !important;
    }
    .admin-wrapper {
        display: block;
    }
    .sidebar, .dashboard-header, .report-controls, .dashboard-card .card-header h4 .fas {
        display: none !important;
    }
    .main-content {
        padding: 0;
    }
    .dashboard-card, .dashboard-card .card-body {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .card-header {
        border-bottom: 2px solid #000 !important;
        padding: 0 0 10px 0 !important;
        margin-bottom: 20px !important;
    }
     .card-header h4 {
        color: #000 !important;
        font-size: 1.5rem !important;
    }
    .stat-card {
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }
    .stat-card .h5, .stat-card .text-xs, .stat-card .fas {
        color: #000 !important;
    }
    .stat-card .stat-icon {
        background: #eee !important;
    }
    .admin-table, .admin-table th, .admin-table td {
        border-color: #ccc !important;
        color: #000 !important;
    }
    a {
        text-decoration: none !important;
        color: inherit !important;
    }
}


.admin-table tr.table-info,
.admin-table tr.table-info:hover {
    background-color: rgba(54, 185, 204, 0.1); /* Faint info-blue background */
}
.admin-table tr.table-info td {
    color: var(--info-color); /* Bright info-blue text */
}

/* ========================================= */
/* ===== POS Payment Modal Styles        ===== */
/* ========================================= */
.payment-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    font-size: 1.1rem;
    border: 1px solid var(--border-color);
    background-color: var(--sidebar-bg);
    border-radius: 8px;
    transition: all 0.2s ease;
    height: 100%;
}
.payment-method-btn:hover, .payment-method-btn.active {
    background-color: var(--primary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: translateY(-5px);
}
.payment-method-btn i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}
#split-payment-fields .input-group-text {
    width: 80px; /* Align text in split payment inputs */
}
#payment-summary {
    background-color: var(--dark-bg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
}
#payment-summary #amount-remaining {
    font-weight: bold;
    font-size: 1.2rem;
}

/* ========================================= */
/* ===== Barcode Scanner Styles        ===== */
/* ========================================= */
#reader {
    width: 100%;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden; /* To keep the video stream within the rounded corners */
}

#reader video {
    width: 100%;
    height: auto;
    display: block;
}
