:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f9fafb;
    --sidebar-color: #111827;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --sidebar-hover: #1f2937;
    --sidebar-text: #9ca3af;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Dark Mode Variables */
.dark {
    --bg-color: #0f172a;
    --sidebar-color: #020617;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --sidebar-hover: #1e293b;
    --sidebar-text: #94a3b8;
    --white: #ffffff;
}

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

body, html {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-color);
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: background-color 0.3s;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: var(--white);
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    color: var(--sidebar-text);
    margin-bottom: 4px;
}

.sidebar-nav li:hover {
    background-color: var(--sidebar-hover);
    color: var(--white);
}

.sidebar-nav li.active {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Main Content */
.main-content {
    flex: 1;
    height: 100%;
    padding: 40px;
    overflow-y: auto;
}

.app-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, border-color 0.3s;
}

.app-card h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.app-card .description {
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Upload Section */
.upload-section {
    border: 2px dashed var(--border-color);
    padding: 60px 40px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: rgba(0,0,0,0.02);
}

.dark .upload-section {
    background-color: rgba(255,255,255,0.02);
}

.upload-section:hover, .upload-section.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.05);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

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

.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    margin-right: 8px;
}

.btn-secondary:hover {
    background-color: rgba(0,0,0,0.05);
}

.dark .btn-secondary:hover {
    background-color: rgba(255,255,255,0.05);
}

#status {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.status-success { color: #10b981; background-color: rgba(16, 185, 129, 0.1); }
.status-error { color: #ef4444; background-color: rgba(239, 68, 68, 0.1); }

/* Preview Table */
.preview-area {
    margin-top: 32px;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}

.preview-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

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

.preview-table th, .preview-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.preview-table th {
    background-color: rgba(0,0,0,0.02);
    font-weight: 600;
    color: var(--text-muted);
}

.dark .preview-table th {
    background-color: rgba(255,255,255,0.02);
}

.preview-table tr:last-child td {
    border-bottom: none;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
