* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5aa0;
    --primary-dark: #1e3f6a;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #f5f7fa;
    --border-color: #e0e0e0;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
}

main {
    flex: 1;
}

section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary-color);
}

h2 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-weight: 600;
}

/* Upload Section */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafbfc;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: #f0f4f8;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: #e3f2fd;
}

.upload-icon {
    width: 50px;
    height: 50px;
    color: var(--primary-color);
    margin-bottom: 15px;
    stroke-width: 1.5;
}

.upload-area p {
    color: var(--text-light);
    font-size: 1em;
}

.upload-area strong {
    color: var(--primary-color);
}

.file-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    background: var(--light-bg);
    padding: 12px 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
}

.file-item.processing {
    background: #fff3cd;
}

.file-item.success {
    background: #d4edda;
}

.file-item.error {
    background: #f8d7da;
}

.file-name {
    font-weight: 500;
}

.file-status {
    font-size: 0.9em;
    color: var(--text-light);
}

.remove-file {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2em;
    padding: 0;
    margin-left: 10px;
}

.remove-file:hover {
    transform: scale(1.2);
}

/* Process Section */
.process-section {
    text-align: center;
}

/* Status Section */
.status-section {
    border-left-color: var(--warning-color);
}

.status-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.extraction-log {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 6px;
    font-size: 0.95em;
    max-height: 300px;
    overflow-y: auto;
}

.log-entry {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-status {
    font-weight: 600;
    min-width: 50px;
}

.log-status.ok {
    color: var(--success-color);
}

.log-status.error {
    color: var(--danger-color);
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Download Section */
.download-section {
    border-left-color: var(--success-color);
    text-align: center;
}

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

/* History Section */
.history-section {
    border-left-color: var(--text-light);
}

.file-history {
    display: grid;
    gap: 10px;
}

.history-item {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
}

.history-item-info {
    flex: 1;
}

.history-item-name {
    font-weight: 500;
    color: var(--primary-color);
}

.history-item-meta {
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: 3px;
}

.btn {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-icon {
    font-size: 1.1em;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

.btn-download {
    background-color: var(--primary-color);
    color: white;
}

.btn-download:hover {
    background-color: var(--primary-dark);
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.9em;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .container {
        padding: 15px;
    }

    section {
        padding: 20px;
    }

    h2 {
        font-size: 1.2em;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-item-name {
        margin-bottom: 5px;
    }
}

/* Error handling */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.warning-message {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}
