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

:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #555;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --border: #e2e8f0;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "Consolas", "Fira Code", "Courier New", monospace;
}

html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }

/* Layout */
.app-container { max-width: 900px; margin: 0 auto; padding: 24px 16px 48px; }
.app-header { text-align: center; margin-bottom: 32px; }
.app-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 8px; }
.subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* Three-column file drop row */
.file-drop-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* Section card */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}
.section h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.section .required { color: var(--error); }
.section .optional { color: var(--text-secondary); font-size: 0.8rem; }

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.drop-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.drop-zone.drag-active { border-color: var(--primary); background: var(--primary-light); transform: scale(1.01); }
.drop-zone.loaded { border-color: var(--success); background: #f0fdf4; border-style: solid; }
.drop-icon { font-size: 2rem; }
.drop-text { color: var(--text-secondary); font-size: 0.85rem; word-break: break-all; }
.drop-text.loaded-name { color: var(--success); font-weight: 500; }

/* Clear button inside drop zone */
.btn-clear {
    font-size: 0.75rem;
    padding: 2px 8px;
    color: var(--error);
    background: transparent;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    cursor: pointer;
    margin-top: 4px;
}
.btn-clear:hover { background: var(--error-bg); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 0.9rem; font-weight: 500;
    cursor: pointer; transition: all 0.15s ease;
    background: var(--surface); color: var(--text); font-family: var(--font);
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* Action bar */
.action-bar { display: flex; justify-content: center; gap: 16px; margin-top: 20px; }

/* Error banner */
.error-banner {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; background: var(--error-bg);
    border: 1px solid #fecaca; border-radius: var(--radius);
    color: var(--error); font-size: 0.9rem; margin-bottom: 16px;
}
.error-close { margin-left: auto; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--error); }

/* Generating */
.generating-section {
    text-align: center; padding: 64px 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Done */
.done-section {
    text-align: center; padding: 48px 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.done-section h2 { font-size: 1.5rem; margin-bottom: 12px; }
.done-summary { color: var(--text-secondary); margin-bottom: 24px; }

/* Log panel */
.log-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px 20px;
    box-shadow: var(--shadow);
}
.log-panel h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; }
.log-panel.clean h3 { color: var(--success); }
.log-panel.warnings h3 { color: var(--warning); }
.log-panel.errors h3 { color: var(--error); }
.log-clean { color: var(--success); font-size: 0.9rem; }
.log-list { list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.log-item { font-size: 0.82rem; font-family: var(--font-mono); padding: 4px 8px; border-radius: 4px; }
.log-item.warning { background: var(--warning-bg); color: var(--warning); }
.log-item.error { background: var(--error-bg); color: var(--error); }

/* Responsive */
@media (max-width: 700px) {
    .file-drop-row { grid-template-columns: 1fr; }
    .app-header h1 { font-size: 1.3rem; }
    .btn-lg { width: 100%; }
    .action-bar { flex-direction: column; align-items: center; }
}
