/* ═══════════════════════════════════════════════════════════
   Anchor App Design System
   Shared across all anchorcodec.com application portals.
   Dark theme. Flat. Linear. No rotary, no circular elements.
   ═══════════════════════════════════════════════════════════ */

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

:root {
    --bg-base:      #0f172a;
    --bg-surface:   #1e293b;
    --bg-raised:    #263347;
    --border:       #334155;
    --border-light: #475569;

    --text-primary:  #e2e8f0;
    --text-secondary:#94a3b8;
    --text-muted:    #64748b;

    --accent:        #0ea5e9;   /* sky-500 */
    --accent-dim:    rgba(14,165,233,0.15);
    --accent2:       #f97316;   /* orange-500 */
    --accent2-dim:   rgba(249,115,22,0.15);
    --green:         #22c55e;
    --green-dim:     rgba(34,197,94,0.15);
    --red:           #ef4444;
    --red-dim:       rgba(239,68,68,0.15);
    --yellow:        #eab308;
    --purple:        #a855f7;

    --font: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;

    --radius:   6px;
    --radius-sm: 4px;
    --shadow: 0 4px 12px rgba(0,0,0,0.4);
}

html { font-size: 16px; }

body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

/* ── Navigation ───────────────────────────────────────────── */
.anc-nav {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.anc-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.anc-nav-brand {
    color: var(--accent);
    font-weight: 800;
    font-size: 1.05rem;
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.anc-nav-brand span {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.anc-nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.anc-nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.anc-nav-links a:hover { color: var(--text-primary); background: var(--bg-raised); }
.anc-nav-links a.active { color: var(--accent); background: var(--accent-dim); }

/* ── Main Layout ──────────────────────────────────────────── */
.anc-main {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

.anc-main-wide {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* ── Page Header ──────────────────────────────────────────── */
.anc-page-header {
    margin-bottom: 1.75rem;
}

.anc-page-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.anc-page-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 640px;
}

/* ── Cards ────────────────────────────────────────────────── */
.anc-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.anc-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* ── Grid helpers ─────────────────────────────────────────── */
.anc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.anc-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.anc-grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }

/* ── Stat boxes ───────────────────────────────────────────── */
.anc-stat {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.anc-stat-value {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1;
}

.anc-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Forms ────────────────────────────────────────────────── */
.anc-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.anc-input,
.anc-textarea,
.anc-select {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s;
    outline: none;
}

.anc-input:focus,
.anc-textarea:focus,
.anc-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.anc-textarea { resize: vertical; min-height: 120px; font-family: var(--font-mono); font-size: 0.8rem; }

.anc-field { margin-bottom: 1rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.anc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, background 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.anc-btn:hover { opacity: 0.88; }
.anc-btn:active { opacity: 0.75; }

.anc-btn-primary  { background: var(--accent);  color: #fff; }
.anc-btn-orange   { background: var(--accent2); color: #fff; }
.anc-btn-green    { background: var(--green);   color: #000; }
.anc-btn-ghost    { background: var(--bg-raised); color: var(--text-secondary); border: 1px solid var(--border); }
.anc-btn-sm       { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

/* ── Badges ───────────────────────────────────────────────── */
.anc-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.anc-badge-pass   { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(34,197,94,0.3); }
.anc-badge-fail   { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(239,68,68,0.3); }
.anc-badge-info   { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(14,165,233,0.3); }
.anc-badge-warn   { background: rgba(234,179,8,0.15); color: var(--yellow); border: 1px solid rgba(234,179,8,0.3); }
.anc-badge-neutral{ background: var(--bg-raised);  color: var(--text-muted); border: 1px solid var(--border); }

/* ── Result block ─────────────────────────────────────────── */
.anc-result {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.anc-result-pass { border-color: rgba(34,197,94,0.4);  background: rgba(34,197,94,0.05); }
.anc-result-fail { border-color: rgba(239,68,68,0.4);  background: rgba(239,68,68,0.05); }

/* ── Check list (verify results) ─────────────────────────── */
.anc-checklist { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }

.anc-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.83rem;
    color: var(--text-secondary);
}

.anc-checklist li .chk-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 900;
}

.anc-checklist li.pass .chk-icon { background: var(--green-dim); color: var(--green); }
.anc-checklist li.fail .chk-icon { background: var(--red-dim);   color: var(--red);   }
.anc-checklist li.pass { color: var(--text-primary); }
.anc-checklist li.fail { color: var(--red); }

/* ── Tables ───────────────────────────────────────────────── */
.anc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.anc-table thead tr { border-bottom: 2px solid var(--border); }

.anc-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.anc-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

.anc-table tr:last-child td { border-bottom: none; }
.anc-table tr:hover td { background: var(--bg-raised); }

/* ── Divider ──────────────────────────────────────────────── */
.anc-divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ── Alert ────────────────────────────────────────────────── */
.anc-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.anc-alert-info { background: var(--accent-dim); border: 1px solid rgba(14,165,233,0.3); color: var(--accent); }
.anc-alert-warn { background: rgba(234,179,8,0.1); border: 1px solid rgba(234,179,8,0.3); color: var(--yellow); }
.anc-alert-fail { background: var(--red-dim); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.anc-alert-pass { background: var(--green-dim); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }

/* ── Footer ───────────────────────────────────────────────── */
.anc-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.anc-footer a { color: var(--text-muted); text-decoration: none; }
.anc-footer a:hover { color: var(--text-secondary); }

/* ── Spinner ──────────────────────────────────────────────── */
.anc-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: anc-spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes anc-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   WALK STATE RESULT DISPLAY
   Shows encoding outcomes — not internals.
   Displays: walk ID, stage count, ratio, entropy reduction.
   Does NOT expose selector names, values, or chain structure.
   ══════════════════════════════════════════════════════════ */

.anc-walk {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.anc-walk-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Pipeline progress bar — shows stages resolved as filled segments */
.anc-walk-pipeline {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 0.85rem;
}

/* Each segment = one resolved stage (opaque — no label) */
.anc-walk-segment {
    flex: 1;
    height: 8px;
    border-radius: 2px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.anc-walk-segment.done {
    background: var(--accent);
    border-color: var(--accent);
}

.anc-walk-segment.done.final {
    background: var(--green);
    border-color: var(--green);
}

/* Summary row: walk ID, ratio, status */
.anc-walk-summary {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.anc-walk-summary-item {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.anc-walk-summary-item strong {
    color: var(--text-primary);
    font-weight: 700;
}

.anc-walk-summary-item .walk-id {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent);
    letter-spacing: 0.03em;
}

/* Entropy reduction bar */
.anc-entropy-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.anc-entropy-track {
    flex: 1;
    height: 6px;
    background: var(--bg-raised);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.anc-entropy-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--green) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.anc-entropy-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
    .anc-grid-2, .anc-grid-3 { grid-template-columns: 1fr; }
    .anc-main { padding: 1.25rem 1rem; }
    .anc-nav-links { display: none; }
}
