:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #1f1f1f;
    
    --accent: #d4a853;
    --accent-dim: #a8843f;
    --accent-glow: rgba(212, 168, 83, 0.15);
    
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    
    --border: #2a2a2a;
    --border-light: #333333;
    
    --success: #4ade80;
    --success-dim: rgba(74, 222, 128, 0.15);
    --error: #f87171;
    --error-dim: rgba(248, 113, 113, 0.15);
    
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Outfit', system-ui, sans-serif;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 24px;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 60px;
}

.logo-mark {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 16px;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.title .accent {
    color: var(--accent);
    font-style: italic;
}

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

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-secondary);
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, var(--accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.drop-zone-active {
    display: none;
    position: absolute;
    inset: 0;
    background: var(--bg-secondary);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 2;
}

.drop-zone.drag-over .drop-zone-content {
    display: none;
}

.drop-zone.drag-over .drop-zone-active {
    display: flex;
}

.drop-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
    transition: all 0.4s ease;
}

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
    color: var(--accent);
    transform: translateY(-4px);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

.drop-text {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.drop-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.btn-browse {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 12px 28px;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-browse:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* File List */
.file-list {
    margin-top: 24px;
    display: grid;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 1.2rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.file-type {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-rows {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.file-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.file-remove:hover {
    background: var(--error-dim);
    color: var(--error);
}

/* Config Section */
.config-section {
    animation: fadeIn 0.5s ease-out;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.config-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.config-label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}

.config-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.razorpay-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.razorpay-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.razorpay-option:hover {
    background: var(--bg-elevated);
}

.razorpay-option.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.razorpay-option input {
    display: none;
}

.radio-dot {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.razorpay-option.selected .radio-dot {
    border-color: var(--accent);
}

.razorpay-option.selected .radio-dot::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

.razorpay-option-content {
    flex: 1;
}

.razorpay-option-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.razorpay-option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-reconcile {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 32px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reconcile:hover {
    background: var(--accent-dim);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-reconcile:active {
    transform: translateY(0);
}

.btn-icon {
    display: flex;
    transition: transform 0.3s ease;
}

.btn-reconcile:hover .btn-icon {
    transform: translateX(4px);
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease-out;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.results-header .section-title {
    margin-bottom: 0;
}

.btn-reset {
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px 24px;
    text-align: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-card.total {
    border-color: var(--accent-dim);
}

.stat-card.matched {
    border-color: var(--success);
}

.stat-card.unmatched {
    border-color: var(--error);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-card.total .stat-value {
    color: var(--accent);
}

.stat-card.matched .stat-value {
    color: var(--success);
}

.stat-card.unmatched .stat-value {
    color: var(--error);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-bg {
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 8rem;
    opacity: 0.05;
    pointer-events: none;
}

/* Match Rate */
.match-rate {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
}

.match-rate-bar {
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.match-rate-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
    border-radius: 6px;
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.match-rate-text {
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.match-rate-text span {
    font-weight: 600;
    color: var(--accent);
}

/* Download Section */
.download-section {
    text-align: center;
    margin-bottom: 40px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download:hover {
    background: var(--error-dim);
    border-color: var(--error);
    color: var(--error);
}

.btn-download svg {
    transition: transform 0.3s ease;
}

.btn-download:hover svg {
    transform: translateY(2px);
}

.download-info {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Preview Table */
.preview-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.preview-table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.preview-table th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.preview-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Breakdown Section */
.breakdown-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
}

.breakdown-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.breakdown-source {
    font-weight: 500;
    font-size: 0.9rem;
}

.breakdown-stats {
    text-align: right;
    font-size: 0.85rem;
}

.breakdown-matched {
    color: var(--success);
}

.breakdown-unmatched {
    color: var(--error);
}

.breakdown-amount {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.unmatched-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--error-dim);
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
}

.unmatched-stat {
    text-align: center;
}

.unmatched-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.unmatched-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--error);
}

.files-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.files-summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.files-summary-item.razorpay {
    border-left: 3px solid var(--accent);
}

.files-summary-item.metabase {
    border-left: 3px solid var(--success);
}

.files-summary-count {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.3s ease;
}

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

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

.loading-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .drop-zone {
        padding: 40px 24px;
    }
    
    .container {
        padding: 40px 16px;
    }
}
