/* =====================================================
   History Page - Specific Styles
   ===================================================== */

.history-page {
    padding-bottom: calc(var(--mobile-nav-height) + 20px);
}

@media (min-width: 992px) {
    .history-page {
        padding-bottom: 40px;
    }
}

/* =====================================================
   Page Header
   ===================================================== */
.page-header {
    text-align: center;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.page-title i {
    color: var(--primary-color);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* =====================================================
   Filters Card
   ===================================================== */
.filters-card {
    background-color: var(--bg-surface);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.filters-card .form-control,
.filters-card .form-select {
    font-size: 0.9rem;
}

.filters-card .input-group-text {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-color);
}

/* =====================================================
   Table Card
   ===================================================== */
.table-card {
    background-color: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background-color: var(--bg-surface-hover);
}

.table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 14px 16px;
    white-space: nowrap;
    user-select: none;
}

.table thead th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.table thead th.sortable:hover {
    background-color: var(--border-color);
}

.table thead th .sort-icon {
    font-size: 0.7rem;
    margin-right: 4px;
    opacity: 0.5;
}

.table thead th.sort-asc .sort-icon::before {
    content: "\F282"; /* bi-chevron-up */
}

.table thead th.sort-desc .sort-icon::before {
    content: "\F286"; /* bi-chevron-down */
}

.table thead th.sort-asc .sort-icon,
.table thead th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

.table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.table tbody tr:hover {
    background-color: var(--bg-surface-hover);
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* =====================================================
   Table Cells
   ===================================================== */
/* Date Cell */
.cell-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cell-date .date-primary {
    font-weight: 500;
    font-size: 0.9rem;
}

.cell-date .date-secondary {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Type Cell */
.cell-type {
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9rem;
}

.type-icon.type-drive {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

.type-icon.type-buy {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.type-text {
    font-size: 0.9rem;
}

/* Status Cell */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.status-completed {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.status-badge.status-pending {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

.status-badge.status-in_progress {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

.status-badge.status-cancelled {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Amount Cell */
.cell-amount {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-color);
}

/* Link Icon */
.row-link {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.row-link-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface-hover);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all 0.2s;
}

.table tbody tr:hover .row-link-icon {
    background-color: var(--primary-color);
    color: white;
}

/* =====================================================
   Loading State
   ===================================================== */
.table-loading {
    text-align: center;
    padding: 60px 20px;
}

.table-loading p {
    margin-top: 12px;
    color: var(--text-secondary);
}

/* =====================================================
   Empty State
   ===================================================== */
.table-empty {
    text-align: center;
    padding: 60px 20px;
}

.table-empty i {
    font-size: 4rem;
    color: var(--text-secondary);
    opacity: 0.3;
}

.table-empty h5 {
    margin-top: 16px;
    margin-bottom: 8px;
}

.table-empty p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* =====================================================
   Pagination
   ===================================================== */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface-hover);
}

.pagination-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pagination {
    gap: 4px;
}

.pagination .page-link {
    border-radius: 6px;
    font-size: 0.85rem;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    background-color: var(--bg-surface);
}

.pagination .page-link:hover {
    background-color: var(--bg-surface-hover);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
}

/* =====================================================
   Mobile Responsive
   ===================================================== */
@media (max-width: 767.98px) {
    .page-header {
        text-align: right;
    }

    .page-title {
        justify-content: flex-start;
        font-size: 1.25rem;
    }

    .table thead th {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .table tbody td {
        padding: 10px 12px;
    }

    .cell-date .date-primary {
        font-size: 0.85rem;
    }

    .type-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .type-text {
        font-size: 0.8rem;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .cell-amount {
        font-size: 0.85rem;
    }

    .table-pagination {
        flex-direction: column;
        gap: 12px;
    }

    .pagination-info {
        order: 2;
    }
}

/* Hide some columns on very small screens */
@media (max-width: 575.98px) {
    .table thead th:nth-child(4),
    .table tbody td:nth-child(4) {
        display: none;
    }
}

/* =====================================================
   Dark Mode
   ===================================================== */
[data-bs-theme="dark"] .filters-card {
    background-color: var(--bg-surface);
}

[data-bs-theme="dark"] .table-card {
    background-color: var(--bg-surface);
}

[data-bs-theme="dark"] .table thead {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
