/* =============================================
   Receipts listing page
   ============================================= */

.receipts-page {
    max-width: 80rem;
    margin: 0 auto;
    padding: 6rem 1.25rem 4rem;
}

@media (min-width: 640px) {
    .receipts-page {
        padding: 6rem 1.5rem 4rem;
    }
}

@media (min-width: 1024px) {
    .receipts-page {
        padding: 7rem 2rem 4rem;
    }
}

/* Header */
.receipts-header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .receipts-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
}

.page-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.025em;
    line-height: 1;
    margin: 0 0 0.5rem;
}

.page-subtitle {
    color: var(--secondary);
    max-width: 32rem;
    line-height: 1.6;
    margin: 0;
    font-size: 0.9375rem;
}

.receipts-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .receipts-stats {
        gap: 2.5rem;
    }
}

.receipts-stat-value {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.025em;
    line-height: 1;
}

.receipts-stat-unit {
    font-size: 1rem;
    font-weight: 500;
    margin-left: 0.25rem;
    letter-spacing: 0;
}

.receipts-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--secondary);
    margin-top: 0.375rem;
}

/* Action bar */
.receipts-action-bar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

@media (min-width: 768px) {
    .receipts-action-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.receipts-action-btns {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.btn-primary-teal {
    background: linear-gradient(135deg, #004557 0%, #005e76 100%);
    color: #ffffff;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 69, 87, 0.25);
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
}

.btn-primary-teal:hover {
    opacity: 0.9;
    color: #ffffff;
}

.btn-primary-teal:active {
    transform: scale(0.97);
}

.btn-muted {
    background: var(--secondary-container);
    color: var(--on-secondary-container);
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}

.btn-muted:hover {
    opacity: 0.85;
    color: var(--on-secondary-container);
}

.receipts-search-wrap {
    position: relative;
    width: 100%;
}

@media (min-width: 768px) {
    .receipts-search-wrap { width: 24rem; }
}

.receipts-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--outline-variant);
    font-size: 1.25rem;
    pointer-events: none;
}

.receipts-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: var(--surface-container-low);
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: var(--on-surface);
    box-sizing: border-box;
    outline: none;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.receipts-search-input:focus {
    background: var(--surface-container-lowest);
    box-shadow: 0 0 0 2px var(--primary);
}

.receipts-search-input::placeholder {
    color: var(--outline-variant);
}

/* Table card */
.receipts-table-card {
    background: var(--surface-container-lowest);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(25, 28, 30, 0.06), 0 0 0 1px rgba(110, 121, 121, 0.1);
}

.receipts-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
    .receipts-table-scroll {
        /* Add scrollbar styling for mobile */
        scrollbar-width: thin;
        scrollbar-color: var(--outline-variant) transparent;
    }

    .receipts-table-scroll::-webkit-scrollbar {
        height: 6px;
    }

    .receipts-table-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .receipts-table-scroll::-webkit-scrollbar-thumb {
        background: var(--outline-variant);
        border-radius: 3px;
    }
}

.receipts-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

@media (max-width: 767px) {
    .receipts-table {
        min-width: 600px;
    }
}

.receipts-table thead tr {
    background: var(--surface-container-low);
    border-bottom: 1px solid rgba(110, 121, 121, 0.2);
}

.receipts-table th {
    padding: 0.625rem 1rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--secondary);
    white-space: nowrap;
}

@media (min-width: 640px) {
    .receipts-table th {
        padding: 0.625rem 1.5rem;
    }
}

.receipts-table th .th-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.receipts-table tbody tr {
    border-bottom: 1px solid rgba(190, 200, 201, 0.12);
    transition: background-color 0.12s;
}

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

.receipts-table tbody tr:hover {
    background: var(--surface-bright);
}

.receipts-table td {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    vertical-align: middle;
}

@media (min-width: 640px) {
    .receipts-table td {
        padding: 0.625rem 1.5rem;
    }
}

.receipts-table .td-store {
    font-weight: 600;
    color: var(--on-surface);
    white-space: nowrap;
}

.receipts-table .td-date {
    color: var(--secondary);
    font-weight: 500;
    white-space: nowrap;
}

.receipts-table .td-amount {
    font-weight: 700;
    color: var(--on-surface);
    white-space: nowrap;
}

.receipts-table .td-updated {
    color: var(--secondary);
    white-space: nowrap;
    font-size: 0.8125rem;
}

.receipts-badge-reconciled {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
}

.receipts-badge-not-reconciled {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--tertiary-fixed);
    color: var(--on-tertiary-fixed-variant);
}

.receipts-table .td-action {
    text-align: right;
    width: 3rem;
}

.receipts-table .td-action a {
    display: inline-flex;
    padding: 0.375rem;
    color: var(--outline-variant);
    border-radius: 0.375rem;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s;
    text-decoration: none;
}

.receipts-table tbody tr:hover .td-action a {
    opacity: 1;
}

.receipts-table .td-action a:hover {
    color: var(--primary);
}

/* Sortable column headers */
.receipts-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.receipts-table th.sortable:hover .th-inner {
    color: var(--primary);
}

.receipts-table th.sortable:hover .sort-icon {
    color: var(--primary);
}

.receipts-table th.sort-active .th-inner {
    color: var(--primary);
}

.receipts-table th.sort-active .sort-icon {
    color: var(--primary);
}

.receipts-table th .sort-icon {
    font-size: 1rem;
    color: var(--outline-variant);
    transition: color 0.12s;
    flex-shrink: 0;
}

/* Filter row */
.receipts-table .filter-row td {
    padding: 0.375rem 1rem;
    background: var(--surface-container-low);
    border-bottom: 1px solid rgba(110, 121, 121, 0.2);
}

.col-filter {
    width: 100%;
    background: var(--surface);
    color: var(--on-surface);
    border: 1px solid rgba(110, 121, 121, 0.3);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.col-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 104, 95, 0.15);
}

.col-filter::placeholder {
    color: var(--outline-variant);
}

select.col-filter {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236e7979' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.375rem center;
    padding-right: 1.5rem;
    cursor: pointer;
}

/* Table footer */
.receipts-table-footer {
    padding: 0.75rem 1rem;
    background: var(--surface-container-low);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(110, 121, 121, 0.1);
}

@media (min-width: 640px) {
    .receipts-table-footer {
        padding: 1rem 1.5rem;
    }
}

.receipts-table-footer-count {
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Empty state */
.receipts-empty {
    text-align: center;
    padding: 4rem 1.5rem;
}

.receipts-empty-icon {
    font-size: 3rem;
    color: var(--outline-variant);
    margin-bottom: 1rem;
    display: block;
}

.receipts-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--on-surface);
    margin-bottom: 0.375rem;
}

.receipts-empty-sub {
    font-size: 0.875rem;
    color: var(--secondary);
    margin: 0;
}

/* Dark mode extras */
[data-theme="dark"] .receipts-table-card {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(110, 121, 121, 0.2);
}

[data-theme="dark"] .receipts-table thead tr {
    background: rgba(255, 255, 255, 0.04);
}

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

[data-theme="dark"] .receipts-search-input {
    background: var(--surface-container);
}

[data-theme="dark"] .receipts-search-input:focus {
    background: var(--surface-container-high);
}

