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

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #64748b;
}

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

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

header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.api-status {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    background: var(--border);
    color: var(--text-secondary);
}

.status-badge.active {
    background: #d1fae5;
    color: var(--success);
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.file-info {
    padding: 1rem;
    background: #eff6ff;
    border-radius: 0.5rem;
    border: 1px solid var(--primary);
}

textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.875rem;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.config-group {
    margin-bottom: 1.5rem;
}

.config-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.provider-select {
    display: flex;
    gap: 1rem;
}

.provider-btn {
    flex: 1;
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.provider-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.provider-btn.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.provider-icon {
    font-size: 2rem;
}

.provider-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.provider-cost {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input[type="range"] {
    width: calc(100% - 4rem);
    margin-right: 1rem;
}

#num-analyses-value {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.2rem;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

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

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

.progress-bar {
    width: 100%;
    height: 2rem;
    background: var(--border);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.5s ease;
    width: 0%;
}

.progress-fill.active {
    background-size: 200% 100%;
    background-image: linear-gradient(90deg, var(--primary) 0%, var(--success) 50%, var(--primary) 100%);
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

#progress-message {
    text-align: center;
    font-weight: 500;
    margin-bottom: 1rem;
}

#hypotheses-list {
    margin-top: 1.5rem;
}

.hypothesis-item {
    padding: 1rem;
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    margin-bottom: 0.75rem;
    border-radius: 0.25rem;
}

.results-summary {
    padding: 1rem;
    background: #f0fdf4;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.results-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Upload progress */
.upload-progress-bar {
    width: 80%;
    margin: 0.75rem auto;
    height: 0.6rem;
    background: var(--border);
    border-radius: 9999px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.2s ease;
    width: 0%;
}

/* Tabs */
.tab-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

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

/* URL input */
.url-input-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.url-input-row input {
    flex: 1;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.url-input-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.url-status {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.url-status.loading { color: var(--text-secondary); }
.url-status.success { color: var(--success); }
.url-status.error   { color: var(--error); }
/* ── Comparison mode ─────────────────────────────────────────── */
.mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.mode-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}

.mode-btn.active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
}

.dataset-slot {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fafbfc;
}

.compare-only .dataset-label {
    color: var(--primary);
}

.dataset-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.dataset-label.ds2 {
    color: #7c3aed;
}

.compare-only {
    border-color: #ede9fe;
    background: #faf5ff;
}

/* ── Shared background & global layout ──────────────────────────────────── */
:root {
    --bg-image: url('https://images.unsplash.com/photo-1628595351029-c2bf17511435?w=1920&auto=format&fit=crop&q=80');
}

.page-bg {
    min-height: 100vh;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* ── Shared footer ───────────────────────────────────────────────────────── */
.cv-footer {
    background: rgba(8, 15, 40, 0.92);
    backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.55);
    text-align: center;
    padding: 32px 24px;
    font-size: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
}
.cv-footer .footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}
.cv-footer .footer-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.03em;
}
.cv-footer .footer-tagline {
    color: rgba(255,255,255,0.45);
    font-size: 0.8rem;
}
.cv-footer .footer-links {
    display: flex;
    gap: 20px;
    margin-top: 4px;
}
.cv-footer .footer-links a {
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}
.cv-footer .footer-links a:hover { color: rgba(255,255,255,0.8); }
