/* Golden Scents Admin System - Black & Gold Theme */

:root {
    --gold-primary: #D4AF37;
    --gold-light: #F4D03F;
    --gold-dark: #B8960C;
    --gold-gradient: linear-gradient(135deg, #D4AF37 0%, #F4D03F 50%, #D4AF37 100%);

    /* Dark Mode (Default) */
    --black-primary: #000000;
    --black-secondary: #000000;
    --black-tertiary: #000000;
    --black-card: #000000;
    --text-gold: #D4AF37;
    --text-white: #FFFFFF;
    --text-gray: #888888;
    --text-light-gray: #CCCCCC;
    --border-gold: #D4AF37;
    --border-dark: #333333;
    --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.3);
    --shadow-dark: 0 4px 6px rgba(0, 0, 0, 0.5);

    /* Status Colors */
    --success: #28A745;
    --danger: #DC3545;
    --warning: #FFC107;
    --info: #17A2B8;

    --transition: all 0.3s ease;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--black-primary);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    border-top-color: var(--gold-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Light Mode Variables */
body.light-mode {
    --black-primary: #F5F5F5;
    --black-secondary: #FFFFFF;
    --black-tertiary: #E9ECEF;
    --black-card: #FFFFFF;
    --text-white: #333333;
    --text-light-gray: #555555;
    --text-gray: #666666;
    --border-dark: #DDDDDD;
    --shadow-dark: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-gold: 0 0 15px rgba(212, 175, 55, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--black-primary);
    color: var(--text-white);
    min-height: 100vh;
    line-height: 1.6;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--black-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gold-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--black-secondary);
    border-right: 1px solid var(--border-dark);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-dark);
}

.sidebar-header img {
    max-width: 150px;
    height: auto;
}

.sidebar-header h2 {
    color: var(--gold-primary);
    font-size: 1.2rem;
    margin-top: 10px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-section {
    margin-bottom: 10px;
}

.nav-section-title {
    color: var(--text-gray);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 20px;
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-light-gray);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--black-tertiary);
    color: var(--gold-primary);
    border-left-color: var(--gold-primary);
}

.nav-link.active {
    background: var(--black-tertiary);
    color: var(--gold-primary);
    border-left-color: var(--gold-primary);
}

.nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
}

.nav-link span {
    font-size: 0.95rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    background: var(--black-primary);
    transition: margin-left 0.3s ease;
    min-width: 0;
    width: 100%;
}

/* Top Header */
.top-header {
    background: var(--black-secondary);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-dark);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    color: var(--gold-primary);
    font-size: 1.5rem;
    font-weight: 600;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-header-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-height: 32px;
    width: auto;
    pointer-events: none;
}

@media (max-width: 768px) {
    .page-title {
        max-width: 130px;
    }
}

/* Below this, the sidebar (260px) leaves too little room for the hamburger,
   page title and action icons to coexist with a centered logo without the
   longer real page titles (e.g. "Sales & Supplier Reports") overlapping it -
   so it's only shown from a width that's been verified clear at every title
   length actually used in this app. */
@media (max-width: 1300px) {
    .top-header-logo {
        display: none;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light-gray);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--black-primary);
    font-weight: bold;
}

.user-details .user-name {
    font-weight: 600;
    color: var(--text-white);
}

.user-details .user-role {
    font-size: 0.8rem;
    color: var(--gold-primary);
    text-transform: capitalize;
}

#sidebarToggle {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-white);
    margin-right: 15px;
}

#sidebarToggle:hover {
    background: transparent;
    border: none;
    color: var(--gold-primary);
    transform: none;
    box-shadow: none;
}

/* Content Area */
.content-area {
    padding: 30px;
}

/* Cards */
.card {
    background: var(--black-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--gold-dark);
    box-shadow: var(--shadow-gold);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.card-header:hover {
    background: var(--black-card);
}

.card-header .collapse-icon {
    transition: transform 0.3s ease;
    margin-left: 10px;
    color: var(--gold-primary);
    font-size: 1.2em;
}

.card-header.collapsed .collapse-icon,
.card-header .collapse-icon.collapsed {
    transform: rotate(-90deg);
}

.card-title {
    color: var(--gold-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.card-body, .card-body-collapsible {
    padding: 20px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.card-body.collapsed, .card-body-collapsible.collapsed {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-dark);
    background: rgba(0, 0, 0, 0.2);
}

/* Stat Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--black-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: var(--gold-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--black-primary);
}

.stat-info h3 {
    color: var(--text-gray);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: var(--text-white);
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-change {
    font-size: 0.85rem;
    margin-top: 5px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table thead {
    background: var(--black-tertiary);
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    color: var(--gold-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gold-dark);
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-dark);
    color: var(--text-light-gray);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--black-tertiary);
}

.data-table tbody tr:hover td {
    color: var(--text-white);
}

/* Scrollable Table Wrapper (matches POS History) */
.scrollable-table-wrapper {
    max-height: 600px;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
}

.scrollable-table-wrapper table {
    width: 100%;
    margin-bottom: 0;
}

.scrollable-table-wrapper thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.scrollable-table-wrapper thead th {
    background: var(--black-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--gold-primary);
    box-shadow: 0 2px 0 var(--gold-primary);
    /* Ensures border is visible when sticky */
}

/* Scrollbar styling for the wrapper */
.scrollable-table-wrapper::-webkit-scrollbar,
.pos-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.scrollable-table-wrapper::-webkit-scrollbar-track,
.pos-table-wrapper::-webkit-scrollbar-track {
    background: var(--black-secondary);
}

.scrollable-table-wrapper::-webkit-scrollbar-thumb,
.pos-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--gold-primary);
    border-radius: 4px;
}

.scrollable-table-wrapper::-webkit-scrollbar-thumb:hover,
.pos-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--gold-light);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gold-gradient);
    color: var(--black-primary);
}

.btn-primary:hover {
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--black-tertiary);
    color: var(--text-white);
    border: 1px solid var(--border-dark);
}

.btn-secondary:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.btn-outline {
    background: transparent;
    color: var(--gold-primary);
    border: 1px solid var(--gold-primary);
}

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

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

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

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

.btn-success:hover {
    background: #218838;
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 6px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--text-light-gray);
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--black-tertiary);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: var(--text-white);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--gold-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

/* Date input calendar styling */
input[type="date"] {
    position: relative;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(1);
    opacity: 0.7;
    padding: 5px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.form-control::placeholder {
    color: var(--text-gray);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23D4AF37' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

select.form-control option {
    background: var(--black-secondary);
    color: var(--text-white);
}

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

.form-text {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Grid items default to min-width: auto, so a field with long unwrapped text (e.g. a
   searchable dropdown showing a long product name) would widen its column and push
   over its neighbours. Let cells shrink to their column so the text ellipsises. */
.form-row > * {
    min-width: 0;
}

/* Client-side form validation (shared, site-wide) */
.field-invalid {
    border-color: var(--danger-color, #e74c3c) !important;
    box-shadow: 0 0 0 1px var(--danger-color, #e74c3c) inset;
}

.form-error-summary {
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid var(--danger-color, #e74c3c);
    color: #e74c3c;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.field-error-msg {
    display: none;
    color: var(--danger-color, #e74c3c);
    font-size: 0.78rem;
    margin-top: 4px;
}

/* Input Group */
.input-group {
    display: flex;
}

.input-group .form-control {
    flex: 1;
    border-radius: 6px 0 0 6px;
}

.input-group-text {
    padding: 12px 15px;
    background: var(--black-tertiary);
    border: 1px solid var(--border-dark);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--gold-primary);
    font-weight: 600;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-gold {
    background: var(--gold-primary);
    color: var(--black-primary);
}

.badge-success {
    background: var(--success);
    color: var(--text-white);
}

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

.badge-warning {
    background: var(--warning);
    color: var(--black-primary);
}

.badge-info {
    background: var(--info);
    color: var(--text-white);
}

.badge-secondary {
    background: var(--black-tertiary);
    color: var(--text-light-gray);
}

.badge-primary {
    background: var(--gold-primary);
    color: var(--black-primary);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    border-color: var(--info);
    color: var(--info);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--black-secondary);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    color: var(--gold-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-dark);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-dark);
    margin-bottom: 20px;
}

.tab-link {
    padding: 12px 24px;
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab-link:hover {
    color: var(--gold-primary);
}

.tab-link.active {
    color: var(--gold-primary);
    border-bottom-color: var(--gold-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.page-link {
    padding: 8px 14px;
    background: var(--black-tertiary);
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    color: var(--text-light-gray);
    text-decoration: none;
    transition: var(--transition);
}

.page-link:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.page-link.active {
    background: var(--gold-primary);
    color: var(--black-primary);
    border-color: var(--gold-primary);
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--black-primary);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--black-secondary);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

.login-logo {
    max-width: 180px;
    margin-bottom: 30px;
}

.login-title {
    color: var(--gold-primary);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.login-subtitle {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.login-form .form-group {
    text-align: left;
}

.login-form .btn {
    width: 100%;
    margin-top: 10px;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
}

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Utilities */
.text-gold {
    color: var(--gold-primary);
}

.text-white {
    color: var(--text-white);
}

.text-gray {
    color: var(--text-gray);
}

.text-success {
    color: var(--success);
}

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

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

.bg-gold {
    background: var(--gold-primary);
}

.bg-black {
    background: var(--black-primary);
}

.bg-dark {
    background: var(--black-secondary);
}

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

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

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

/* Force center alignment for all table cells */
.data-table th,
.data-table td {
    text-align: center !important;
    vertical-align: middle;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

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

.mb-1 {
    margin-bottom: 10px;
}

.mb-2 {
    margin-bottom: 20px;
}

.mb-3 {
    margin-bottom: 30px;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 10px;
}

.mt-2 {
    margin-top: 20px;
}

.mt-3 {
    margin-top: 30px;
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: 10px;
}

.p-2 {
    padding: 20px;
}

.p-3 {
    padding: 30px;
}

.d-flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

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

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: 10px;
}

.gap-2 {
    gap: 20px;
}

.hidden {
    display: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
}

/* Search & Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--black-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
}

.filter-bar .form-control {
    max-width: 200px;
}

.search-input {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input input {
    padding-left: 40px;
}

.search-input i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
}

/* Summary Boxes */
.summary-box {
    background: var(--black-tertiary);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.summary-box .label {
    color: var(--text-gray);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.summary-box .value {
    color: var(--gold-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-header h2,
    .nav-section-title,
    .nav-link span {
        display: none;
    }

    .nav-link {
        justify-content: center;
        padding: 15px;
    }

    .nav-link i {
        margin: 0;
        font-size: 1.3rem;
    }

    .main-content {
        margin-left: 70px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px !important;
        /* Force full width on mobile, overriding collapsed state */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    /* Hide sidebar header logo in mobile view if needed or adjust padding */
    .sidebar-header {
        padding: 20px !important;
        justify-content: center;
    }

    .sidebar-header img {
        max-width: 150px !important;
    }

    /* Ensure text is visible on mobile regardless of collapsed state */
    .nav-section-title {
        display: block !important;
    }

    .nav-link {
        justify-content: flex-start !important;
        padding: 12px 20px !important;
        text-align: left !important;
    }

    .nav-link span {
        display: inline !important;
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: none !important;
        padding: 0 !important;
        border: none !important;
        transform: none !important;
        margin-left: 0 !important;
    }

    .nav-link i {
        margin-right: 12px !important;
        font-size: 1.1rem !important;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar .form-control,
    .search-input {
        max-width: 100%;
    }

    /* Top Header Mobile Adjustments */
    .top-header {
        padding: 10px 15px !important;
    }

    .page-title {
        font-size: 1.1rem !important;
    }

    .header-actions {
        gap: 10px !important;
    }

    .user-details {
        display: none !important;
    }

    .hide-mobile {
        display: none !important;
    }

    .content-area {
        padding: 15px !important;
    }

    /* Logout button styling compact on mobile */
    .top-header a.btn {
        padding: 6px 8px !important;
    }

    .top-header a.btn i {
        margin: 0 !important;
    }

    /* Horizontal scroll settings for table containers */
    .scrollable-table-wrapper, .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .top-header,
    .btn,
    .filter-bar {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .card {
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    body {
        background: white;
        color: black;
    }

    .data-table th,
    .data-table td {
        color: black;
        border-color: #ddd;
    }
}

/* Sidebar Collapse Styles */
body.sidebar-collapsed .sidebar {
    width: 70px;
}

body.sidebar-collapsed .main-content {
    margin-left: 70px;
}

body.sidebar-collapsed .sidebar-header img {
    max-width: 40px;
}

body.sidebar-collapsed .nav-section-title {
    display: none;
}

body.sidebar-collapsed .nav-link span {
    display: none;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 15px 0;
    text-align: center;
}

body.sidebar-collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.4rem;
}

body.sidebar-collapsed .sidebar-header {
    padding: 15px 5px;
    display: flex;
    justify-content: center;
}

/* Tooltip for collapsed sidebar */
body.sidebar-collapsed .nav-link:hover {
    position: relative;
    overflow: visible;
}

body.sidebar-collapsed .nav-link:hover::after {
    content: attr(title);
    /* Use title attribute if available, or I need to add spans back? No, spans are hidden */
    /* I can't easily get text content if span is display:none. I should use visibility or position absolute */
}

/* Better tooltip approach: */
body.sidebar-collapsed .nav-link span {
    display: block;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--black-secondary);
    color: var(--gold-primary);
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    border: 1px solid var(--gold-primary);
    z-index: 1000;
    margin-left: 10px;
    transition: opacity 0.2s;
    pointer-events: none;
}

body.sidebar-collapsed .nav-link:hover span {
    opacity: 1;
    visibility: visible;
}

/* Sidebar hover expand when collapsed */
body.sidebar-collapsed .sidebar:hover {
    width: 260px;
}

body.sidebar-collapsed .sidebar:hover .sidebar-header img {
    max-width: 150px;
}

body.sidebar-collapsed .sidebar:hover .nav-section-title {
    display: block;
}

body.sidebar-collapsed .sidebar:hover .nav-link {
    justify-content: flex-start;
    padding: 12px 20px;
    text-align: left;
}

body.sidebar-collapsed .sidebar:hover .nav-link i {
    margin-right: 12px;
    font-size: 1.1rem;
}

body.sidebar-collapsed .sidebar:hover .nav-link span {
    display: inline;
    position: static;
    transform: none;
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    white-space: normal;
    opacity: 1;
    visibility: visible;
    border: none;
    margin-left: 0;
}

body.sidebar-collapsed .sidebar:hover .sidebar-header {
    padding: 20px;
}

/* Push main content when sidebar expands on hover */
body.sidebar-collapsed .sidebar:hover+.main-content {
    margin-left: 260px;
}

/* Transaction Type Options (Shareholder Modal) */
.transaction-type-option:has(input:checked) {
    border-color: var(--gold-primary) !important;
    background: rgba(212, 175, 55, 0.1) !important;
}

.transaction-type-option:hover {
    border-color: var(--gold-primary);
    transform: translateY(-2px);
}

/* ==========================================
   TABLE CONTROLS - Sorting & Filtering
   ========================================== */

/* Sortable Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    position: relative;
}

th.sortable:hover {
    background: rgba(212, 175, 55, 0.1);
}

th.sortable .sort-icon {
    margin-left: 5px;
    display: inline-block;
}

/* Filter Bar */
.table-filter-bar {
    margin-bottom: 0;
}

.filter-bar-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--black-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-dark);
}

.filter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gold-primary);
}

.filter-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 0 auto;
}

.filter-group-date-range {
    flex-direction: row;
    gap: 8px;
}

.date-range-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input {
    min-width: 120px;
    height: 38px;
    padding: 6px 12px;
    font-size: 0.85rem;
    background-color: var(--black-tertiary);
    border: 1px solid var(--border-dark);
    color: var(--text-white);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.filter-input:focus {
    border-color: var(--gold-primary);
    background-color: var(--black-secondary);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
    outline: none;
}

.filter-input::placeholder {
    color: var(--text-gray);
}

/* Custom Select Style */
select.filter-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D4AF37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 30px;
}

/* Date Input Style */
input[type="date"].filter-input {
    color-scheme: dark;
}

input[type="date"].filter-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

input[type="date"].filter-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Light Mode - Filter Inputs */
body.light-mode .filter-input {
    background-color: #ffffff;
    border-color: #cccccc;
    color: #333333;
}

body.light-mode .filter-input:focus {
    background-color: #ffffff;
    border-color: var(--gold-primary);
}

body.light-mode .filter-input::placeholder {
    color: #888888;
}

body.light-mode input[type="date"].filter-input {
    color-scheme: light;
}

body.light-mode input[type="date"].filter-input::-webkit-calendar-picker-indicator {
    filter: none;
}

body.light-mode select.filter-input option {
    background: #ffffff;
    color: #333333;
}

/* Active Filters Display */
.active-filters {
    display: none;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.active-filters-label {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-right: 5px;
}

.filter-tag {
    display: inline-block;
    background: var(--gold-primary);
    color: #000;
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 0.8rem;
    font-weight: 500;
}

.filter-tag .remove-filter {
    cursor: pointer;
    margin-left: 5px;
    opacity: 0.7;
}

.filter-tag .remove-filter:hover {
    opacity: 1;
}

/* Row Count */
.table-row-count {
    text-align: right;
    padding: 8px 0;
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* Responsive Filter Bar */
@media (max-width: 768px) {
    .filter-bar-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-inputs {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-input {
        width: 100%;
    }

    .filter-actions {
        justify-content: stretch;
    }

    .filter-actions button {
        flex: 1;
    }
}

/* =======================================
   SEARCHABLE DROPDOWN COMPONENT
   ======================================= */
.searchable-dropdown {
    position: relative;
    width: 100%;
    /* Fill the row height when a neighbouring field's text wraps, like plain inputs do */
    display: flex;
}

.searchable-dropdown-selected {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 12px 40px 12px 15px;
    background: var(--black-tertiary);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    color: var(--text-white);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Long names (e.g. products) wrap onto extra lines so the full text stays readable
       instead of being cut off or widening the column. */
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.searchable-dropdown-selected:hover,
.searchable-dropdown-selected:focus {
    border-color: var(--gold-primary);
    outline: none;
}

.searchable-dropdown-selected::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gold-primary);
}

.searchable-dropdown.open .searchable-dropdown-selected::after {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--black-secondary);
    border: 1px solid var(--gold-primary);
    border-radius: 6px;
    margin-top: 4px;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: 350px;
    overflow: hidden;
}

.searchable-dropdown.open .searchable-dropdown-options {
    display: block;
}

/* Cards clip their content (overflow: hidden) for rounded corners. When a
   searchable dropdown is OPEN inside a card, let the card overflow so the
   options panel isn't cut off (e.g. the Transfer Products dropdown, which sits
   near the bottom of its card). Only applies while a dropdown is open. */
.card:has(.searchable-dropdown.open),
.card-body:has(.searchable-dropdown.open),
.card-body-collapsible:has(.searchable-dropdown.open) {
    overflow: visible;
}

.searchable-dropdown-search {
    padding: 10px;
    border-bottom: 1px solid var(--border-dark);
    position: sticky;
    top: 0;
    background: var(--black-secondary);
    z-index: 1;
}

.searchable-dropdown-search input {
    width: 100%;
    padding: 10px 12px;
    background: var(--black-tertiary);
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    color: var(--text-white);
    font-size: 0.9rem;
}

.searchable-dropdown-search input:focus {
    border-color: var(--gold-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.searchable-dropdown-search input::placeholder {
    color: var(--text-gray);
}

.searchable-dropdown-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 5px 0;
}

.searchable-dropdown-option {
    padding: 10px 15px;
    color: var(--text-light-gray);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
}

.searchable-dropdown-option:hover,
.searchable-dropdown-option.highlighted {
    background: var(--black-tertiary);
    color: var(--gold-primary);
}

.searchable-dropdown-option.selected {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold-primary);
}

.searchable-dropdown-option.hidden {
    display: none;
}

.searchable-dropdown-no-results {
    padding: 15px;
    text-align: center;
    color: var(--text-gray);
    font-style: italic;
    display: none;
}

/* Light mode - Searchable Dropdown */
body.light-mode .searchable-dropdown-selected {
    background: #ffffff;
    border-color: #cccccc;
    color: #333333;
}

body.light-mode .searchable-dropdown-options {
    background: #ffffff;
    border-color: var(--gold-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body.light-mode .searchable-dropdown-search {
    background: #ffffff;
    border-color: #eeeeee;
}

body.light-mode .searchable-dropdown-search input {
    background: #f5f5f5;
    border-color: #cccccc;
    color: #333333;
}

body.light-mode .searchable-dropdown-option {
    color: #555555;
}

body.light-mode .searchable-dropdown-option:hover,
body.light-mode .searchable-dropdown-option.highlighted {
    background: #f5f5f5;
    color: var(--gold-dark);
}

/* Notifications */
.notification-wrapper {
    position: relative;
    margin-right: 15px;
}

#notificationIcon {
    position: relative;
    color: var(--text-gray);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px;
}

#notificationIcon:hover {
    color: var(--gold-primary);
}

#notificationBadge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: none;
    /* Flex when active */
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: -80px;
    /* Aligned slightly right */
    width: 320px;
    background: var(--black-card);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    margin-top: 15px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-dark);
    font-weight: 600;
    color: var(--gold-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
}

.notification-item {
    border-bottom: 1px solid var(--border-dark);
    transition: var(--transition);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--black-tertiary);
}

.notification-link {
    display: flex;
    padding: 15px;
    text-decoration: none;
    color: var(--text-white);
    gap: 15px;
    align-items: flex-start;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 0.9rem;
}

.notification-icon.bg-success {
    background: var(--success);
}

.notification-icon.bg-warning {
    background: var(--warning);
    color: #000;
}

.notification-icon.bg-primary {
    background: var(--gold-primary);
    color: #000;
}

.notification-icon.bg-danger {
    background: var(--danger);
}

.notification-icon.bg-info {
    background: var(--info);
}

.notification-icon.bg-dark {
    background: #444;
}

.notification-icon.bg-secondary {
    background: var(--black-tertiary);
    color: var(--text-light-gray);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--gold-light);
}

.notification-msg {
    font-size: 0.8rem;
    color: var(--text-light-gray);
    margin-bottom: 5px;
    line-height: 1.3;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-gray);
}

.notification-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid var(--border-dark);
    background: rgba(0, 0, 0, 0.2);
}

.notification-footer a {
    color: var(--gold-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: block;
}

.notification-footer a:hover {
    text-decoration: underline;
}

.notification-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* Toast Popups */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
    max-width: 350px;
    width: 100%;
}

.notification-toast {
    position: relative;
    width: 100%;
    background: var(--black-card);
    border: 1px solid var(--gold-primary);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 10px rgba(212, 175, 55, 0.2);
    transform: translateX(120%);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    pointer-events: auto;
}

.notification-toast.show {
    transform: translateX(0);
}

.toast-header {
    padding: 10px 15px;
    background: rgba(212, 175, 55, 0.1);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toast-header strong {
    color: var(--gold-primary);
    font-size: 0.95rem;
}

.toast-header .close {
    background: none;
    border: none;
    color: var(--gold-primary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.toast-body {
    padding: 15px;
    color: var(--text-white);
    font-size: 0.9rem;
}
/* Page-level period (From/To) bar */
.period-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 18px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--black-secondary);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
}
.period-bar-title { color: var(--gold-primary); font-weight: 600; align-self: center; }
.period-bar-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.period-field { display: flex; flex-direction: column; gap: 4px; }
.period-field label { font-size: 0.75rem; color: var(--text-gray); text-transform: uppercase; letter-spacing: 0.5px; }
.period-field .form-control { min-width: 140px; }
.period-presets { display: flex; flex-wrap: wrap; gap: 6px; align-self: center; }
.period-preset {
    padding: 4px 10px; font-size: 0.8rem; border-radius: 14px; text-decoration: none;
    color: var(--text-gray); border: 1px solid var(--border-dark);
}
.period-preset:hover, .period-preset.active { color: var(--gold-primary); border-color: var(--gold-primary); }
.period-bar-note { margin-left: auto; align-self: center; font-size: 0.8rem; color: var(--text-gray); }
