:root {
    --dark-coffee: #3E2723;
    --medium-coffee: #6D4C41;
    --light-coffee: #D7CCC8;
    --very-light-coffee: #EFEBE9;
    --accent-color: #8D6E63;
    --brand-gold: #7A5400;
    --text-dark: #5D4037;
    --text-light: #A1887F;
    --text-light-on-dark: #E8E0DB;
    --text-very-light: #F5F1ED;
    --gold-accent: #D4A574;
}

/* Global text color overrides for light gray theme */
.text-muted {
    color: #6C757D !important; /* Medium gray for muted text on light background */
}

h1, h2, h3, h4, h5, h6 {
    color: #1A1A1A; /* Very dark text for headings */
    font-weight: 700;
}

p {
    color: #2C2C2C; /* Dark gray for body text */
}

body {
    /* Light Gray Theme - Light gray background with dark text for excellent readability */
    background-color: #F5F5F5; /* Light gray */
    background-image: linear-gradient(135deg, #F5F5F5 0%, #E8E8E8 100%);
    color: #2C2C2C; /* Dark gray text for excellent contrast on light background */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    font-size: 85%;
}

.navbar {
    background-color: var(--dark-coffee); /* dark coffee */
}
.navbar-brand, .nav-link {
    color: #ffffff !important;
}

.nav-link:hover {
    color: rgba(255,255,255,0.9) !important;
}

/* Main container styling */
main.container {
    background-color: transparent;
}

main.container .row {
    background-color: transparent;
}

.card {
    background-color: #FFFFFF; /* White cards on light gray background */
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%);
    border: 1px solid #E0E0E0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    color: #2C2C2C; /* Dark text on white cards */
}

.card-header {
    background: linear-gradient(135deg, var(--dark-coffee) 0%, var(--medium-coffee) 100%);
    color: #FFFFFF; /* White text on dark coffee header */
    font-weight: 700;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-body {
    color: #2C2C2C; /* Dark text on white card body */
}

.btn-primary,
.btn {
    background-color: var(--dark-coffee) !important; /* dark coffee buttons */
    border-color: var(--dark-coffee) !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn:hover {
    background-color: var(--medium-coffee) !important; /* slightly lighter on hover */
    border-color: var(--medium-coffee) !important;
}

.footer {
    background-color: var(--dark-coffee);
    color: #ffffff;
    padding: 20px 0;
    margin-top: 30px;
}

.dashboard-card {
    background: linear-gradient(135deg, var(--medium-coffee) 0%, var(--dark-coffee) 100%);
    color: #FFFFFF; /* White text on dark coffee cards for excellent contrast */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.dashboard-card i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #D4A574; /* Warm gold/coffee accent for icons */
}

.dashboard-card h5 {
    margin: 0;
    color: #FFFFFF; /* White text for excellent visibility */
    font-weight: 600;
}

.dashboard-card h3 {
    color: #FFFFFF; /* White text for numbers - excellent visibility */
    font-weight: 700;
    margin-top: 10px;
}

.dashboard-card:hover {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--medium-coffee) 100%);
    cursor: pointer;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.table {
    background-color: #FFFFFF; /* White table background */
    color: #2C2C2C; /* Dark text */
}

.table thead {
    background: linear-gradient(135deg, var(--dark-coffee) 0%, var(--medium-coffee) 100%);
    color: #FFFFFF; /* White text on dark header */
}

.table tbody {
    background-color: #FFFFFF; /* White for rows */
}

.table tbody tr {
    border-bottom: 1px solid #E0E0E0;
}

.table tbody tr:hover {
    background-color: #F5F5F5; /* Light gray on hover */
}

.table td, .table th {
    color: #2C2C2C; /* Dark text for excellent readability */
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #FAFAFA; /* Very light gray for striped rows */
}

.sidebar {
    background: linear-gradient(135deg, var(--medium-coffee) 0%, var(--dark-coffee) 100%);
    color: #FFFFFF; /* White text on dark sidebar */
    border-radius: 10px;
    padding: 20px;
    height: fit-content;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}
.sidebar .nav-link {
    color: #FFFFFF; /* White text for excellent visibility */
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    background-color: rgba(212, 165, 116, 0.3); /* Gold accent */
    color: #FFFFFF;
    border-left: 3px solid #D4A574;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.user-info h6 {
    color: #FFFFFF; /* White text on dark sidebar */
}

.user-info small {
    color: #D4A574; /* Gold accent */
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.e-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%);
    color: #2C2C2C; /* Dark text */
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    border: 1px solid #E0E0E0;
}

.e-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 100px;
    height: 100px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.e-card::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 60px;
    height: 60px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.e-card-number {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 10px;
    color: #1A1A1A; /* Dark text for excellent visibility */
}

.e-card-package {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: #2C2C2C; /* Dark text */
}

.e-card-value {
    font-size: 1.1rem;
    opacity: 0.9;
    color: var(--accent-color); /* Coffee accent color */
    font-weight: 600;
}

.e-card-status {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #FFFFFF;
}

.e-card-status.used {
    background-color: var(--accent-color);
}

.e-card-status.unused {
    background-color: #4CAF50;
}

.form-control, .form-select {
    background-color: #FFFFFF; /* White inputs */
    border: 1px solid #D0D0D0;
    color: #2C2C2C; /* Dark text */
}

.form-control:focus, .form-select:focus {
    background-color: #FFFFFF;
    border-color: var(--accent-color); /* Coffee accent border */
    color: #2C2C2C;
    box-shadow: 0 0 0 0.25rem rgba(141, 110, 99, 0.25);
}

.form-control::placeholder {
    color: #9E9E9E; /* Medium gray for placeholder */
    opacity: 0.8;
}

/* Gold placeholder for e-card management */
#ecards .form-control::placeholder {
    color: #D4AF37; /* Gold for placeholder */
    opacity: 0.6;
}

.form-label {
    color: #1A1A1A; /* Dark text for labels - excellent visibility */
    font-weight: 600;
}

.badge {
    background-color: var(--accent-color);
    color: #FFFFFF; /* White text for excellent visibility */
    font-weight: 600;
}

.badge.bg-primary {
    background-color: var(--medium-coffee) !important;
    color: #FFFFFF !important; /* White text for visibility */
}

.badge.bg-success {
    background-color: #4CAF50 !important;
    color: #FFFFFF !important;
}

.badge.bg-warning {
    background-color: #FF9800 !important;
    color: #FFFFFF !important;
}

/* Small responsiveness tweak for e-card columns */
@media (max-width: 576px) {
    .e-card {
        padding: 12px;
    }
}

/* E-Card Management Theme - Light gray background with Gold text */
#ecards {
    background-color: transparent; /* Inherit light gray from body */
    color: #D4AF37; /* Gold text for e-card management */
    font-weight: 400;
    font-family: 'Goldman', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: inherit;
}

/* Gold text for all text elements in e-card management */
#ecards p,
#ecards span,
#ecards div:not(.card-header):not(.btn):not(.badge),
#ecards .text-muted {
    color: #D4AF37 !important; /* Gold text */
}

#ecards .text-muted {
    color: #B8860B !important; /* Darker gold for muted text */
    opacity: 0.8;
}

#ecards h2,
#ecards .card-header h5,
#ecards .card-header,
#ecards .form-label,
#ecards table thead th,
#ecards .list-group-item h6 {
    color: #B8860B; /* Dark gold for headings - excellent visibility */
    font-weight: 700;
}

#ecards table, #ecards table td, #ecards table th {
    font-size: 0.91rem;
    color: #D4AF37; /* Gold text for table content */
}

#ecards .form-control,
#ecards .form-select {
    background-color: #FFFFFF; /* White inputs */
    border: 1px solid #D0D0D0;
    color: #B8860B; /* Dark gold text */
    font-weight: 600;
}

#ecards .form-control:focus,
#ecards .form-select:focus {
    background-color: #FFFFFF;
    border-color: #D4AF37; /* Gold border on focus */
    color: #B8860B; /* Dark gold text */
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.25);
}

#ecards .btn,
#ecards .btn-primary,
#ecards .btn-secondary,
#ecards .btn-sm {
    background-color: var(--accent-color) !important; /* #8D6E63 */
    border-color: var(--accent-color) !important;
    color: #FFFFFF !important; /* White text for excellent visibility */
    font-weight: 700;
}

#ecards .btn:hover,
#ecards .btn:focus {
    background-color: var(--dark-coffee) !important;
    border-color: var(--dark-coffee) !important;
    color: #FFFFFF !important;
}

#ecards .btn-outline-light {
    background-color: transparent !important;
    border-color: var(--medium-coffee) !important;
    color: var(--dark-coffee) !important; /* Dark text for visibility */
}

#ecards .btn-outline-light:hover {
    background-color: var(--medium-coffee) !important;
    border-color: var(--medium-coffee) !important;
    color: #FFFFFF !important;
}

#ecards .e-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%);
    color: #D4AF37; /* Gold text */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #E0E0E0;
}

#ecards .badge {
    background-color: var(--accent-color);
    color: #FFFFFF; /* White text on coffee badge */
    font-weight: 700;
}

/* Small devices tweaks for e-cards page */
@media (max-width: 576px) {
    #ecards h2 { font-size: 1.25rem; }
}

/* Compact / compressed table styles for E-Card Management */
#ecards #existingEcardsTable,
#ecards #ecardStatusReportTable {
    font-size: 0.85rem;
    color: #D4AF37; /* Gold text */
    background-color: #FFFFFF; /* White table */
}

#ecards #existingEcardsTable th,
#ecards #existingEcardsTable td,
#ecards #ecardStatusReportTable th,
#ecards #ecardStatusReportTable td {
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #D4AF37; /* Gold text */
    border-color: #E0E0E0;
}

/* Narrow the actions column */
#ecards #existingEcardsTable th:last-child,
#ecards #existingEcardsTable td:last-child,
#ecards #ecardStatusReportTable th:last-child,
#ecards #ecardStatusReportTable td:last-child {
    width: 110px;
    text-align: center;
}

/* Smaller buttons in table rows */
#ecards #existingEcardsTable .btn,
#ecards #ecardStatusReportTable .btn {
    padding: 0.25rem 0.4rem;
    font-size: 0.78rem;
}

/* Make search and control inputs a bit smaller inside the e-cards header */
#ecards .card-header .form-control,
#ecards .card-header .btn {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
}

/* Responsive: hide less-important columns on small screens to compress the table */
@media (max-width: 768px) {
    /* hide 'Used By' and 'Used Date' columns (assumed 5th and 6th columns) */
    #ecards #existingEcardsTable td:nth-child(5),
    #ecards #existingEcardsTable th:nth-child(5),
    #ecards #existingEcardsTable td:nth-child(6),
    #ecards #existingEcardsTable th:nth-child(6) {
        display: none;
    }

    /* slightly increase compactness on very small screens */
    #ecards #existingEcardsTable th,
    #ecards #existingEcardsTable td {
        padding: 0.3rem 0.4rem;
    }
}

/* Utility: very compact row variant (can be toggled by adding .compact-table on container) */
.compact-table #existingEcardsTable,
.compact-table #ecardStatusReportTable {
    font-size: 0.82rem;
}

.compact-table #existingEcardsTable th,
.compact-table #existingEcardsTable td {
    padding: 0.28rem 0.45rem;
}

/* Dashboard tab specific styling */
#dashboard {
    background-color: transparent;
    color: #2C2C2C; /* Dark text on light gray background */
}

#dashboard h2 {
    color: #1A1A1A; /* Very dark for headings - excellent visibility */
    font-weight: 700;
}

#dashboard .list-group-item {
    background-color: #FFFFFF; /* White list items */
    color: #2C2C2C; /* Dark text */
    border: 1px solid #E0E0E0;
}

#dashboard .list-group-item h6 {
    color: #1A1A1A; /* Dark text for headings */
}

#dashboard .list-group-item .text-muted {
    color: #6C757D !important; /* Medium gray for muted text */
}

/* Reports tab styling */
#reports {
    background-color: transparent;
    color: #2C2C2C; /* Dark text */
}

#reports h2 {
    color: #1A1A1A; /* Very dark for headings */
    font-weight: 700;
}

/* Tab content styling */
.tab-content {
    background-color: transparent;
}

.tab-pane {
    background-color: transparent;
    color: #2C2C2C; /* Dark text */
}

/* Dropdown menu styling */
.dropdown-menu {
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    color: #2C2C2C; /* Dark text for visibility */
}

.dropdown-item:hover {
    background-color: #F5F5F5;
    color: #1A1A1A;
}

.dropdown-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Button outline variants */
.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--medium-coffee);
    color: var(--dark-coffee);
}

.btn-outline-secondary:hover {
    background-color: var(--medium-coffee);
    border-color: var(--medium-coffee);
    color: #FFFFFF;
}

.btn-outline-danger {
    background-color: transparent;
    border-color: #f44336;
    color: #f44336;
}

.btn-outline-danger:hover {
    background-color: #f44336;
    color: #FFFFFF;
}

.btn-outline-success {
    background-color: transparent;
    border-color: #4CAF50;
    color: #4CAF50;
}

.btn-outline-success:hover {
    background-color: #4CAF50;
    color: #FFFFFF;
}

/* Card border variants */
.border-primary {
    border-color: var(--accent-color) !important;
}

/* Info card header */
.bg-info {
    background: linear-gradient(135deg, var(--medium-coffee) 0%, var(--accent-color) 100%) !important;
    color: #FFFFFF !important; /* White text for visibility */
}

.bg-primary {
    background: linear-gradient(135deg, var(--dark-coffee) 0%, var(--medium-coffee) 100%) !important;
    color: #FFFFFF !important; /* White text for visibility */
}
