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

:root {
    --red: #dc3545;
    --yellow: #ffc107;
    --green: #28a745;
    --warning: #fd7e14;
    --bg: #f8f9fa;
    --surface: #fff;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --primary: #0d6efd;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Layout === */
header {
    text-align: center;
    padding: 2rem 1rem 1rem;
}
.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}
.header-logo {
    width: 64px;
    height: auto;
}
header h1 { font-size: 2rem; text-align: left; }
.subtitle { color: var(--text-muted); margin-top: 0.15rem; text-align: left; }

main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
}

footer {
    text-align: center;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.disclaimer {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 600px;
    margin: 0 auto;
}

/* === Upload === */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--surface);
}
.drop-zone:hover,
.drop-zone--active {
    border-color: var(--primary);
    background: #e7f1ff;
}
.drop-zone__icon { font-size: 3rem; margin-bottom: 1rem; }
.drop-zone__text { font-size: 1.1rem; font-weight: 500; }
.drop-zone__hint { color: var(--text-muted); margin-top: 0.5rem; font-size: 0.9rem; }

.supported-formats,
.supported-types {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* === Progress === */
.progress-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    position: relative;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 1;
}
.step::after {
    content: attr(data-label);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
    white-space: nowrap;
}
.step__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s, box-shadow 0.3s;
}
.step--active .step__dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
    animation: dot-pulse 1.5s infinite;
}
.step--done .step__dot {
    background: var(--green);
}
.step--done::after,
.step--active::after {
    color: var(--text);
    font-weight: 500;
}
@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(13, 110, 253, 0.1); }
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar__fill {
    height: 100%;
    background: var(--primary);
    width: 5%;
    transition: width 0.5s ease;
}

.progress-status {
    text-align: center;
    font-weight: 500;
    margin-top: 1rem;
}

.progress-meta {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 1rem;
    margin-top: 0.5rem;
}
.progress-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Report === */
.report-actions {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.report-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    line-height: 1.7;
}

.report-content h1,
.report-content h2,
.report-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}
.report-content h1 { font-size: 1.5rem; }
.report-content h2 { font-size: 1.25rem; }
.report-content h3 { font-size: 1.1rem; }
.report-content h1:first-child,
.report-content h2:first-child,
.report-content h3:first-child { margin-top: 0; }

.report-content p { margin-bottom: 0.75rem; }
.report-content ul, .report-content ol { margin-left: 1.5rem; margin-bottom: 0.75rem; }

.report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.report-content th,
.report-content td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
.report-content th { background: var(--bg); font-weight: 600; }

/* Risk badges */
.risk-red { color: var(--red); font-weight: 700; }
.risk-yellow { color: #b38600; font-weight: 700; }
.risk-green { color: var(--green); font-weight: 700; }
.risk-warning { color: var(--warning); font-weight: 700; }

/* === Error === */
.error-box {
    background: #fff5f5;
    border: 1px solid var(--red);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.error-box p { margin-bottom: 1rem; color: var(--red); }

/* === Buttons === */
.btn {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn--secondary { background: var(--surface); }
.btn--secondary:hover { background: var(--bg); }
.btn--cancel { background: var(--surface); color: var(--text-muted); }
.btn--cancel:hover { background: #fff5f5; color: var(--red); border-color: var(--red); }

.progress-actions { text-align: center; margin-top: 1rem; }

/* Progress done → compact */
.progress--done {
    padding: 0.75rem 1.5rem;
}
.progress--done .progress-steps { margin-bottom: 0.5rem; }
.progress--done .progress-bar { display: none; }
.progress--done .progress-bottom { display: none; }
.progress--done .progress-actions { display: none; }

/* Report wrapper */
.report-wrapper { margin-top: 1rem; }

/* === Utilities === */
.hidden { display: none !important; }

/* === Print === */
@media print {
    header, footer, .report-actions, .btn { display: none; }
    .report-content { border: none; padding: 0; }
    body { background: white; }
}

/* Timer */
.timer {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.timer-done {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-right: auto;
}

/* Blockquote (citation warnings) */
.report-content blockquote {
    border-left: 3px solid var(--warning);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    background: #fff8f0;
    color: #7a4c00;
    font-size: 0.9rem;
}
