/* Yönetim paneli - masaüstü programla aynı koyu tema */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #16181d;
  color: #e6e6e6;
  font-size: 14px;
}

.screen { display: none; }
.screen.active { display: block; }

/* ---------- Giriş ---------- */
#loginScreen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: #1e2129;
  border: 1px solid #2c313c;
  border-radius: 10px;
  padding: 32px;
  width: 340px;
}
.login-box h1 { margin: 0; font-size: 22px; }
.login-box .sub { margin: 4px 0 24px; color: #888; font-size: 13px; }

/* ---------- Üst çubuk ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #1e2129;
  border-bottom: 1px solid #2c313c;
}
.topbar h1 { margin: 0; font-size: 18px; }
.badge {
  font-size: 11px;
  background: #333;
  padding: 3px 8px;
  border-radius: 10px;
  color: #aaa;
  vertical-align: middle;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Sekmeler ---------- */
.tab-btn {
  background: transparent;
  border: 1px solid #2c313c;
  color: #aaa;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.tab-btn.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.tab-panel { display: none; padding: 24px; }
.tab-panel.active { display: block; }

/* ---------- Panel ---------- */
.panel {
  background: #1e2129;
  border: 1px solid #2c313c;
  border-radius: 8px;
  padding: 20px;
  max-width: 1250px;
  margin: 0 auto;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.panel h2 { margin: 0; font-size: 17px; }
.head-actions { display: flex; gap: 8px; }

/* ---------- Tablo ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  color: #888;
  font-weight: 500;
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid #2c313c;
}
td { padding: 10px; border-bottom: 1px solid #23262f; vertical-align: middle; }
tr.row-inactive td { opacity: 0.5; }
.strong { font-weight: 600; }
.muted { color: #888; }
.mono { font-family: ui-monospace, monospace; font-size: 11px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Durum rozetleri ---------- */
.status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}
.st-ok      { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.st-warn    { background: rgba(234, 179, 8, 0.15); color: #facc15; }
.st-expired { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.st-none    { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* ---------- Form öğeleri ---------- */
label { display: block; margin: 12px 0 0; font-size: 13px; color: #aaa; }
label.checkbox { display: flex; align-items: center; gap: 7px; color: #ddd; }
input[type="text"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"] {
  width: 100%;
  margin-top: 5px;
  background: #12141a;
  border: 1px solid #333;
  color: #eee;
  padding: 8px 10px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
}
input[type="search"] { width: 220px; margin-top: 0; }
input[type="checkbox"] { width: auto; margin: 0; }
input:disabled { color: #565c68; background: #0d0f14; cursor: not-allowed; }
.hint { display: block; margin-top: 4px; color: #777; font-size: 11px; line-height: 1.4; }

/* ---------- Butonlar ---------- */
button {
  border: none;
  border-radius: 5px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
button.primary { background: #3b82f6; color: #fff; }
button.primary:hover { background: #2563eb; }
button.ghost { background: #2c313c; color: #ddd; border: 1px solid #3a3f4b; }
button.ghost:hover { background: #353b47; }
button.danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
button.danger:hover { background: rgba(239, 68, 68, 0.25); }
button.sm { padding: 5px 10px; font-size: 12px; }
button.link {
  background: transparent;
  border: 1px solid #3a3f4b;
  color: #7dd3fc;
  padding: 4px 12px;
  font-size: 12px;
}
button.link.dev-full { color: #facc15; border-color: rgba(234, 179, 8, 0.4); }
.login-box button.primary { width: 100%; margin-top: 20px; padding: 10px; }

.quick-dates { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.quick-dates button {
  background: #2c313c;
  color: #bbb;
  border: 1px solid #3a3f4b;
  padding: 5px 11px;
  font-size: 12px;
}
.quick-dates button:hover { background: #353b47; color: #fff; }

.error { color: #f87171; font-size: 12px; margin: 10px 0 0; min-height: 16px; }

/* ---------- Açılır pencere ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-box {
  background: #1e2129;
  border: 1px solid #2c313c;
  border-radius: 10px;
  padding: 26px;
  width: 460px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
#deviceModal .modal-box { width: 720px; }
.modal-box h2 { margin: 0 0 8px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
#deviceModal .modal-actions { justify-content: space-between; }

.info-box {
  background: #12141a;
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 14px 18px;
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.info-box ol { margin: 8px 0; padding-left: 20px; color: #bbb; }
.info-box li { margin: 4px 0; }

/* ---------- Canlı durum göstergesi ----------
   Program açıkken periyodik doğrulama yapar; son doğrulama 2,5 dakikadan
   yeniyse "açık" sayılır. Yeşil nokta yumuşakça yanıp söner (canlılık hissi),
   kırmızı sabit durur. */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}
.dot-on {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse 1.8s infinite;
}
.dot-off { background: #ef4444; opacity: 0.55; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Hareket azaltma tercihi olan kullanıcıda yanıp sönme kapanır */
@media (prefers-reduced-motion: reduce) {
  .dot-on { animation: none; }
}

/* Finans sekmesindeki bekleyen ödeme sayacı */
.count-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.pay-pending  { background: rgba(234, 179, 8, 0.15);  color: #facc15; }
.pay-approved { background: rgba(34, 197, 94, 0.15);  color: #4ade80; }
.pay-rejected { background: rgba(239, 68, 68, 0.15);  color: #f87171; }

/* Ödeme talimatı alanı - çok satırlı, cüzdan adresleri okunaklı olsun diye
   eşaralıklı yazı tipi. */
textarea {
  width: 100%;
  margin-top: 5px;
  background: #12141a;
  border: 1px solid #333;
  color: #eee;
  padding: 9px 11px;
  border-radius: 5px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}
#settingsMsg.ok { color: #4ade80; }
#settingsMsg.bad { color: #f87171; }

/* ---------- Destek talepleri ---------- */

/* Durum filtreleri - sekme gorunumlu, yanlarinda sayac */
.ticket-filter {
  background: transparent;
  border: 1px solid #2c313c;
  color: #aaa;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
}
.ticket-filter:hover { border-color: #3a3f4b; color: #ddd; }
.ticket-filter.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.tf-count {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
}

/* Durum rozetleri - renkler "ne yapmam lazim"i anlatiyor:
   kirmizi/sari = sira sizde, mavi = musteride, yesil = bitti. */
.tk-new           { background: rgba(239, 68, 68, 0.15);  color: #f87171; }
.tk-waiting_admin { background: rgba(234, 179, 8, 0.15);  color: #facc15; }
.tk-in_progress   { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.tk-resolved      { background: rgba(34, 197, 94, 0.15);  color: #4ade80; }

.tk-preview {
  color: #888;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

#ticketModal .modal-box { width: 720px; }

/* Yazisma akisi - musteri solda, yonetici sagda (mesajlasma alisikligi) */
.ticket-thread {
  max-height: 380px;
  overflow-y: auto;
  background: #12141a;
  border: 1px solid #2c313c;
  border-radius: 6px;
  padding: 14px;
  margin: 14px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tk-msg { max-width: 78%; }
.tk-msg.from-user  { align-self: flex-start; }
.tk-msg.from-admin { align-self: flex-end; }
.tk-bubble {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;   /* musteri satir atladiysa korunsun */
  word-break: break-word;
}
.from-user  .tk-bubble { background: #2c313c; color: #e6e6e6; border-bottom-left-radius: 3px; }
.from-admin .tk-bubble { background: #1d4ed8; color: #fff; border-bottom-right-radius: 3px; }
.tk-when { font-size: 10px; color: #777; margin-top: 3px; }
.from-admin .tk-when { text-align: right; }

#tmMsg.ok  { color: #4ade80; }
#tmMsg.bad { color: #f87171; }

/* hidden ozelligi HER ZAMAN kazansin.
   Sebep: .hint gibi siniflar `display: block` tanimlayinca, tarayicinin
   [hidden] icin uyguladigi `display: none` eziliyor ve gizlenmesi gereken
   ogeler ekranda kaliyordu ("Bu durumda talep yok." yazisi dolu listenin
   altinda gorunuyordu). */
[hidden] { display: none !important; }
