/* MCPanel — karanlık tema. Renkler rol adıyla tanımlı; değiştirmek için sadece :root'u düzenleyin. */
:root {
  color-scheme: dark;
  --bg: #0d0d0d;             /* sayfa zemini */
  --surface: #1a1a19;        /* kartlar */
  --surface-2: #232321;      /* kart içi kutular, girişler */
  --surface-3: #2e2e2b;      /* hover / seçili */
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f1;
  --text-2: #c3c2b7;
  --muted: #898781;
  --accent: #3987e5;
  --accent-text: #86b6ef;
  --btn-primary: #256abf;
  --btn-primary-hover: #2a78d6;
  --btn-danger: #b3302f;
  --btn-danger-hover: #d03b3b;
  --track: #2c2c2a;
  /* durum renkleri: her zaman yazılı etiketle birlikte kullanılır, asla tek başına */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --console-bg: #111110;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent-text); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 22px; line-height: 1.2; margin: 0; }
.sub { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------------ üst bar */
.dev-banner {
  padding: 6px 16px; text-align: center; font-size: 13px;
  background: #3a2c05; color: #fde6a8; border-bottom: 1px solid rgba(250, 178, 25, 0.35);
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 20px;
  background: rgba(13, 13, 13, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--surface-3); color: var(--text); }
.user { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.select {
  height: 32px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 6px 8px; }
  .user { margin-left: auto; }
  .username { display: none; }
  .nav { order: 3; flex-basis: 100%; }
}

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }
@media (max-width: 640px) { .container { padding: 16px 16px 40px; } }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title {
  margin: 28px 0 10px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.section-title:first-of-type { margin-top: 8px; }

/* ------------------------------------------------------------------ düğmeler */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn-danger { background: var(--btn-danger); border-color: var(--btn-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--btn-danger-hover); border-color: var(--btn-danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 42px; }
.btn .icon { flex: none; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn.icon-only { width: 30px; padding: 0; }
.btn.danger-text:not(:disabled) { color: #f39090; }

/* ------------------------------------------------------------ durum rozeti */
.badge {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 3px 10px 3px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
}
.badge .dot, .tone-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.badge.tone-good { background: rgba(12, 163, 12, 0.12); border-color: rgba(12, 163, 12, 0.45); }
.badge.tone-warning { background: rgba(250, 178, 25, 0.10); border-color: rgba(250, 178, 25, 0.45); }
.badge.tone-serious { background: rgba(236, 131, 90, 0.10); border-color: rgba(236, 131, 90, 0.45); }
.badge.tone-critical { background: rgba(208, 59, 59, 0.14); border-color: rgba(208, 59, 59, 0.55); }
.tone-good .dot, .tone-dot.good { background: var(--good); }
.tone-warning .dot, .tone-dot.warning { background: var(--warning); }
.tone-serious .dot, .tone-dot.serious { background: var(--serious); }
.tone-critical .dot, .tone-dot.critical { background: var(--critical); }
.badge.pulse .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .badge.pulse .dot { animation: none; } }

/* ------------------------------------------------------------ kart / kutu */
.grid { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
/* Halka gösterge: kullanım (mavi, %80 turuncu, %90 kırmızı) ya da sağlık (yeşil/turuncu/kırmızı) */
.gauge { position: relative; flex: none; width: 48px; height: 48px; }
.gauge .ring { display: block; width: 48px; height: 48px; }
.gauge .track, .gauge .arc { fill: none; stroke-width: 5; }
.gauge .track { stroke: var(--track); }
.gauge .arc { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.5s ease, stroke 0.3s; }
.gauge.tone-none .arc { opacity: 0; }
.gauge.tone-good .arc { stroke: var(--good); }
.gauge.tone-warning .arc { stroke: var(--warning); }
.gauge.tone-critical .arc { stroke: var(--critical); }
.gauge .gi { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); }
@media (prefers-reduced-motion: reduce) { .gauge .arc { transition: none; } }

.gtile { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gt-body { min-width: 0; flex: 1; }
.gt-label { font-size: 12.5px; color: var(--muted); }
.gt-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; font-size: 19px; font-weight: 650; line-height: 1.3; }
.gt-value .v { white-space: nowrap; }
.gt-value small { font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.gt-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.host-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.host-strip .gtile { padding: 14px 16px; }
@media (max-width: 1000px) { .host-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .host-strip { gap: 10px; }
  .host-strip .gtile { padding: 12px; gap: 10px; }
  .gauge, .gauge .ring { width: 42px; height: 42px; }
  .gt-value { font-size: 17px; }
}

/* Sunucu bilgileri kutusu */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 20px; }
.info-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.info-icon {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2);
}
.info-body { min-width: 0; flex: 1; }
.info-label { font-size: 12.5px; color: var(--muted); }
.info-value { font-weight: 600; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ sunucu kartı */
.servers { grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr)); }
.server-card { display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title { margin: 0; font-size: 18px; }
.notice {
  margin: 0; padding: 8px 12px; border-radius: 8px; font-size: 13.5px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.notice.error { background: rgba(208, 59, 59, 0.10); border-color: rgba(208, 59, 59, 0.5); color: #f3b4b4; }
.notice.busy { background: rgba(250, 178, 25, 0.08); border-color: rgba(250, 178, 25, 0.4); color: #fde6a8; }
.notice.ok { background: rgba(12, 163, 12, 0.08); border-color: rgba(12, 163, 12, 0.4); color: #b8e6b8; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 600px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metric { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.metric .gauge .track { stroke: #34342f; }

.players h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px;
}
.chip .avatar {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: #1c3a5e; color: #cde2fb; font-size: 11px; font-weight: 700;
}
.chip .ping { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.card-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border);
}
.controls, .links { display: flex; flex-wrap: wrap; gap: 8px; }
.links { gap: 4px; }

/* ------------------------------------------------------------------ konsol */
.console-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.console-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.spacer { flex: 1; }
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.ok::before { background: var(--good); }
.conn.wait::before { background: var(--warning); }
.conn.err::before { background: var(--critical); }
.switch { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { width: 16px; height: 16px; accent-color: var(--accent); }

.console-out {
  height: calc(100dvh - 320px); min-height: 320px; overflow: auto; overscroll-behavior: contain;
  padding: 10px 14px; background: var(--console-bg); color: #d7d6cf;
  font: 13px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  /* telefonda üst menü ve düğmeler iki satıra iner; komut satırı ekranda kalsın */
  .console-out { height: calc(100dvh - 400px); min-height: 260px; font-size: 12px; }
}
.line { min-height: 1.55em; }
.line .ts { color: var(--muted); }
.line.warn { color: #f5c55f; }
.line.error { color: #f39090; background: rgba(208, 59, 59, 0.08); }
.line.note { color: var(--muted); font-style: italic; }
.line.note.error { color: #f39090; font-style: normal; }
.line.sep { margin: 6px 0; padding-top: 6px; border-top: 1px dashed var(--border-strong); color: var(--text-2); font-style: normal; }
.line.echo { margin-top: 4px; color: #8fc1ff; }
.line.rcon { padding-left: 10px; border-left: 2px solid var(--btn-primary); color: #e8e7e1; }
.mc-b { font-weight: 700; }
.mc-i { font-style: italic; }
.mc-u { text-decoration: underline; }
.mc-s { text-decoration: line-through; }
.mc-u.mc-s { text-decoration: underline line-through; }

.console-form {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface);
}
.prompt { font-family: var(--mono); color: var(--accent); }
.console-input {
  flex: 1; min-width: 0; height: 38px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--console-bg);
  font-family: var(--mono); font-size: 14px;
}

/* --------------------------------------------------------------- eklentiler */
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.search {
  flex: 1; min-width: 180px; height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.seg button {
  padding: 5px 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.seg .count { margin-left: 4px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border);
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .name { font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; }
.table .file { font-family: var(--mono); font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.table tr.row-bad td { background: rgba(208, 59, 59, 0.06); }
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: flex; gap: 12px; padding: 3px 14px; border: 0; }
  .table td::before {
    content: attr(data-label); min-width: 72px; padding-top: 2px;
    color: var(--muted); font-family: var(--font); font-size: 12px;
  }
}

.table td.actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
@media (max-width: 700px) {
  .table td.actions { width: 100%; }
  .table td.actions::before { display: none; }
  .row-actions { justify-content: flex-start; }
}

.empty { padding: 36px 16px; text-align: center; color: var(--text-2); }
.empty .btn { margin-top: 12px; }

/* sekmeler */
.tabs { display: flex; gap: 4px; margin: 14px 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; margin-bottom: -1px; white-space: nowrap;
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* dosya gezgini */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumb-sep { color: var(--muted); }
.file-list { padding: 6px; display: flex; flex-direction: column; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; min-width: 0;
}
a.file-row:hover { background: var(--surface-2); }
.file-row .icon { color: var(--text-2); flex: none; }
.file-row.disabled { color: var(--muted); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13.5px; }
.file-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .file-meta { display: none; } }

/* düzenleyici */
.editor-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.editor-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.editor-card > .notice { margin: 10px 12px 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.editor {
  width: 100%; min-height: 60vh; resize: vertical; margin: 0; padding: 12px 14px; border: 0; outline: none;
  background: var(--console-bg); color: #e8e7e1; font: 13.5px/20px var(--mono); tab-size: 2; white-space: pre;
}
.editor[readonly] { color: var(--text-2); }
.editor:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ------------------------------------------------------ bildirim / onay */
.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px));
}
.toast {
  padding: 10px 14px; border-radius: 8px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 4px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); transition: opacity 0.3s, transform 0.3s;
}
.toast-success { border-left-color: var(--good); }
.toast-error { border-left-color: var(--critical); }
.toast.hide { opacity: 0; transform: translateY(8px); }

.dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog form { padding: 20px; }
.dialog h2 { margin: 0 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 20px; color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ------------------------------------------------------------------ giriş */
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { display: flex; flex-direction: column; gap: 14px; width: min(380px, 100%); padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.field input {
  height: 42px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-size: 15px;
}
.form-error {
  margin: 0; padding: 8px 12px; border-radius: 8px; font-size: 13.5px;
  background: rgba(208, 59, 59, 0.12); border: 1px solid rgba(208, 59, 59, 0.45); color: #f3b4b4;
}
