:root {
    /* Color Palette */
    --bg-cream: #FDFBF7;
    --bg-cream-dark: #F4EFE6;
    --surface-white: #FFFFFF;
    --primary-blue: #005B96;
    --primary-blue-light: #0375B4;
    --primary-blue-hover: #004A7C;
    --accent-blue: #B3CDE0;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    --border-color: #E0E6ED;
    --danger: #E74C3C;
    --danger-hover: #C0392B;
    --success: #27AE60;

    /* Shadows & Border Radius */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Prompt', sans-serif;
    background-color: var(--bg-cream);
    color: var(--text-main);
    line-height: 1.6;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: #1a202c; /* Dark mode background */
    border-right: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #2d3748;
}

.sidebar-header h2 {
    color: #e2e8f0; /* Light text for header */
    font-weight: 700;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #a0aec0; /* Light gray text for links */
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    gap: 12px;
}

.nav-links li a:hover {
    background-color: #2d3748;
    color: #ffffff;
}

.nav-links li a.active {
    background-color: var(--primary-blue);
    color: var(--surface-white);
    border-left: 4px solid #63b3ed; /* Lighter blue for active border in dark mode */
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.top-header {
    background-color: var(--surface-white);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 5;
}

.top-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-main);
}

#current-date {
    color: var(--text-muted);
    font-weight: 500;
}

.page-container {
    padding: 30px;
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* UI Elements */
.card {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: #FAFAFA;
}

.card-header h3 {
    font-size: 18px;
    color: var(--primary-blue);
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Dashboard Specific */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-md);
    border-left: 5px solid var(--primary-blue);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--accent-blue);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 20px;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

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

.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s;
    background-color: #FAFAFA;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    background-color: var(--surface-white);
    box-shadow: 0 0 0 3px rgba(0, 91, 150, 0.1);
}

.form-control::placeholder {
    color: #A0AAB2;
}

small {
    color: var(--text-muted);
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Prompt', sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-tab {
    background-color: var(--surface-white);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-tab.active {
    background-color: var(--primary-blue);
    color: var(--surface-white);
    border-color: var(--primary-blue);
}

.btn-tab:hover:not(.active) {
    background-color: #f1f5f9;
}

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

.btn-primary:hover {
    background-color: var(--primary-blue-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--bg-cream-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #E2D9C8;
}

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

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

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

.btn-icon {
    padding: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Tables */
.data-table, .items-table, .history-items-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .items-table th, .history-items-table th {
    text-align: left;
    padding: 12px 16px;
    background-color: #F8F9FA;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
}

.data-table td, .items-table td, .history-items-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover, .items-table tbody tr:hover {
    background-color: rgba(0, 91, 150, 0.02);
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clickable-row:hover {
    background-color: rgba(0, 91, 150, 0.05) !important;
}

/* Specific styling for item rows in receipt */
.item-row td {
    padding: 8px;
}

/* Searchable Dropdown */
.searchable-dropdown {
    position: relative;
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
    margin-top: 4px;
}

.dropdown-list li {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #F0F0F0;
    transition: background 0.1s;
}

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

.dropdown-list li:hover {
    background-color: var(--accent-blue);
    color: var(--primary-blue-hover);
}

.dropdown-list.hidden {
    display: none;
}

.alias-match {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

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

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal:not(.hidden) .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary-blue);
    color: white;
}

.modal-header h3 {
    margin: 0;
}

.btn-close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
}

.btn-close-modal:hover {
    opacity: 1;
}

.close-modal {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.8;
}

.close-modal:hover {
    opacity: 1;
}

.modal-lg {
    max-width: 800px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #FAFAFA;
}

/* Alt unit row inside modal */
.alt-unit-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 24px 0;
}

/* Vendor summary list */
.vendor-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vendor-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background-color: #FAFAFA;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-blue);
}

/* History Cards */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.history-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--surface-white);
}

.history-header {
    background-color: var(--bg-cream-dark);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.history-title {
    display: flex;
    gap: 20px;
    font-weight: 500;
}

.history-date { color: var(--primary-blue); }
.history-vendor { color: var(--text-main); }

.history-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
}

.history-items {
    padding: 0;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 24px 36px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 15px;
    min-width: 320px;
    max-width: 80%;
    pointer-events: auto;
    animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: opacity 0.3s, transform 0.3s;
    color: white;
}

.toast.toast-error {
    background: linear-gradient(135deg, #FF416C, #FF4B2B);
    box-shadow: 0 15px 35px rgba(255, 75, 43, 0.4);
}

.toast.toast-success {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    box-shadow: 0 15px 35px rgba(0, 176, 155, 0.4);
}

.toast-icon {
    font-size: 28px;
    background: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 6px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.toast-message {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
}

@keyframes toast-in {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
