/* ── ekokrati design system ──────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

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

:root {
    --bg:           #f2f0eb;
    --surface:      #fafaf8;
    --border:       #d8d5ce;
    --text:         #1a1a18;
    --muted:        #7a7870;
    --accent:       #2d6a4f;
    --accent-h:     #1b4332;
    --accent-dim:   #d8eedd;
    --danger:       #b5322a;
    --success:      #2a7a52;
    --warning-bg:   #fef3c7;
    --warning-text: #92400e;
    --mono:         'IBM Plex Mono', monospace;
    --sans:         'IBM Plex Sans', sans-serif;
    --radius:       3px;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 2.5rem 1rem 4rem;
}

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

/* ── Header ──────────────────────────────────────────────────────────────── */

.site-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--text);
}

.site-header .wordmark {
    font-family: var(--mono);
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -0.02em;
}

.site-header .wordmark span { color: var(--accent); }

.site-header .breadcrumb {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
}

.site-header .breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}

.site-header .breadcrumb a:hover { color: var(--accent); }

/* ── Page title ──────────────────────────────────────────────────────────── */

.page-title {
    font-family: var(--mono);
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-title {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 1rem;
}

/* ── Form elements ───────────────────────────────────────────────────────── */

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.field { margin-bottom: 0.9rem; }
.field:last-child { margin-bottom: 0; }

input[type="text"],
input[type="number"],
input[type="password"],
select {
    width: 100%;
    padding: 0.45rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--sans);
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.12s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

select:disabled { background: var(--bg); color: var(--muted); }

.hint {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.2rem;
    font-family: var(--mono);
}

.params-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ── Mode toggle ─────────────────────────────────────────────────────────── */

.mode-toggle {
    display: flex;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.mode-btn {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: none;
    border-right: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-btn:last-child { border-right: none; }
.mode-btn.active { background: var(--text); color: #fff; }
.mode-btn:hover:not(.active) { background: var(--bg); }
.mode-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mode-btn.restored { color: var(--accent); font-style: italic; }
.mode-btn.restored::after { content: ' ✓'; font-style: normal; }

/* ── File drop ───────────────────────────────────────────────────────────── */

.file-drop {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.file-drop:hover, .file-drop.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.file-drop input[type="file"] {
    position: absolute; inset: 0; opacity: 0;
    cursor: pointer; width: 100%; height: 100%;
}

.file-drop .drop-icon  { font-size: 1.4rem; margin-bottom: 0.4rem; }
.file-drop .drop-label { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }
.file-drop .drop-fname { font-size: 0.8rem; font-weight: 600; color: var(--accent); margin-top: 0.4rem; font-family: var(--mono); }

.file-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.layer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.72rem; padding: 0.2rem 0.5rem;
    border-radius: 99px; font-weight: 500; font-family: var(--mono);
}

.badge.loading { background: var(--warning-bg); color: var(--warning-text); }
.badge.ok      { background: var(--accent-dim); color: var(--accent-h); }
.badge.error   { background: #fee2e2; color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: var(--text);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--mono);
    cursor: pointer;
    transition: background 0.15s;
    letter-spacing: 0.02em;
}

.btn-primary:hover:not(:disabled) { background: var(--accent); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: var(--text);
    color: white;
    border-radius: var(--radius);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: var(--mono);
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}

.btn-secondary:hover { background: var(--accent); }

/* ── Status panel ────────────────────────────────────────────────────────── */

.status-panel {
    display: none;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-left: 4px solid var(--accent);
}

.status-panel.error  { border-left-color: var(--danger); }
.status-panel.done   { border-left-color: var(--success); }
.status-panel.running { border-left-color: var(--accent); }
.status-panel.info   { border-left-color: var(--muted); }

.status-title  { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.15rem; }
.status-detail { font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }

/* ── Results ─────────────────────────────────────────────────────────────── */

.results-panel { display: none; margin-top: 1rem; }

.results-panel pre {
    background: #1a1a18;
    color: #c8c5be;
    padding: 1rem;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 0.75rem;
    overflow-x: auto;
    max-height: 420px;
    line-height: 1.5;
}

/* ── Animations ──────────────────────────────────────────────────────────── */

.progress-dots::after {
    content: '';
    animation: dots 1.2s steps(3, end) infinite;
}

@keyframes dots {
    0%   { content: ''; }
    33%  { content: '.'; }
    66%  { content: '..'; }
    100% { content: '...'; }
}

/* ── Progress bar ────────────────────────────────────────────────────────── */

.progress-bar {
    display: none;
    height: 3px;
    background: var(--border);
    border-radius: 99px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width 1s linear;
    width: 0%;
}

.elapsed-timer {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.25rem;
}
