/* CSS Variables */
:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #64748b;
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-background: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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

/* Base styles */
html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background-color: var(--color-background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.nav a {
    color: var(--color-text);
    text-decoration: none;
    margin-left: 1.5rem;
}

.nav a:hover {
    color: var(--color-primary);
}

/* Main content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Footer */
.footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* Hero section */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.hero-text {
    font-size: 1.125rem;
    color: var(--color-text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

.btn-primary:disabled {
    background-color: var(--color-border);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Upload section */
.upload-section {
    max-width: 600px;
    margin: 0 auto 3rem;
}

.upload-form {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--color-primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.drop-zone-icon {
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.drop-zone-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.drop-zone-hint {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.file-input {
    display: none;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--color-background);
    border-radius: var(--radius);
}

.file-name {
    font-weight: 500;
}

.file-remove {
    background: none;
    border: none;
    color: var(--color-error);
    cursor: pointer;
    font-size: 0.875rem;
}

/* Form options */
.form-options {
    margin-bottom: 1.5rem;
}

.option-group {
    margin-bottom: 1rem;
}

.option-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input,
.radio-label input {
    margin-right: 0.5rem;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
}

/* Upload info */
.upload-info {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.upload-info p {
    margin-bottom: 0.25rem;
}

/* Features */
.features {
    margin-top: 4rem;
}

.features h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature {
    background-color: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.feature h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* Progress section */
.progress-section {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.progress-section h1 {
    margin-bottom: 2rem;
}

.progress-container {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 8px;
    background-color: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.progress-detail {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.progress-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Result section */
.result-section {
    max-width: 900px;
    margin: 0 auto;
}

.result-section h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.result-summary {
    background-color: var(--color-surface);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.result-summary p {
    margin-bottom: 0.25rem;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.sheets-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sheet-card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

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

.sheet-header h2 {
    font-size: 1.25rem;
}

.sheet-meta {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.sheet-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background-color: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.preview-container {
    overflow-x: auto;
    padding: 1rem;
    background-color: var(--color-background);
    border-radius: var(--radius);
}

.preview-container table {
    border-collapse: collapse;
    width: 100%;
}

.preview-container th,
.preview-container td {
    border: 1px solid var(--color-border);
    padding: 0.5rem 1rem;
    text-align: left;
}

.preview-container th {
    background-color: var(--color-surface);
    font-weight: 600;
}

.raw-content {
    background-color: var(--color-text);
    color: #f8f8f2;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.sheet-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Error section */
.error-section {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.error-icon {
    color: var(--color-error);
    margin-bottom: 1.5rem;
}

.error-section h1 {
    margin-bottom: 1.5rem;
}

.error-details {
    background-color: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.error-message {
    color: var(--color-error);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.error-type {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.error-suggestions {
    text-align: left;
    background-color: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.error-suggestions h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.error-suggestions ul {
    list-style-position: inside;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.error-suggestions li {
    margin-bottom: 0.5rem;
}

.error-actions {
    margin-top: 1.5rem;
}

/* Error message in progress */
.error-message {
    display: none;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .upload-form {
        padding: 1.5rem;
    }

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

    .sheet-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

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