/* AlSat yönetim paneli — Bootstrap 5.3 üzerine sade bir tema. Açık/koyu mod değişkenlerle yönetilir. */

:root {
  --app-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --app-bg: #f4f6fa;
  --app-surface: #ffffff;
  --app-surface-2: #f8fafc;
  --app-border: #e5e9f0;
  --app-muted: #667085;
  --app-sidebar-bg: #0f172a;
  --app-sidebar-text: #9aa7bd;
  --app-sidebar-hover: rgba(255, 255, 255, .06);
  --app-sidebar-active-bg: rgba(99, 102, 241, .22);
  --app-radius: 14px;
  --app-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --sidebar-width: 244px;
  --topbar-height: 60px;

  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #4338ca;
  --bs-link-hover-color-rgb: 67, 56, 202;
  --bs-body-font-family: var(--app-font);
  --bs-body-font-size: .925rem;
  --bs-border-color: var(--app-border);
}

[data-bs-theme="dark"] {
  --app-bg: #0b1120;
  --app-surface: #111a2e;
  --app-surface-2: #0f172a;
  --app-border: #1f2b46;
  --app-muted: #94a3b8;
  --app-sidebar-bg: #080d1a;
  --app-shadow: 0 1px 2px rgba(0, 0, 0, .3);

  --bs-body-bg: #0b1120;
  --bs-link-color: #a5b4fc;
  --bs-link-color-rgb: 165, 180, 252;
  --bs-link-hover-color: #c7d2fe;
  --bs-link-hover-color-rgb: 199, 210, 254;
}

html, body { height: 100%; }
body { background: var(--app-bg); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.num, .table td, .stat-value { font-variant-numeric: tabular-nums; }
.text-muted, .text-body-secondary { color: var(--app-muted) !important; }
.fw-600 { font-weight: 600; }
.small-caps { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--app-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .86em; }

/* ---------------------------------------------------------------- İkonlar */
.icon { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex-shrink: 0; }
.icon-sm { width: .95em; height: .95em; }
.icon-lg { width: 1.5em; height: 1.5em; }

/* --------------------------------------------------------------- Yerleşim */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1040; width: var(--sidebar-width); display: flex; flex-direction: column; background: var(--app-sidebar-bg); color: var(--app-sidebar-text); transition: transform .2s ease; }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; height: var(--topbar-height); padding: 0 1.15rem; color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; }
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #22c55e); color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .6rem .7rem; }
.sidebar-section { margin: .9rem .55rem .35rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #5f6f8a; font-weight: 700; }
.sidebar-link { display: flex; align-items: center; gap: .7rem; padding: .58rem .7rem; margin-bottom: 2px; border-radius: 10px; color: var(--app-sidebar-text); font-weight: 500; }
.sidebar-link:hover { background: var(--app-sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-link.active { background: var(--app-sidebar-active-bg); color: #fff; }
.sidebar-link .icon { width: 1.2em; height: 1.2em; opacity: .9; }
.sidebar-footer { padding: .85rem 1.15rem; font-size: .75rem; color: #5f6f8a; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .5); }

.main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; height: var(--topbar-height); padding: 0 1.5rem; background: color-mix(in srgb, var(--app-surface) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--app-border); }
.page-title { margin: 0; font-size: 1.12rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.content { flex: 1; padding: 1.5rem; max-width: 1500px; width: 100%; }
.live-strip { background: var(--bs-danger); color: #fff; text-align: center; font-size: .78rem; font-weight: 600; padding: .2rem .5rem; letter-spacing: .03em; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .main { margin-left: 0; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1rem; }
}

/* ----------------------------------------------------------- Durum hapları */
.status-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .32rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid var(--app-border); background: var(--app-surface); white-space: nowrap; }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #98a2b3; flex-shrink: 0; }
.dot-success { background: var(--bs-success); box-shadow: 0 0 0 3px rgba(var(--bs-success-rgb), .22); }
.dot-danger { background: var(--bs-danger); box-shadow: 0 0 0 3px rgba(var(--bs-danger-rgb), .22); }
.dot-warning { background: var(--bs-warning); box-shadow: 0 0 0 3px rgba(var(--bs-warning-rgb), .25); }
.dot-pulse { animation: dot-pulse 1.8s ease-in-out infinite; }
@keyframes dot-pulse { 50% { box-shadow: 0 0 0 6px rgba(var(--bs-success-rgb), 0); } }

/* ----------------------------------------------------------------- Kartlar */
.card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.card-header { display: flex; align-items: center; gap: .6rem; padding: .85rem 1.15rem; background: transparent; border-bottom: 1px solid var(--app-border); font-weight: 600; }
.card-header:first-child { border-radius: var(--app-radius) var(--app-radius) 0 0; }
.card-header .card-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.card-body { padding: 1.15rem; }
.card-footer { background: transparent; border-top: 1px solid var(--app-border); padding: .75rem 1.15rem; }

.stat { display: flex; gap: .9rem; align-items: flex-start; padding: 1.1rem 1.15rem; height: 100%; }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: rgba(var(--bs-primary-rgb), .1); color: var(--bs-primary); flex-shrink: 0; }
.stat-icon.tone-success { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.stat-icon.tone-danger { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.stat-icon.tone-warning { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.stat-icon.tone-info { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }
.stat > div:last-child { min-width: 0; }
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--app-muted); }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.stat-sub { font-size: .8rem; color: var(--app-muted); }
/* Telefonda yarım genişlikteki kartta ikon yerine değere yer açılır. */
@media (max-width: 575.98px) {
  .stat { gap: .6rem; padding: .9rem; }
  .stat-icon { display: none; }
  .stat-value { font-size: 1.2rem; }
}

/* --------------------------------------------------------------- Tablolar */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: rgba(var(--bs-primary-rgb), .04); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .62rem .9rem; border-bottom-color: var(--app-border); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--app-muted); background: var(--app-surface-2); white-space: nowrap; }
.table td { vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
/* Son satırın ardından yalnızca gizli (açılır) bir ayrıntı satırı geliyorsa alt çizgi çiftlenmesin. */
.table tbody tr:has(+ tr.collapse:last-child:not(.show)) td { border-bottom: 0; }
.card > .table-responsive:last-child, .card > .table-responsive:last-child .table { border-radius: 0 0 var(--app-radius) var(--app-radius); }
.cell-wrap { min-width: 220px; white-space: normal; overflow-wrap: anywhere; }
/* Kalan genişliği doldurur ve taşan metni "…" ile keser (tablo hücresi için width:100% + max-width:0 tekniği). */
.cell-truncate { width: 100%; max-width: 0; min-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .text-nowrap, .table th { white-space: nowrap; }
.empty { padding: 2.4rem 1rem; text-align: center; color: var(--app-muted); }
.empty .icon { width: 2rem; height: 2rem; opacity: .5; margin-bottom: .5rem; }

/* ---------------------------------------------------------------- Rozetler */
.badge-soft { font-weight: 600; font-size: .74rem; padding: .36em .62em; border-radius: 6px; letter-spacing: .01em; }
.badge-soft-success { color: var(--bs-success-text-emphasis); background: var(--bs-success-bg-subtle); }
.badge-soft-danger { color: var(--bs-danger-text-emphasis); background: var(--bs-danger-bg-subtle); }
.badge-soft-warning { color: var(--bs-warning-text-emphasis); background: var(--bs-warning-bg-subtle); }
.badge-soft-info { color: var(--bs-info-text-emphasis); background: var(--bs-info-bg-subtle); }
.badge-soft-primary { color: var(--bs-primary-text-emphasis); background: var(--bs-primary-bg-subtle); }
.badge-soft-secondary { color: var(--bs-secondary-text-emphasis); background: var(--bs-secondary-bg-subtle); }

/* ------------------------------------------------------- Butonlar / formlar */
.btn { border-radius: 10px; font-weight: 500; }
.btn-sm { border-radius: 8px; }
.btn-primary { --bs-btn-bg: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3; --bs-btn-disabled-bg: #4f46e5; --bs-btn-disabled-border-color: #4f46e5; }
.btn-outline-primary { --bs-btn-color: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4f46e5; --bs-btn-hover-border-color: #4f46e5; --bs-btn-active-bg: #4338ca; --bs-btn-active-border-color: #4338ca; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #a5b4fc; --bs-btn-border-color: #6366f1; }
.btn-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 1px solid var(--app-border); background: var(--app-surface); color: var(--bs-body-color); }
.btn-icon:hover { background: var(--app-surface-2); }
.btn .icon { margin-right: .15rem; }
.btn-icon .icon { margin: 0; }
.form-control, .form-select { border-radius: 10px; border-color: var(--app-border); }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .15); }
.form-label { font-weight: 600; font-size: .84rem; margin-bottom: .3rem; }
.form-text { color: var(--app-muted); }
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.filter-bar .form-select, .filter-bar .form-control { min-width: 140px; }
.inline-form { display: inline; }

.alert { border-radius: 12px; border-width: 1px; }
.alert .icon { margin-right: .35rem; }

/* ----------------------------------------------------------- Ayrıntı listesi */
/* .kv: ayrıntı sayfalarında etiket/değer listesi. .kv-compact: dar kartlarda (etiket solda, değer sağda). */
.kv { display: grid; grid-template-columns: minmax(120px, 32%) minmax(0, 1fr); gap: .5rem 1rem; margin: 0; }
.kv dt { color: var(--app-muted); font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-compact { grid-template-columns: minmax(0, 1fr) auto; gap: .45rem .75rem; }
.kv-compact dd { text-align: right; overflow-wrap: normal; }
@media (max-width: 575.98px) { .kv:not(.kv-compact) { grid-template-columns: 1fr; gap: .1rem; } .kv:not(.kv-compact) dd { margin-bottom: .55rem; } }
.code-block { background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: 10px; padding: .85rem 1rem; margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; white-space: pre-wrap; word-break: break-all; max-height: 420px; overflow: auto; }

/* ------------------------------------------------------------- Kontrol listesi */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: .65rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px dashed var(--app-border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .icon { margin-top: .15rem; }
.check-ok { color: var(--bs-success); }
.check-missing { color: var(--bs-warning); }

/* ------------------------------------------------------------------ Grafik */
.chart-box { width: 100%; height: 240px; }
.chart-box svg { width: 100%; height: 100%; display: block; }
.chart-line { fill: none; stroke: var(--bs-primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-area { fill: rgba(var(--bs-primary-rgb), .1); stroke: none; }
.chart-zero { stroke: var(--app-border); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.bar-track { height: 6px; border-radius: 999px; background: var(--app-surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--bs-success); }
.bar-fill.neg { background: var(--bs-danger); }

/* ---------------------------------------------------------------- Giriş ekranı */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .22), transparent 60%), radial-gradient(900px 500px at 100% 110%, rgba(34, 197, 94, .16), transparent 60%), var(--app-bg); }
.auth-card { width: 100%; max-width: 400px; padding: 2rem; }
.auth-brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; font-size: 1.25rem; margin-bottom: 1.25rem; }

/* ---------------------------------------------------------------- Sayfalama */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.page-link { border-radius: 8px !important; margin: 0 2px; border-color: var(--app-border); color: var(--bs-body-color); }
.page-item.active .page-link { background: #4f46e5; border-color: #4f46e5; }
