/* ══════════════════════════════════════════════════════════════
   F4HWN web tools — shared design system (tokens + generic components).
   This is a standalone copy: keep it identical across k5viewer / uvtools2
   so the tools stay visually aligned. Loaded BEFORE the app's own stylesheet:
       <link href="css/theme.css" rel="stylesheet">
══════════════════════════════════════════════════════════════ */

:root {
    --bg: #fafbfc;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --error: #ef4444;
    --error-hover: #b22222;
    --radius: 8px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-header: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Monospace stack for technical/numeric UI (status, codes, tables) */
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', ui-monospace, monospace;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --error: #ef4444;
    --error-hover: #b22222;
}

/* ── Reset & base ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.2s, color 0.2s;
}

/* ══════════════════════════════════════════════════════════════
   Buttons — brushed-aluminium in light, premium alu in dark
══════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    height: 36px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    /* Light: alu clair */
    background: linear-gradient(160deg, #f9fafb 0%, #e5e7eb 100%);
    border: 1px solid #9ca3af;
    color: #374151;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.9);
}

.btn:hover:not(:disabled) {
    background: linear-gradient(160deg, #fff 0%, #f3f4f6 100%);
    border-color: #2563eb;
    color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 0 6px rgba(37,99,235,0.15), inset 0 1px 0 #fff;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.12);
    background: linear-gradient(160deg, #e5e7eb 0%, #d1d5db 100%);
}

.btn.primary {
    background: linear-gradient(160deg, #3b82f6 0%, #2563eb 100%);
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 2px 6px rgba(37,99,235,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn.primary:hover:not(:disabled) {
    background: linear-gradient(160deg, #60a5fa 0%, #3b82f6 100%);
    border-color: #3b82f6;
    color: #fff;
    box-shadow: 0 3px 10px rgba(37,99,235,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

.btn.danger {
    background: linear-gradient(160deg, #f87171 0%, #ef4444 100%);
    border-color: #dc2626;
    color: #fff;
    box-shadow: 0 2px 6px rgba(239,68,68,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn.danger:hover:not(:disabled) {
    background: linear-gradient(160deg, #fca5a5 0%, #f87171 100%);
    border-color: #ef4444;
    color: #fff;
    box-shadow: 0 3px 10px rgba(239,68,68,0.4), inset 0 1px 0 rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Dark mode overrides */
[data-theme="dark"] .btn {
    background: linear-gradient(170deg, #2e3d50 0%, #1e2d3d 60%, #253040 100%);
    border: 1px solid #3a4d62;
    color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
}
[data-theme="dark"] .btn:hover:not(:disabled) {
    background: linear-gradient(170deg, #3d5068 0%, #2a3d52 100%);
    border-color: #4a6a8a;
    color: #e2e8f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5), 0 0 8px rgba(59,130,246,0.15), inset 0 1px 0 rgba(255,255,255,0.1);
}
[data-theme="dark"] .btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 4px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(170deg, #1e2d3d 0%, #253040 100%);
}
[data-theme="dark"] .btn.primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}
[data-theme="dark"] .btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    box-shadow: 0 4px 12px rgba(59,130,246,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-1px);
}
[data-theme="dark"] .btn.danger {
    background: linear-gradient(170deg, #7f1d1d 0%, #3d0000 100%);
    border-color: #dc2626;
    color: #fca5a5;
    box-shadow: 0 2px 8px rgba(239,68,68,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}
[data-theme="dark"] .btn.danger:hover:not(:disabled) {
    background: linear-gradient(170deg, #991b1b 0%, #450a0a 100%);
    border-color: #ef4444;
    color: #fecaca;
    box-shadow: 0 4px 12px rgba(239,68,68,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
    transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════
   Select — matches the alu button treatment
══════════════════════════════════════════════════════════════ */
select {
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    appearance: none;
    -webkit-appearance: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239ca3af'/%3E%3C/svg%3E")
        no-repeat right 10px center,
        linear-gradient(160deg, #f9fafb 0%, #e5e7eb 100%);
    border: 1px solid #9ca3af;
    color: #374151;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.9);
    padding-right: 28px;
}

select:hover {
    border-color: #2563eb;
    color: #1d4ed8;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 0 6px rgba(37,99,235,0.15), inset 0 1px 0 #fff;
}

select:focus {
    outline: none;
    border-color: #2563eb;
}

[data-theme="dark"] select {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E")
        no-repeat right 10px center,
        linear-gradient(170deg, #2e3d50 0%, #1e2d3d 60%, #253040 100%);
    border: 1px solid #3a4d62;
    color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
}

[data-theme="dark"] select:hover {
    border-color: #4a6a8a;
    color: #e2e8f0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5), 0 0 8px rgba(59,130,246,0.15);
}
