/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ec4899;
    --primary-hover: #db2777;
    --secondary-color: #f59e0b;
    --secondary-hover: #d97706;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background: #fdf2f8;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #fbcfe8;
    --accent-light: #fef3c7;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--background);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #fce7f3;
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: #fbcfe8;
    transform: scale(1.02);
}

.upload-icon {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.upload-area h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--accent-light);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

.btn-remove {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.btn-remove:hover {
    color: var(--error-color);
}

/* Buttons */
.btn-primary {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #92400e;
    background: var(--accent-light);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #fde68a;
    border-color: var(--secondary-color);
}

/* Processing Section */
.processing-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.processing-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Results Section */
.results-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.results-actions {
    display: flex;
    gap: 0.75rem;
}

.results-actions .btn-primary {
    width: auto;
    margin: 0;
    padding: 0.75rem 1.5rem;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--background);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.summary-card.highlight {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    border: none;
    color: white;
}

.summary-card.highlight .card-label {
    color: rgba(255, 255, 255, 0.85);
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.card-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead {
    background: var(--background);
}

th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    border-right: 1px solid #f9d5e5;
    white-space: nowrap;
}

th:last-child {
    border-right: none;
}

td {
    padding: 0.875rem 0.75rem;
    border-bottom: 1px solid #f9d5e5;
    border-right: 1px solid #f9d5e5;
    color: var(--text-primary);
}

td:last-child {
    border-right: none;
}

tbody tr:hover {
    background: #fdf2f8;
}

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

.amount {
    text-align: right;
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: 0.9rem;
}

.amount.total {
    font-weight: 600;
    color: var(--primary-color);
}

.totals-row {
    background: var(--background) !important;
    border-top: 2px solid var(--border-color);
}

.totals-row td {
    border-bottom: none;
}

/* Error Section */
.error-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
}

.error-content {
    text-align: center;
    max-width: 400px;
}

.error-icon {
    width: 64px;
    height: 64px;
    background: #fef2f2;
    color: var(--error-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.error-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.logout-btn {
    margin-top: 1rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: var(--error-color);
    border-color: var(--error-color);
    background: #fef2f2;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .upload-section {
        padding: 1.5rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .results-section {
        padding: 1.5rem;
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

    .results-actions {
        flex-direction: column;
    }

    .results-actions .btn-primary,
    .results-actions .btn-secondary {
        width: 100%;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr 1fr;
    }

    .card-value {
        font-size: 1.25rem;
    }
}
