/* /public/css/receipts.css */

/* Specialized Thumbnail styling for the Ledger */
.receipt-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0f172a;
    transition: transform 0.2s;
    cursor: zoom-in;
}

.receipt-thumb:hover {
    transform: scale(1.1);
    border-color: #3b82f6;
}

.receipt-thumbnail-wrapper {
    display: inline-block;
    vertical-align: middle;
}

/* Spending Summary Tiles */
.spending-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-tile {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.stat-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.breakdown-store {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.breakdown-total {
    font-weight: 600;
    color: #69f0ae;
}

/* Store Icons */
.store-icon-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.store-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.stat-breakdown .store-logo {
    width: 18px;
    height: 18px;
}

/* Image Viewer Modal Specifics */
.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: inline-block;
}

/* Upload Progress Overlay */
/* Covers the full viewport while the server runs ImageMagick + Tesseract.    */
/* z-index 99998 sits below the toast container (99999) so toasts still show. */

.upload-progress-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 12, 29, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
}

.upload-progress-inner {
    text-align: center;
    max-width: 420px;
    padding: 2rem;
}

.upload-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: upload-spin 0.9s linear infinite;
    margin: 0 auto 1.75rem;
}

@keyframes upload-spin {
    to { transform: rotate(360deg); }
}

.upload-progress-label {
    font-size: 1.25rem;
    font-weight: 300;
    color: #ffffff;
    margin: 0 0 0.75rem;
    transition: opacity 0.3s ease;
}

.upload-progress-sub {
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0;
}

/* Mobile Responsiveness for Receipts Table (Gold Standard from files.css) */
@media (max-width: 768px) {
    .spending-stats {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    .stat-value {
        font-size: 1.5rem;
    }
    .files-table thead { display: none; }
    .files-table, .files-table tbody { display: block; background: transparent; box-shadow: none; border: none; }
    .files-table tr {
        display: block; background: #1e293b; border-radius: 0.75rem; padding: 1rem; margin-bottom: 0.75rem; border: 1px solid #334155; position: relative; padding-left: 4.5rem;
    }
    .files-table td { display: block; padding: 0.25rem 0; border: none; width: 100% !important; text-align: left !important; }
    .files-table td::before {
        content: attr(data-label); font-weight: 600; color: #94a3b8; text-transform: uppercase; font-size: 0.7rem; margin-right: 0.5rem; min-width: 80px; display: inline-block;
    }
    .col-icon { position: absolute; left: 0.75rem; top: 1.5rem; width: 3rem !important; display: flex; justify-content: center; font-size: 2rem; padding: 0 !important; }
    .col-icon::before { content: none !important; }
    
    /* Action Button Container Aligned with Files standard */
    .action-buttons { 
        display: flex; 
        justify-content: center; 
        gap: 0.5rem; 
        margin-top: 0.5rem; 
        padding-top: 0.75rem; 
        border-top: 1px solid #334155;
        margin-left: -3.5rem; /* Counteract parent padding to center globally */
    }
    .col-actions::before { content: none !important; }

    /* Fix column wrapping in upload form */
    .admin-container .edit-form > div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
}
