/*
 * JRodix panel temasi — docs/04 §7: ana renk lacivert (#12235c), destek mavi
 * (#1f5fd0), koyu vurgu #0b1730.
 *
 * Acik tema esastir: varsayilan `light`, kullanici tercihi (users.theme) yalnız
 * `dark` secilirse devreye girer. Kontrast ornekleri WCAG AA hedeflenerek secildi
 * (gövde #1b2436 / #ffffff = 13.4:1, soluk metin #55617a = 5.3:1).
 *
 * Derleme adimi yoktur: Blade dogrudan bu dosyayi `public/css` altindan ceker.
 * O yüzden degiskenler disinda preprocessor sirlamasi, @import veya font indir-
 * me varligi yok — sistem yigini kullanilir, hatta network offline olabilir.
 */

:root {
  --navy: #12235c;
  --navy-soft: #1c3177;
  --blue: #1f5fd0;
  --blue-soft: #e8f0fd;
  --ink: #0b1730;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f9fafd;
  --line: #d9e0ee;
  --line-strong: #b9c5dd;

  --text: #1b2436;
  --muted: #55617a;

  --ok: #14663a;      --ok-bg: #e7f5ee;
  --warn: #8a5300;    --warn-bg: #fdf3e0;
  --bad: #a11a2b;     --bad-bg: #fdeaec;
  --idle: #4c576e;    --idle-bg: #eef1f6;
  --busy: #5a2fa0;    --busy-bg: #f1eafb;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 23, 48, .06), 0 8px 24px rgba(11, 23, 48, .06);
  --sidebar-w: 232px;
  --row-h: 2.75rem;
}

[data-theme="dark"] {
  --bg: #0e1526;
  --surface: #14203a;
  --surface-2: #182644;
  --line: #27354f;
  --line-strong: #38496a;
  --text: #e7ecf7;
  --muted: #a8b4cc;
  --navy-soft: #1d2f5c;
  --ok-bg: #123322;      --ok: #79e0a6;
  --bad-bg: #3a141b;     --bad: #f6a2ad;
  --warn-bg: #3a2a10;    --warn: #f0c37a;
  --idle-bg: #1e293f;    --idle: #b6c2d9;
  --busy-bg: #2a1c45;    --busy: #cdb0f0;
  --blue-soft: #17294d;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; color: var(--ink); font-weight: 650; }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--navy); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip:focus { left: .5rem; top: .5rem; }

.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.right { text-align: right; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ------------------------------------------------------------------ kabuk */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--navy);
  color: #dbe4f7;
  padding: 1rem .75rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.sidebar .brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; color: #fff; padding: .25rem .5rem 1rem;
  letter-spacing: .01em;
}
.sidebar .brand .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--blue); color: #fff; display: grid; place-items: center;
  font-size: .8125rem; font-weight: 700;
}
.sidebar nav { display: flex; flex-direction: column; gap: 1.15rem; }
.sidebar .group > span {
  display: block; font-size: .6875rem; text-transform: uppercase;
  letter-spacing: .08em; color: #9fb0d6; padding: 0 .5rem .35rem;
}
.sidebar nav a {
  display: flex; align-items: center; gap: .6rem;
  color: #dbe4f7; padding: .55rem .6rem; border-radius: 8px; font-size: .9375rem;
}
.sidebar nav a:hover { background: var(--navy-soft); color: #fff; text-decoration: none; }
.sidebar nav a[aria-current="page"] { background: var(--blue); color: #fff; font-weight: 600; }
.sidebar nav a svg { flex: 0 0 auto; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: .6rem 1.25rem; position: sticky; top: 0; z-index: 20;
}
.topbar .who { display: flex; align-items: center; gap: .6rem; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft);
  color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: .8125rem;
}
.content { padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }

.nav-toggle { display: none; }
.nav-open-btn { display: none; }

/* ------------------------------------------------------------------ kart */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card > header {
  padding: .85rem 1rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.card > header h2, .card > header h3 { margin: 0; font-size: 1rem; }
.card > .body { padding: 1rem; }
.card.flat { box-shadow: none; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.kpi .label { font-size: .8125rem; color: var(--muted); }
.kpi .value { font-size: 1.6rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .kpi .value { color: var(--text); }
.kpi .foot { font-size: .8125rem; color: var(--muted); }
.kpi.accent { border-left: 4px solid var(--blue); }

/* --------------------------------------------------------------- rozet/pill */

.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
  background: var(--idle-bg); color: var(--idle); border: 1px solid transparent;
}
.pill::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.pill[data-status="running"], .pill[data-status="online"], .pill[data-status="active"],
.pill[data-status="succeeded"], .pill[data-status="issued"], .pill[data-status="ok"] { background: var(--ok-bg); color: var(--ok); }
.pill[data-status="provisioning"], .pill[data-status="dispatched"], .pill[data-status="queued"],
.pill[data-status="pending"], .pill[data-status="pending_dns"], .pill[data-status="requesting"],
.pill[data-status="renewing"], .pill[data-status="draining"], .pill[data-status="maintenance"] { background: var(--warn-bg); color: var(--warn); }
.pill[data-status="error"], .pill[data-status="failed"], .pill[data-status="offline"],
.pill[data-status="expired"], .pill[data-status="revoked"], .pill[data-status="incompatible"],
.pill[data-status="timed_out"] { background: var(--bad-bg); color: var(--bad); }
.pill[data-status="suspended"], .pill[data-status="collections"], .pill[data-status="deleting"],
.pill[data-status="erasing"], .pill[data-status="paused"], .pill[data-status="crashloop"] { background: var(--busy-bg); color: var(--busy); }
.pill[data-status="stopped"], .pill[data-status="draft"], .pill[data-status="cancelled"],
.pill[data-status="deleted"], .pill[data-status="erased"], .pill[data-status="none"] { background: var(--idle-bg); color: var(--idle); }
.pill[data-status="running"]::before { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pill[data-status="running"]::before { animation: none; } }

/* ------------------------------------------------------------------ tablo */

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9375rem; }
table.data th, table.data td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data thead th {
  background: var(--surface-2); color: var(--muted); font-size: .75rem;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  position: sticky; top: 0;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data caption { caption-side: bottom; padding: .6rem .75rem; color: var(--muted); font-size: .8125rem; text-align: left; }

dl.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1.25rem; margin: 0; }
dl.detail > div { border-bottom: 1px dashed var(--line); padding-bottom: .5rem; }
dl.detail dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
dl.detail dd { margin: .15rem 0 0; font-weight: 550; overflow-wrap: anywhere; }

/* Log ve dosya içeriği. Build adımı olmadığı için sözdizimi vurgulaması yok;
   `white-space: pre` + kaydırma şart: log satırları uzun ve yatay taşma
   mobilde içeriği ezerek 390 px ölçümünü bozuyordu. */
pre {
  margin: 0; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--text); overflow: auto; max-height: 26rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8125rem; line-height: 1.45; white-space: pre; overflow-wrap: normal;
}

/* ------------------------------------------------------------------ çubuk */

.bar { height: .5rem; border-radius: 999px; background: var(--idle-bg); overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--blue); }
.bar[data-level="high"] > i { background: var(--bad); }
.bar[data-level="mid"] > i { background: var(--warn); }
.bar-num { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ buton */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .5rem .8rem; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn[disabled], .btn.is-off { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-sm { padding: .3rem .55rem; font-size: .8125rem; }

/* ------------------------------------------------------------------ form */

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; }
.field > label { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: .75rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="url"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: .5rem .6rem; width: 100%;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.check { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .6rem; }
.check input { margin-top: .2rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 160px; }

.err { color: var(--bad); font-size: .8125rem; font-weight: 600; }
.err-list { margin: 0; padding: 0; list-style: none; display: grid; gap: .25rem; }

/* ------------------------------------------------------------------ uyarı */

.flash { display: grid; gap: .5rem; }
.alert {
  border-radius: var(--radius); padding: .7rem .9rem; border: 1px solid var(--line-strong);
  background: var(--surface-2); display: flex; gap: .6rem; align-items: flex-start; font-size: .9375rem;
}
.alert.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.alert.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.alert.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.alert.info { background: var(--blue-soft); border-color: transparent; color: var(--navy); }
[data-theme="dark"] .alert.info { color: var(--text); }

.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.empty svg { opacity: .55; margin-bottom: .5rem; }

/* ------------------------------------------------------------ onay kutusu */

dialog.confirm {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
  box-shadow: 0 24px 60px rgba(11, 23, 48, .25); background: var(--surface); color: var(--text); max-width: 30rem; width: 92vw;
}
dialog.confirm::backdrop { background: rgba(11, 23, 48, .45); }
dialog.confirm > .body { padding: 1rem; }
dialog.confirm > footer { padding: .85rem 1rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

/* --------------------------------------------------------------- sayfalama */

nav.pager { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; padding: .75rem 0 0; }
nav.pager a, nav.pager span {
  padding: .35rem .6rem; border-radius: 7px; border: 1px solid var(--line);
  font-size: .875rem; background: var(--surface); color: var(--text);
}
nav.pager [aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
nav.pager .is-disabled { opacity: .45; }

/* ------------------------------------------------------------------ giriş */

.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 1.25rem;
  background: radial-gradient(1000px 500px at 15% -10%, var(--blue-soft), transparent), var(--bg);
}
.auth .box { width: 100%; max-width: 26rem; }
.auth .box .card { overflow: hidden; }
.auth .head { background: var(--navy); color: #fff; padding: 1.1rem 1.25rem; }
.auth .head h1 { color: #fff; margin: 0; font-size: 1.15rem; }
.auth .head p { margin: .25rem 0 0; color: #c3d0ee; font-size: .875rem; }

/* ------------------------------------------------------------------ mobil */

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); z-index: 40;
    transform: translateX(-102%); transition: transform .18s ease; height: 100dvh;
  }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; }
  .nav-toggle:checked ~ .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(11, 23, 48, .45); z-index: 30; }
  .nav-open-btn {
    display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
    padding: .4rem .6rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  }
  .content { padding: .85rem; }
  .card > header { padding: .75rem .85rem; }
  .card > .body { padding: .85rem; }
  /* Ana eylem tam genişlik: tek parmakla erişilebilir olmalı (390 px ölçümü). */
  .actions-primary { flex-direction: column; align-items: stretch; }
  .actions-primary .btn { width: 100%; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 390px) {
  body { font-size: 14.5px; }
  h1 { font-size: 1.3rem; }
  dl.detail { grid-template-columns: minmax(0, 1fr); }
  .filters .field { min-width: 100%; }
}

@media print {
  .sidebar, .topbar, nav.pager, form.filters { display: none; }
  body { background: #fff; }
}
