@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap');

/* --- 1. Design Variables (Tokens) --- */
:root {
    /* Color Palette - Assuming a modern, clean, blue/green scheme */
    --primary-color: #007bff;
    /* Accent color (Buttons, active links) */
    --secondary-color: #6c757d;
    /* Secondary text/actions */
    --success-color: #28a745;
    /* Green for profit/success */
    --danger-color: #dc3545;
    /* Red for errors/alerts */
    --bg-light: #f4f6f9;
    /* Main content background */
    --bg-dark: #212529;
    /* Sidebar background (Dark mode) */
    --text-color: #495057;
    /* Default body text */
    --text-light: #f8f9fa;
    /* Text on dark backgrounds */
    --card-bg: #ffffff;
    /* Card/Panel backgrounds */
    --border-color: #dee2e6;
    /* Border color for cards, tables, etc. */

    /* Layout */
    --sidebar-width: 250px;
    --header-height: 60px;
    --border-radius: 6px;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.05);
    /* Soft card shadow */
}

/* --- 2. Global Resets and Typography --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16.5px; /* Sizable, legible root scale */
}

body {
    font-family: 'Poppins', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-color);
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

/* --- 3. Layout Structure --- */
#app {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

#content {
    flex-grow: 1;
    margin-left: 0; /* Sidebar is now a drawer, content takes full width */
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow-x: hidden;
    padding-top: var(--header-height);
    transition: margin-left 0.3s ease;
}

.content-wrapper {
    flex-grow: 1;
    padding: 20px;
}

.page-content {
    padding: 0;
    /* Already wrapped by content-wrapper padding */
}

/* --- 4. Sidebar (Sidenav) --- */
#sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--bg-dark);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    transform: translateX(-100%); /* Hidden by default globally */
    transition: transform 0.3s ease;
}

/* Make the sidebar layout a column so the nav list can scroll when too tall */
#sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px 20px;
    color: var(--text-light);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header a {
    color: inherit;
    text-decoration: none;
}

.sidebar-header a:hover {
    color: #ffffff !important;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-logo {
    height: 40px;
    width: auto;
    max-width: 40px;
    object-fit: contain;
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-links {
    list-style: none;
    padding: 10px 0;
}

/* Allow the nav links area to scroll while keeping header visible */
.nav-links {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Fill remaining sidebar height under the header */
    flex: 1 1 auto;
}

/* Polished scrollbar for the sidebar nav */
.nav-links {
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.nav-links::-webkit-scrollbar {
    width: 10px;
}
.nav-links::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}
.nav-links::-webkit-scrollbar-thumb {
    background-clip: padding-box;
    background-color: rgba(255,255,255,0.08);
    border-radius: 10px;
    border: 2px solid transparent; /* adds padding around thumb */
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.nav-links::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255,255,255,0.14);
}

/* Accent thumb when hovering the sidebar to match primary color */
#sidebar:hover .nav-links::-webkit-scrollbar-thumb {
    background-color: rgba(var(--primary-color-rgb, 14, 139, 51), 0.18);
}
#sidebar:hover .nav-links::-webkit-scrollbar-thumb:hover {
    background-color: rgba(var(--primary-color-rgb, 14, 139, 51), 0.28);
}

/* Sidebar-specific nav-link styles — scoped to #sidebar only */
#sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.75);
    /* Light text on dark sidebar */
    transition: background 0.2s, color 0.2s;
    border-left: 4px solid transparent;
}

#sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
}

/*  Active Link Styling (Figma-style prominence) — sidebar only */
#sidebar .nav-link.active {
    background: rgba(var(--primary-color-rgb, 14, 139, 51), 0.15);
    /* Light primary background */
    color: #ffffff !important;
    /* White text for visibility on dark sidebar */
    font-weight: 600;
    border-left-color: var(--primary-color);
}

#sidebar .nav-link.active .nav-icon {
    color: #ffffff !important;
}

#sidebar .nav-link i.nav-icon {
    margin-right: 12px;
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* --- 5. Header --- */
.main-header {
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: fixed;
    top: 0;
    left: 0; /* Header spans full width */
    right: 0;
    z-index: 1000;
    transition: left 0.3s ease;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.header-logo {
    height: 35px;
    width: auto;
    max-width: 50px;
    object-fit: contain;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.user-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.user-role {
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* --- 6. Buttons & Forms --- */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(var(--primary-color-rgb, 14, 139, 51), 0.2);
}

.btn-primary:hover {
    background: var(--primary-color);
    filter: brightness(0.85);
    box-shadow: 0 4px 8px rgba(var(--primary-color-rgb, 14, 139, 51), 0.3);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: var(--text-light);
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-color);
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: var(--text-color);
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Filter Form Specifics */
.filter-form {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 15px;
    align-items: center;
}

@media (max-width: 768px) {
    .filter-form {
        grid-template-columns: 1fr;
    }

    .filter-form .btn {
        width: 100%;
    }
}

/* Utilities */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-white {
    color: #fff !important;
}

.text-muted {
    color: #6c757d !important;
}

.bg-secondary {
    background-color: #6c757d !important;
}

.shadow-sm {
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075) !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.p-0 {
    padding: 0 !important;
}

.p-3 {
    padding: 1rem !important;
}

/* Table Enhancements */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

.table-sm th,
.table-sm td {
    padding: 0.3rem;
}

/* Page Header Tweaks */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

/* --- 7. KPI Cards (Dashboard) --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: transform 0.2s;
    border-left: 5px solid var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-content {
    flex: 1;
}

.kpi-card h3 {
    font-size: 0.75rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card p.kpi-value {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    word-break: break-word;
}

.kpi-card small {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.kpi-card.profit-card {
    border-left-color: var(--success-color);
}

.kpi-card.profit-card p.kpi-value {
    color: var(--success-color);
}

/* --- 8. Reusable Table Component (Card Styling) --- */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 600px;
    /* Ensure tables don't compress too much */
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #f8f9fa;
    color: var(--secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.data-table tbody tr:hover {
    background-color: #f1f3f5;
}

/* --- 9. Footer --- */
.main-footer {
    padding: 15px 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary-color);
    border-top: 1px solid var(--border-color);
}

/* --- 10. Login Page Styles (Used in login.ejs) --- */
.login-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    /* Already styled in login.ejs, these are just overrides if needed */
}

/* Initially, push content past sidebar width on large screens */
#content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

.sidebar-toggler {
    display: flex !important; /* Always visible globally */
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    padding: 0;
    width: 42px;
    height: 42px;
    background: var(--primary-color) !important; /* Maroon/red dynamic brand color */
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    margin-right: 15px;
    flex-shrink: 0;
}

.sidebar-toggler:hover {
    filter: brightness(0.85);
    transform: scale(1.03);
}

/* Global drawer state overlays */
#app.sidebar-open #sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.2);
}



@media (max-width: 992px) {
    /* Prevent horizontal overflow */
    #app {
        overflow-x: hidden;
    }
}

/* --- KPI Grid Adaptation (Make cards stack vertically on small screens) --- */
@media (max-width: 576px) {
    .kpi-grid {
        grid-template-columns: 1fr;
        /* Single column layout for very small screens */
    }

    .new-sale-grid {
        grid-template-columns: 1fr;
        /* Stack the item entry and summary vertically */
    }
}

/* --- 11. Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
}

.modal-content.modal-sm {
    max-width: 400px;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #f1f3f5;
}

.modal-body {
    padding: 25px 30px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Allow searchable dropdowns to overflow modal boundaries */
.modal-body .searchable-select-wrapper {
    position: relative;
}

.modal .searchable-select-dropdown {
    z-index: 9999 !important;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #dee2e6;
}

/* --- 12. Form Styles --- */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group .required {
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 0;
}

.form-row .form-group {
    margin-bottom: 20px;
}

@media (max-width: 576px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form .form-control {
    flex: 1;
    min-width: 200px;
}

/* --- 13. Pagination Styles --- */
.pagination-container {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination .btn-sm {
    min-width: 40px;
}

.pagination-ellipsis {
    padding: 0 10px;
    color: var(--secondary-color);
}

/* --- 14. Badge Styles --- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 12px;
    text-align: center;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* --- 15. Utility Classes --- */
.text-center {
    text-align: center;
}

.text-warning {
    color: var(--danger-color);
}

.loading {
    padding: 40px 20px;
    color: var(--secondary-color);
}

/* --- 16. Submenu Styles --- */
.nav-item-dropdown {
    position: relative;
}

.nav-submenu {
    list-style: none;
    padding-left: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
}

.nav-item-dropdown.open .nav-submenu {
    max-height: 500px;
}

#sidebar .nav-submenu .nav-link {
    padding: 10px 20px 10px 48px;
    font-size: 0.88rem;
    border-left: none;
}

#sidebar .nav-submenu .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff !important;
}

/* Navigation Icons */
.nav-icon {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 1rem;
    opacity: 0.85;
    transition: opacity 0.2s, color 0.2s;
}

#sidebar .nav-link:hover .nav-icon,
#sidebar .nav-link.active .nav-icon,
#sidebar .nav-link.active-parent .nav-icon {
    opacity: 1;
}

/* Sublink Icons */
.nav-icon-sub {
    width: 16px;
    text-align: center;
    margin-right: 10px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.nav-link-sub:hover .nav-icon-sub,
.nav-link-sub.active-sub .nav-icon-sub {
    opacity: 1;
}

/* Navigation Separator */
.nav-separator {
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 10%, 
        rgba(255, 255, 255, 0.08) 30%, 
        rgba(255, 255, 255, 0.08) 70%, 
        transparent 90%
    );
    margin: 8px 16px;
    list-style: none;
}

/* Parent Link with Submenus - Active State */
.nav-link-parent {
    position: relative;
}

#sidebar .nav-link.active-parent {
    background: rgba(var(--primary-color-rgb), 0.12);
    color: #ffffff !important;
    font-weight: 500;
    border-left-color: var(--primary-color);
}

#sidebar .nav-link.active-parent .nav-icon {
    color: #ffffff !important;
}

/* Sublink Active State - Slightly Different from Parent */
#sidebar .nav-link-sub.active-sub,
#sidebar .nav-submenu .nav-link.active-sub {
    background: rgba(var(--primary-color-rgb), 0.2);
    color: #ffffff !important;
    font-weight: 500;
    border-left: 3px solid var(--primary-color);
    padding-left: 45px;
}

#sidebar .nav-link-sub.active-sub .nav-icon-sub,
#sidebar .nav-submenu .nav-link.active-sub .nav-icon-sub {
    color: #ffffff !important;
}

/* Dropdown Icon */
.dropdown-icon {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.nav-item-dropdown.open .dropdown-icon {
    transform: rotate(180deg);
}

/* --- 17. Button Variants --- */
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* --- 18. Notification System Styles --- */
.notification-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.notification-btn {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: #495057;
    padding: 0.5rem;
    transition: color 0.2s;
}

.notification-btn:hover {
    color: var(--primary-color);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 9999;
    margin-top: 0.5rem;
}

.notification-dropdown.show {
    display: block;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h6 {
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

.btn-mark-all-read {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.btn-mark-all-read:hover {
    text-decoration: underline;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #e7f3ff;
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--primary-color);
}

.notification-content {
    position: relative;
    padding-left: 0.5rem;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: #adb5bd;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    float: left;
}

.notification-icon.warning {
    background: #fff3cd;
    color: #856404;
}

.notification-icon.info {
    background: #d1ecf1;
    color: #0c5460;
}

.notification-icon.success {
    background: #d4edda;
    color: #155724;
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: #adb5bd;
}

.notification-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* --- User Dropdown Styles --- */
.user-dropdown-wrapper {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-dropdown-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.user-avatar {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.user-name-text {
    font-weight: 500;
    color: #333;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: #666;
    transition: transform 0.2s;
}

.user-dropdown-wrapper.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-dropdown-wrapper.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-user-info {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.dropdown-user-info strong {
    color: #333;
    font-size: 0.95rem;
}

.dropdown-user-info span {
    color: #666;
    font-size: 0.8rem;
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item i {
    width: 16px;
    color: #666;
}

.dropdown-item-logout {
    color: var(--danger-color);
}

.dropdown-item-logout i {
    color: var(--danger-color);
}

.dropdown-item-logout:hover {
    background: #fef2f2;
}

/* User Dropdown Responsive */
@media (max-width: 575px) {
    .user-name-text {
        display: none;
    }
    
    .user-dropdown-btn {
        padding: 6px 8px;
    }
    
    .dropdown-arrow {
        display: none;
    }
}

/* ===============================================
   Searchable Select Component Styles
   =============================================== */

.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    width: 100%;
    cursor: pointer;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2rem;
}

.searchable-select-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23007bff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1070;
}

.searchable-select-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.searchable-select-dropdown li {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
}

.searchable-select-dropdown li:last-child {
    border-bottom: none;
}

.searchable-select-dropdown li:hover,
.searchable-select-dropdown li.focused {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

.searchable-select-dropdown li.no-results {
    color: var(--secondary-color);
    font-style: italic;
    cursor: default;
}

.searchable-select-dropdown li.no-results:hover {
    background-color: transparent !important;
    color: var(--secondary-color) !important;
}

/* Mobile optimizations for searchable select */
@media (max-width: 767px) {
    .searchable-select-dropdown {
        max-height: 200px;
    }
    
    .searchable-select-dropdown li {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .searchable-select-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .searchable-select-dropdown li {
        padding: 14px 12px;
    }
}

/* ============================================================
   Global Brand Header Banner Styles (used in layout.ejs)
   ============================================================ */
.dashboard-banner {
    background: #1e1e2d;
    color: #ffffff;
    border-left: 6px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.banner-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.banner-logo {
    font-size: 2.2rem;
    color: var(--primary-color);
}

.banner-title-group {
    display: flex;
    flex-direction: column;
}

.banner-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
    line-height: 1.2;
}

.banner-subtitle {
    font-size: 1.1rem;
    color: #a2a2c2;
    margin-top: 2px;
}

.banner-version {
    font-size: 0.85rem;
    color: #a2a2c2;
    margin-top: 2px;
}

.banner-user-info {
    text-align: right;
    margin-left: auto;
    margin-right: 24px;
}

.user-meta {
    font-size: 0.95rem;
    color: #e2e2e8;
}

.user-meta-label {
    font-style: italic;
    color: #a2a2c2;
    margin-right: 4px;
}

.user-meta-value {
    font-weight: 600;
}

.banner-user-info .user-role {
    font-size: 0.85rem;
    color: #a2a2c2;
    margin-top: 4px;
    font-weight: 500;
}

.banner-logout-btn {
    background-color: var(--danger-color, #dc3545);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.1s;
}

.banner-logout-btn:hover {
    background-color: #bd2130;
}

.banner-logout-btn:active {
    transform: scale(0.98);
}

.banner-back-btn,
.banner-stats-btn {
    transition: all 0.2s ease;
}

.banner-back-btn:hover,
.banner-stats-btn:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
    text-decoration: none;
}

@media (max-width: 768px) {
    .dashboard-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
    }
    .banner-user-info {
        text-align: left;
        margin-left: 0;
        margin-right: 0;
    }
    .banner-actions {
        width: 100%;
    }
    .banner-logout-btn,
    .banner-back-btn,
    .banner-stats-btn {
        width: 100% !important;
        justify-content: center;
    }
}