/* ===========================================================
   Komuta Merkezi - modern YouTube-stream temasi
   Masaustu + mobil uyumlu, dark komuta merkezi UI
   =========================================================== */

:root {
  /* zemin */
  --bg:        #0b0c0f;
  --bg-grad:   radial-gradient(1200px 600px at 80% -10%, rgba(255,59,72,.10), transparent 60%),
               radial-gradient(900px 500px at 0% 0%, rgba(56,189,248,.06), transparent 55%);
  --panel:     #15171c;
  --panel-2:   #1c1f26;
  --panel-3:   #232732;
  --border:    #282b34;
  --border-2:  #353a47;

  /* metin */
  --text:      #f1f3f6;
  --muted:     #9aa3b2;
  --faint:     #6b7280;

  /* marka / aksiyon - YouTube kirmizisi */
  --accent:    #ff3b44;
  --accent-2:  #e21f2c;
  --accent-sat:#ff5860;

  /* durum */
  --live:      #ff3b44;
  --info:      #38bdf8;
  --success:   #2ed47a;
  --pending:   #fbbf24;
  --danger:    #ff4d4f;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 12px 32px rgba(0,0,0,.45);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(255,59,68,.3); }

/* ince scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* =================== TOPBAR (header) =================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 64px;
  padding: 0 22px;
  background: rgba(15, 16, 20, .85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}
.brand-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255,59,68,.16), 0 0 14px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(255,59,68,.16), 0 0 14px var(--accent); }
  50%     { box-shadow: 0 0 0 7px rgba(255,59,68,.05), 0 0 20px var(--accent); }
}
.brand-name { font-weight: 800; letter-spacing: 1.6px; font-size: 15px; }
.brand-sub  { font-weight: 500; letter-spacing: 1.6px; color: var(--muted); font-size: 11px; }
.brand-logo {
  height: 44px;
  width: 44px;
  display: block;
  border-radius: 9px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  transition: background .16s ease, color .16s ease;
}
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.active { color: #fff; background: var(--panel-2); }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.nav-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-badge[data-empty="true"] { display: none; }

.user {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.user-name { font-weight: 700; font-size: 13px; }
.user-role { font-size: 11px; color: var(--muted); }
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-sat), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* =================== CONTENT =================== */
.content {
  max-width: 1260px;
  margin: 0 auto;
  padding: 28px 22px 72px;
}
.loading {
  color: var(--muted);
  padding: 60px;
  text-align: center;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.view-title { font-size: 22px; font-weight: 800; letter-spacing: -.2px; }
.view-desc  { color: var(--muted); margin-top: 4px; font-size: 13.5px; }

/* =================== STAT KARTLARI =================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 26px;
}
.stat {
  position: relative;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 19px 20px;
  overflow: hidden;
  transition: border-color .16s ease, transform .16s ease;
}
.stat:hover { border-color: var(--border-2); transform: translateY(-2px); }
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: .55;
}
.stat.s-info::before    { background: var(--info); }
.stat.s-live::before    { background: var(--live); }
.stat.s-pending::before { background: var(--pending); }
.stat.s-success::before { background: var(--success); }

.stat-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.stat-value { font-size: 32px; font-weight: 800; margin-top: 9px; letter-spacing: -.5px; }
.stat-foot  { color: var(--faint); font-size: 12px; margin-top: 5px; }
.stat-value.accent  { color: var(--accent-sat); }
.stat-value.info    { color: var(--info); }
.stat-value.live    { color: var(--live); }
.stat-value.pending { color: var(--pending); }
.stat-value.success { color: var(--success); }

/* =================== KART =================== */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* =================== TABLO =================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 520px; }
.table th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--faint);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover td { background: var(--panel-2); }

.cell-strong { font-weight: 700; }
.cell-sub { color: var(--muted); font-size: 12px; }
.cell-right { text-align: right; }
.cell-nowrap { white-space: nowrap; }

/* =================== DURUM ROZETI =================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.live    { color: var(--live);    background: rgba(255,59,68,.13); }
.badge.live::before { animation: pulse-dot 1.4s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1;} 50%{opacity:.35;} }
.badge.idle    { color: var(--muted);   background: rgba(154,163,178,.12); }
.badge.pending { color: var(--pending); background: rgba(251,191,36,.13); }

/* =================== BUTON =================== */
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .08s ease, opacity .15s ease;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-sat), var(--accent-2));
  border-color: var(--accent-2);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,59,68,.28);
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent-sat), var(--accent-2)); }
.btn-success { background: var(--success); border-color: var(--success); color: #052612; }
.btn-success:hover { background: var(--success); filter: brightness(1.08); }
.btn-danger  { background: transparent; border-color: rgba(255,77,79,.5); color: var(--danger); }
.btn-danger:hover { background: rgba(255,77,79,.13); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn + .btn { margin-left: 7px; }

/* =================== CHAT =================== */
.chat-card .chat-list {
  height: 540px;
  overflow-y: auto;
  padding: 6px 0;
}
.chat-row {
  display: flex;
  gap: 11px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}
.chat-row:last-child { border-bottom: none; }
.chat-row:hover { background: var(--panel-2); }
.chat-chan {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--info);
  background: rgba(56,189,248,.12);
  padding: 3px 9px;
  border-radius: 7px;
  height: fit-content;
  white-space: nowrap;
}
.chat-body { flex: 1; min-width: 0; }
.chat-user { font-weight: 700; }
.chat-ts { color: var(--faint); font-size: 11px; margin-left: 7px; }
.chat-text { margin-top: 2px; word-wrap: break-word; overflow-wrap: anywhere; }

/* =================== BANNER =================== */
.banner {
  display: flex;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: rgba(251,191,36,.07);
  border: 1px solid rgba(251,191,36,.22);
  color: #f3d9a5;
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.5;
}
.banner::before { content: '!'; font-weight: 800; color: var(--pending);
  width: 19px; height: 19px; flex-shrink: 0; border-radius: 50%;
  background: rgba(251,191,36,.18); display: flex; align-items: center; justify-content: center; font-size: 12px; }

/* =================== LIVEPUSH BAGLANTI KARTI =================== */
.lp-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  margin-bottom: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.lp-card.connected { border-color: rgba(46,212,122,.35); background: rgba(46,212,122,.05); }
.lp-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lp-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--pending);
  box-shadow: 0 0 10px rgba(251,191,36,.6);
}
.lp-dot.ok { background: var(--success); box-shadow: 0 0 10px rgba(46,212,122,.6); }
.lp-title { font-weight: 700; }
.lp-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* =================== TOAST =================== */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(22px);
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 13px 22px;
  border-radius: 11px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 100;
  max-width: 90vw;
  font-weight: 600;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok  { border-color: var(--success); }
.toast.err { border-color: var(--danger); }

.empty { padding: 52px 20px; text-align: center; color: var(--muted); }

/* =================== MOBIL =================== */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 11px 14px;
    gap: 10px;
  }
  .brand { order: 1; }
  .user  { order: 2; margin-left: auto; }
  .nav   {
    order: 3;
    flex-basis: 100%;
    padding-bottom: 2px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }
  .nav-link.active::after { bottom: -3px; }
  .content { padding: 20px 14px 56px; }
  .view-title { font-size: 19px; }
  .stat-value { font-size: 27px; }
}
@media (max-width: 440px) {
  .stat-grid { grid-template-columns: 1fr; }
  .user-meta { display: none; }
  .btn-sm { padding: 7px 9px; }
}

/* =================== LOGOUT =================== */
.logout-btn { flex-shrink: 0; }

/* =================== GIRIS EKRANI =================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.login-logo {
  width: 132px;
  height: 132px;
  display: block;
  border-radius: 14px;
}
.login-title { font-size: 21px; font-weight: 800; letter-spacing: -.3px; text-align: center; }
.login-desc  { color: var(--muted); font-size: 13.5px; margin: 4px 0 24px; text-align: center; }

.login-form { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.field input {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,59,68,.15);
}
.login-btn { width: 100%; padding: 12px; font-size: 14px; margin-top: 4px; }
.login-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  min-height: 18px;
}
