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

:root {
    --primary: #1a3a5c;
    --secondary: #2e86c1;
    --accent: #f39c12;
    --success: #27ae60;
    --error: #e74c3c;
    --light: #eaf4fb;
    --gray: #7f8c8d;
    --bg: #f0f4f8;
    --white: #ffffff;
    --text: #2c3e50;
    --border: #dee2e6;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-size: 3rem;
    line-height: 1;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.subtitle {
    opacity: 0.85;
    font-size: 0.95rem;
}

main {
    flex: 1;
    padding: 2rem 1rem;
}

.container {
    max-width: 700px;
    margin: 0 auto 2rem;
}

/* Cards */
.upload-card, .progress-card, .result-card, .error-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    background: var(--light);
    border-bottom: 2px solid var(--border);
}

.card-header h2 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.card-header p {
    color: var(--gray);
    font-size: 0.9rem;
}

.card-header.success {
    background: #d4edda;
    border-color: var(--success);
}

.card-header.success h2 {
    color: var(--success);
}

.card-header.error {
    background: #f8d7da;
    border-color: var(--error);
}

.card-header.error h2 {
    color: var(--error);
}

/* Drop Zone */
.drop-zone {
    margin: 1.5rem;
    border: 3px dashed var(--secondary);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--light);
    position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: #fff8e7;
    transform: scale(1.01);
}

.drop-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.drop-text {
    color: var(--gray);
    font-size: 1rem;
    line-height: 1.6;
}

.drop-text strong {
    color: var(--secondary);
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

/* File list (multi-file) */
.file-list {
    margin: 0 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* File info row */
.file-info {
    padding: 0.6rem 1rem;
    background: #e8f5e9;
    border-radius: 8px;
    border: 1px solid #a5d6a7;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.file-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--gray);
    flex-shrink: 0;
}

.file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--error);
    font-size: 0.85rem;
    padding: 0 0.2rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.file-remove:hover {
    opacity: 1;
}

/* Buttons */
.btn {
    display: block;
    width: calc(100% - 3rem);
    margin: 0 1.5rem 1.5rem;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
}

.btn-secondary {
    background: var(--light);
    color: var(--primary);
    border: 2px solid var(--border);
}

.btn-pdf {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-excel {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
}

/* Download buttons layout */
.download-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem;
}

.download-buttons .btn {
    width: 100%;
    margin: 0;
}

/* Progress */
.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem 1rem;
    gap: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.step-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.step.active .step-icon {
    background: var(--secondary);
    box-shadow: 0 0 0 4px rgba(46, 134, 193, 0.2);
    animation: pulse 1.5s infinite;
}

.step.done .step-icon {
    background: var(--success);
}

.step-label {
    font-size: 0.8rem;
    color: var(--gray);
    white-space: nowrap;
}

.step.active .step-label, .step.done .step-label {
    color: var(--text);
    font-weight: 600;
}

.step-line {
    flex: 1;
    height: 3px;
    background: var(--border);
    margin-bottom: 1.5rem;
    transition: background 0.3s ease;
    min-width: 30px;
}

.step-line.done {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(46, 134, 193, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(46, 134, 193, 0.1); }
}

.progress-bar-container {
    margin: 0.5rem 1.5rem;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    padding: 1rem;
    color: var(--secondary);
    font-weight: 500;
}

.progress-hint {
    text-align: center;
    padding: 0 1rem 1.5rem;
    color: var(--gray);
    font-size: 0.85rem;
}

/* Job progress items */
.job-progress-item {
    margin: 1rem 1.5rem 0.5rem;
    padding: 0.8rem 1rem;
    background: var(--light);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.job-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.job-status-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.job-filename {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.job-status-label {
    color: var(--gray);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.job-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

/* Result items (multi-file results) */
.result-item {
    margin: 1rem 1.5rem 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.result-item .summary {
    margin: 0;
    border-radius: 0;
    border-left: 4px solid var(--accent);
}

.result-item .download-buttons {
    margin: 0.8rem;
}

.result-item-error .summary {
    border-left-color: var(--error);
}

/* Summary */
.summary {
    margin: 1.5rem;
    padding: 1.2rem;
    background: var(--light);
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.summary h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.summary .total {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0.5rem 0;
}

.summary .meta {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Error */
.error-card p {
    padding: 1.5rem;
    color: var(--error);
}

/* Info section */
.info-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 0;
}

.info-section h3 {
    text-align: center;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s ease;
}

.info-card:hover {
    transform: translateY(-4px);
}

.info-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.info-card h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.info-card p {
    color: var(--gray);
    font-size: 0.9rem;
    line-height: 1.5;
}

.stages-info {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stages-info h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.stages-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.stage-item {
    background: var(--light);
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--secondary);
    font-weight: 500;
    border: 1px solid var(--border);
}

/* Footer */
footer {
    background: var(--primary);
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

footer .footer-note {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 0.5rem;
}

@media (max-width: 600px) {
    header h1 { font-size: 1.4rem; }
    .logo { font-size: 2rem; }
    .download-buttons { grid-template-columns: 1fr; }
    .progress-steps { gap: 0; }
    .step-line { min-width: 15px; }
}

.context-section {
    margin: 0 1.5rem 1rem;
}
.context-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
    font-size: 0.95rem;
}
.context-section textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
    background: white;
    box-sizing: border-box;
}
.context-section textarea:focus {
    outline: none;
    border-color: var(--secondary);
}
