/* Global Table Styles - Purple Theme */

/* Table wrapper for border-radius */
.table-wrapper {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: transparent;
}

/* Clip table corners when used directly inside card (no padding) */
.card-body.p-0 {
    overflow: hidden;
}

/* Base table styling with Bootstrap 5 variables */
.table {
    margin-bottom: 0;
}

.table thead {
    border-bottom: 2px solid var(--surface-tonal-20);
}

.table thead th {
    background: var(--surface-tonal-20);
    color: #ffffff;
    font-weight: 600;
    border: none;
    padding: 14px 16px;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.8px;
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr td {
    --bs-table-bg: var(--surface-tonal-0);
    --bs-table-color: #ffffff;
    padding: 14px 16px;
    vertical-align: middle;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--surface-tonal-20);
}

.table tbody tr:nth-of-type(even) td {
    --bs-table-bg: var(--surface-tonal-10);
}

.table tbody tr:hover td {
    --bs-table-bg: var(--surface-tonal-20);
    --bs-table-color: #ffffff;
    --bs-table-hover-color: #ffffff;
    color: #ffffff;
}

.table tbody tr td strong {
    color: #ffffff;
    font-weight: 600;
}

/* Table striped variant */
.table-striped tbody tr td {
    --bs-table-bg: var(--surface-tonal-0);
}

.table-striped tbody tr:nth-of-type(even) td {
    --bs-table-bg: var(--surface-tonal-10);
}

/* Table hover variant */
.table-hover tbody tr:hover td {
    --bs-table-bg: var(--surface-tonal-20);
    --bs-table-color: #ffffff;
    --bs-table-hover-color: #ffffff;
    color: #ffffff;
}

/* Custom class for inactive/disabled rows */
.row-inactive td {
    --bs-table-bg: var(--surface-tonal-10);
    --bs-table-color: rgba(255, 255, 255, 0.5);
    opacity: 0.6;
}

/* Custom class for rows without entries (replaces Bootstrap's .table-secondary) */
.row-no-entries td {
    --bs-table-bg: var(--surface-tonal-10);
    --bs-table-color: rgba(255, 255, 255, 0.6);
}

.row-no-entries:hover td {
    --bs-table-bg: var(--surface-tonal-20);
    --bs-table-color: #ffffff;
    --bs-table-hover-color: #ffffff;
    color: #ffffff;
}

/* Entry table specific (for dashboard) */
.entry-table {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow);
}

.entry-table table {
    margin: 0;
}

.entry-table thead th {
    font-size: var(--text-base);
    padding: 20px;
}

.entry-table tbody td {
    padding: 18px 20px;
    font-size: 1.1rem;
}

/* Clickable rows */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    --bs-table-bg: var(--surface-tonal-20);
    --bs-table-color: #ffffff;
    --bs-table-hover-color: #ffffff;
    color: #ffffff;
}

/* Expense rows */
.expense-row td {
    --bs-table-bg: rgba(217, 74, 74, 0.1);
}

.expense-row:hover td {
    --bs-table-bg: rgba(217, 74, 74, 0.2);
    --bs-table-color: #ffffff;
    --bs-table-hover-color: #ffffff;
    color: #ffffff;
}

.expense-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--danger);
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
}

.expense-amount {
    color: var(--danger);
    font-weight: 600;
}

/* Time and employee styling */
.entry-time {
    font-weight: 600;
    color: var(--primary-softer);
}

.entry-employee {
    font-weight: 500;
}

.entry-amount {
    font-weight: 600;
    color: #ffffff;
}

/* =============================================
   LIGHT MODE OVERRIDES
   ============================================= */
[data-theme="light"] .table thead {
    border-bottom: 2px solid #d4b0ff;
}

[data-theme="light"] .table thead th {
    background: #ede0ff;
    color: #5a1a8a;
}

[data-theme="light"] .table tbody tr td {
    --bs-table-bg: #faf5ff;
    --bs-table-color: var(--text-primary);
    border-bottom: 1px solid #efe0ff;
}

[data-theme="light"] .table tbody tr:nth-of-type(even) td {
    --bs-table-bg: #f4ebff;
}

[data-theme="light"] .table tbody tr:hover td {
    --bs-table-bg: #e8d5ff;
    --bs-table-color: #1e1e1e;
    --bs-table-hover-color: #1e1e1e;
    color: #1e1e1e;
}

[data-theme="light"] .table tbody tr td strong {
    color: #1e1e1e;
}

[data-theme="light"] .table-striped tbody tr td {
    --bs-table-bg: #faf5ff;
}

[data-theme="light"] .table-striped tbody tr:nth-of-type(even) td {
    --bs-table-bg: #f4ebff;
}

[data-theme="light"] .table-hover tbody tr:hover td {
    --bs-table-bg: #e8d5ff;
    --bs-table-color: #1e1e1e;
    --bs-table-hover-color: #1e1e1e;
    color: #1e1e1e;
}

[data-theme="light"] .row-inactive td {
    --bs-table-bg: #f4ebff;
    --bs-table-color: rgba(30, 30, 30, 0.5);
}

[data-theme="light"] .row-no-entries td {
    --bs-table-bg: #f4ebff;
    --bs-table-color: rgba(30, 30, 30, 0.6);
}

[data-theme="light"] .clickable-row:hover td {
    --bs-table-bg: #e8d5ff;
    --bs-table-color: #1e1e1e;
    --bs-table-hover-color: #1e1e1e;
    color: #1e1e1e;
}

[data-theme="light"] .expense-row td {
    --bs-table-bg: rgba(156, 33, 33, 0.06);
}

[data-theme="light"] .expense-row:hover td {
    --bs-table-bg: rgba(156, 33, 33, 0.12);
    --bs-table-color: #1e1e1e;
    color: #1e1e1e;
}

[data-theme="light"] .entry-time {
    color: var(--primary);
}

[data-theme="light"] .entry-amount {
    color: var(--text-primary);
}
