:root {
    --bg-color: #ffffff;
    --card-bg: #f8fafc;
    --border-color: #e2e8f0;
    --primary: #000000;
    --primary-hover: #333333;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --text-main: #000000;
    --text-muted: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --font-family: 'Inter', sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

/* Cards & Layout */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

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

/* Upload Area */
.drop-zone {
    border: 2px dashed var(--border-color);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    pointer-events: none; /* Let clicks pass to parent */
}

.upload-icon {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 1rem;
    border-radius: 50%;
}

.drop-zone h2 {
    font-weight: 600;
    font-size: 1.25rem;
}

.drop-zone p {
    color: var(--text-muted);
}

.drop-zone p span {
    color: var(--primary);
    font-weight: 500;
    text-decoration: underline;
}

.file-types {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* Validation Area */
.validation-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .validation-grid {
        grid-template-columns: 1fr;
    }
}

.preview-section h3, .form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.preview-container {
    width: 100%;
    height: 500px;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container iframe, .preview-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.form-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input, .form-group select {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Calendar icon styling for light mode */
::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-block {
    width: 100%;
}

/* Export Section */
.export-card {
    max-width: 600px;
    margin: 0 auto;
}

.export-header {
    text-align: center;
    margin-bottom: 2rem;
}

.export-icon {
    display: inline-flex;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 1rem;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.export-header h2 {
    margin-bottom: 0.5rem;
}

.export-header p {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Dashboard Summary */
.dashboard-summary {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.summary-card {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 2rem 4rem;
    text-align: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.summary-card h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-card p {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* List Section */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.table-container {
    overflow-x: auto;
}
.invoices-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.invoices-table th, .invoices-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.invoices-table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}
.invoices-table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}
.action-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--secondary);
    color: white;
    margin-right: 0.5rem;
}
.action-btn.danger {
    background: var(--error);
}
.action-btn.danger:hover {
    background: #dc2626;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #ffffff;
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out forwards;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}
