/* ── CSS Variables (dark theme default) ───────────────────────────────────── */
:root {
  --bg: #0f1117;
  --bg2: #1a1d26;
  --bg3: #252836;
  --border: #2e3244;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --terminal-bg: #0d1117;
  --terminal-text: #c9d1d9;
  --badge-deploy: #166534;
  --badge-deploy-text: #4ade80;
  --badge-bootstrap: #1e3a5f;
  --badge-bootstrap-text: #60a5fa;
}
[data-theme="light"] {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --terminal-bg: #1e293b;
  --terminal-text: #e2e8f0;
  --badge-deploy: #dcfce7;
  --badge-deploy-text: #166534;
  --badge-bootstrap: #dbeafe;
  --badge-bootstrap-text: #1e40af;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 40px 36px; width: 100%; max-width: 380px; position: relative; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }
.field input { width: 100%; padding: 9px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 14px; outline: none; transition: border-color .15s; }
.field input:focus { border-color: var(--primary); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 40px; }
.reveal-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 16px; opacity: .6; }
.reveal-btn:hover { opacity: 1; }
.error-msg { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.btn-primary { width: 100%; padding: 10px; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; margin-top: 4px; transition: background .15s; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.theme-toggle-float { position: absolute; top: 14px; right: 14px; background: none; border: none; font-size: 18px; opacity: .5; }
.theme-toggle-float:hover { opacity: 1; }

/* ── App shell ───────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 52px; background: var(--bg2); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; color: var(--text-muted); }
.topbar-user span { color: var(--text); font-weight: 500; }

/* ── Nav tabs ─────────────────────────────────────────────────────────────── */
.nav-tabs { display: flex; overflow-x: auto; background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 16px; flex-shrink: 0; }
.nav-tab { padding: 12px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); border: none; background: none; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s, border-color .15s; }
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Tab content ─────────────────────────────────────────────────────────── */
.tab-content { flex: 1; overflow-y: auto; padding: 20px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 9px 12px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-deploy { background: var(--badge-deploy); color: var(--badge-deploy-text); }
.badge-bootstrap { background: var(--badge-bootstrap); color: var(--badge-bootstrap-text); }
.badge-success { background: rgba(34,197,94,.15); color: #4ade80; }
.badge-fail { background: rgba(239,68,68,.15); color: #f87171; }
.badge-rolled { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-admin { background: rgba(139,92,246,.15); color: #a78bfa; }
.badge-deployer { background: rgba(99,102,241,.15); color: #818cf8; }
.badge-viewer { background: rgba(148,163,184,.15); color: #94a3b8; }

/* ── Health dots ─────────────────────────────────────────────────────────── */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-green { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot-red { background: var(--danger); }
.dot-yellow { background: var(--warning); animation: pulse .8s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { padding: 6px 12px; border-radius: 5px; font-size: 12px; font-weight: 500; border: none; transition: opacity .15s; }
.btn:hover:not(:disabled) { opacity: .85; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 4px 8px; font-size: 11px; }
.btn-blue { background: var(--primary); color: #fff; }
.btn-green { background: var(--success); color: #fff; }
.btn-red { background: var(--danger); color: #fff; }
.btn-gray { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-warning { background: var(--warning); color: #000; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.form-group { flex: 1; min-width: 180px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.form-control { width: 100%; padding: 7px 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font-size: 13px; outline: none; }
.form-control:focus { border-color: var(--primary); }
.form-control select { appearance: none; }
select.form-control { padding-right: 24px; }
.check-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.check-row input[type=checkbox], .check-row input[type=radio] { width: 14px; height: 14px; accent-color: var(--primary); }

/* ── Terminal / Logs ─────────────────────────────────────────────────────── */
.terminal { background: var(--terminal-bg); color: var(--terminal-text); font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace; font-size: 12px; padding: 14px; border-radius: 6px; height: 420px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--border); }
.log-success { color: #4ade80; }
.log-fail    { color: #f87171; }
.log-warn    { color: #fbbf24; }
.log-info    { color: #94a3b8; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Warnings in preview modal ───────────────────────────────────────────── */
.warn-box { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin: 10px 0; }
.warn-box.yellow { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: #fcd34d; }
.warn-box.red    { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }

/* ── Convert result box ──────────────────────────────────────────────────── */
.convert-result { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin: 10px 0; }
.convert-cmd { font-family: monospace; font-size: 13px; color: var(--success); margin-bottom: 6px; }
.convert-reason { font-size: 12px; color: var(--text-muted); }
.convert-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Upload zone ─────────────────────────────────────────────────────────── */
.upload-zone { border: 2px dashed var(--border); border-radius: 8px; padding: 32px; text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color .15s, background .15s; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: rgba(99,102,241,.06); }
.upload-zone p { margin-top: 8px; font-size: 13px; }

/* ── Health disk bar ─────────────────────────────────────────────────────── */
.disk-bar { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; width: 80px; display: inline-block; vertical-align: middle; }
.disk-fill { height: 100%; border-radius: 3px; background: var(--success); transition: width .3s; }
.disk-fill.warn { background: var(--warning); }
.disk-fill.danger { background: var(--danger); }

/* ── Quick action chips ──────────────────────────────────────────────────── */
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { padding: 4px 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; font-size: 12px; cursor: pointer; transition: border-color .15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* ── Concurrency mode selector ───────────────────────────────────────────── */
.mode-selector { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.mode-opt { display: flex; align-items: center; gap: 5px; padding: 6px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; font-size: 12px; cursor: pointer; }
.mode-opt.selected { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,.1); }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { height: 3px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; }
.notification-toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; font-size: 13px; z-index: 100; box-shadow: 0 4px 20px rgba(0,0,0,.3); max-width: 320px; animation: slideUp .2s ease; }
@keyframes slideUp { from { transform: translateY(20px); opacity:0; } to { transform: translateY(0); opacity:1; } }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
