/* AuroraSky Dashboard — Shared Styles
   Ana siteden bağımsız ama aynı tasarım diline sahip. */

/* ======================== TOKENS ======================== */
:root {
  --c-primary: #0b3a6b;
  --c-primary-dark: #072b50;
  --c-accent: #35c98e;
  --c-accent-dark: #16714f;
  --c-accent-hover: #2eb87f;
  --c-bg: #f5f7fa;
  --c-surface: #ffffff;
  --c-border: #e2e8f0;
  --c-text: #1a202c;
  --c-text-soft: #718096;
  --c-danger: #e53e3e;
  --c-warning: #ed8936;
  --c-success: #38a169;
  --c-info: #3182ce;
  --font: 'Figtree', system-ui, -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --sidebar-w: 260px;
}

/* ======================== RESET ======================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ======================== BUTTONS ======================== */
/* [hidden] her seyi yener.
 *
 * Tarayicinin varsayilan [hidden] kurali "display: none" verir ama ozgullugu
 * en dusuktur; .btn gibi display tanimlayan HER sinif onu ezer. Bu yuzden
 * hidden="true" verilen bir buton yine de gorunur kalir.
 * Asagidaki kural bunu kesin olarak kapatir. */
[hidden] {
  display: none !important;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); font-family: var(--font);
  font-size: 14px; font-weight: 600; border: none; cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .05s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn--accent {
  background: var(--c-accent); color: #fff;
}
.btn--accent:hover { background: var(--c-accent-hover); }
.btn--outline {
  background: transparent; border: 1.5px solid var(--c-border); color: var(--c-text);
}
.btn--outline:hover { border-color: var(--c-text-soft); }
.btn--danger { background: var(--c-danger); color: #fff; }
.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn--full { width: 100%; }
.btn--icon { padding: 8px; min-width: 36px; }

/* ======================== FORM ======================== */
.form-group { margin-bottom: var(--sp-4); }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--c-text); margin-bottom: var(--sp-1);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--c-border);
  border-radius: var(--radius); font-family: var(--font); font-size: 14px;
  color: var(--c-text); background: var(--c-surface);
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(53,201,142,.15);
}
.form-group input::placeholder { color: var(--c-text-soft); }
.form-group .error-msg {
  font-size: 12px; color: var(--c-danger); margin-top: var(--sp-1); display: none;
}
.form-group.has-error input { border-color: var(--c-danger); }
.form-group.has-error .error-msg { display: block; }

/* Hukuki belge kabul kutusu.
   Kutu ile metin yan yana; metin uzun olduğu için label bloğu
   varsayılan (display:block, kalın) stilini ezmeliyiz. */
.form-group--consent { margin-bottom: var(--sp-4); }
.consent-label {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; font-weight: 400; line-height: 1.5;
  color: var(--c-text); cursor: pointer; margin-bottom: 0;
}
.consent-label input[type="checkbox"] {
  width: 16px; height: 16px; flex: 0 0 16px;
  margin-top: 2px; padding: 0; cursor: pointer;
  accent-color: var(--c-accent);
}
.consent-label a { color: var(--c-accent); text-decoration: underline; }

/* ======================== AUTH PAGE ======================== */
.auth-page { background: var(--c-primary); min-height: 100vh; }
.auth-container {
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.auth-left {
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--sp-8);
  color: #fff;
}
.auth-logo img { width: 200px; margin-bottom: var(--sp-7); }
.auth-left h1 {
  font-size: clamp(28px, 3vw, 40px); font-weight: 800;
  line-height: 1.2; margin-bottom: var(--sp-4);
}
.auth-tagline { font-size: 16px; color: rgba(255,255,255,.7); max-width: 420px; }

.auth-right {
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--sp-8);
  background: var(--c-surface);
  border-radius: 24px 0 0 24px;
}
.auth-form { max-width: 400px; width: 100%; margin: 0 auto; }
.auth-form h2 { font-size: 24px; font-weight: 700; margin-bottom: var(--sp-6); }
.auth-form--hidden { display: none; }
.auth-switch {
  text-align: center; font-size: 14px; color: var(--c-text-soft);
  margin-top: var(--sp-4);
}
.auth-switch a { color: var(--c-accent-dark); font-weight: 600; }
.auth-footer {
  text-align: center; font-size: 12px; color: var(--c-text-soft);
  margin-top: var(--sp-5); max-width: 400px; margin-inline: auto;
}

@media (max-width: 768px) {
  .auth-container { grid-template-columns: 1fr; }
  .auth-left { padding: var(--sp-6) var(--sp-5); text-align: center; align-items: center; }
  .auth-left h1 { font-size: 24px; }
  .auth-logo img { width: 160px; }
  .auth-right { border-radius: 20px 20px 0 0; padding: var(--sp-6) var(--sp-5); }
}

/* ======================== DASHBOARD LAYOUT ======================== */
.dash-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--c-primary);
  color: #fff;
  padding: var(--sp-5);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar__logo img { width: 180px; margin-bottom: var(--sp-6); }
.sidebar__nav { list-style: none; flex: 1; }
.sidebar__nav li { margin-bottom: var(--sp-1); }
.sidebar__nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius);
  color: rgba(255,255,255,.7); font-size: 14px; font-weight: 500;
  transition: background .2s, color .2s;
  text-decoration: none;
}
.sidebar__nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__nav a.is-active {
  background: rgba(255,255,255,.12); color: #fff; font-weight: 600;
}
.sidebar__nav svg {
  width: 18px; height: 18px; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.sidebar__user {
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: var(--sp-4); margin-top: var(--sp-4);
  display: flex; align-items: center; gap: 10px;
  /* Uzun isim/e-posta kutuyu delmesin. */
  min-width: 0;
}
.sidebar__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  /* KRITIK: flex ogesi varsayilan olarak KUCULUR. Bu olmadan uzun bir
     isim ("Özkan Özenç Taşımacılık") avatari 36px'ten 13px'e ezer ve
     yuvarlak, ince bir dilime doner. */
  flex: 0 0 36px;
}
/* min-width:0 olmadan flex ogesi icerigi kadar genisler ve
   text-overflow:ellipsis hic devreye girmez. */
.sidebar__user-info { font-size: 13px; line-height: 1.3; min-width: 0; flex: 1 1 auto; }
.sidebar__user-name,
.sidebar__user-email {
  /* Tasan metin uc nokta ile kesilir, satira bolunup kutuyu buyutmez. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-name { font-weight: 600; }
.sidebar__user-email { color: rgba(255,255,255,.55); font-size: 12px; }

/* ---------- MAIN CONTENT ---------- */
.dash-main {
  padding: var(--sp-6);
  max-width: 1200px;
}
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.dash-header h1 { font-size: 24px; font-weight: 700; }
.dash-header__actions { display: flex; gap: var(--sp-3); }

/* ---------- STAT CARDS ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.stat-card {
  background: var(--c-surface); border-radius: var(--radius-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
}
.stat-card__label {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--c-text-soft); margin-bottom: var(--sp-2);
}
.stat-card__value {
  font-size: 28px; font-weight: 800; color: var(--c-text);
}
.stat-card__change {
  font-size: 12px; font-weight: 600; margin-top: var(--sp-1);
}
.stat-card__change--up { color: var(--c-success); }
.stat-card__change--down { color: var(--c-danger); }

/* ---------- TABLE ---------- */
.data-table-wrap {
  background: var(--c-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--c-border);
  overflow: hidden;
  /* Grid ogesi varsayilan min-width:auto ile icerigi kadar genisler.
     Bu olmadan genis tablo TUM SAYFAYI yana kaydiriyor. */
  min-width: 0;
}
.data-table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}
.data-table-header h2 { font-size: 16px; font-weight: 700; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table th {
  text-align: left; padding: 12px var(--sp-5);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--c-text-soft);
  border-bottom: 1px solid var(--c-border); background: var(--c-bg);
}
.data-table td {
  padding: 12px var(--sp-5); border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: #f9fafb; }

/* ---------- BADGES ---------- */
/* Tablo içi metin butonu — indirme gibi ikincil eylemler için.
   Bağlantı gibi görünür ama gerçek bir <button> (erişilebilirlik). */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--c-accent-dark);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover:not(:disabled) { color: var(--c-accent-hover); }
.btn-link:disabled { opacity: .55; cursor: default; text-decoration: none; }
.btn-link:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em;
}
.badge--success { background: #e6f7ef; color: #1a7f47; }
.badge--warning { background: #fef3e2; color: #b45309; }
.badge--danger { background: #fee2e2; color: #b91c1c; }
.badge--info { background: #e8f0fe; color: #1e40af; }
.badge--neutral { background: #f1f5f9; color: #475569; }

/* ---------- KYC UPLOAD ---------- */
.upload-zone {
  display: flex; flex-direction: column; align-items: center;
  border: 2px dashed var(--c-border); border-radius: var(--radius-lg);
  padding: var(--sp-7) var(--sp-5); text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.upload-zone:hover { border-color: var(--c-accent); background: rgba(53,201,142,.04); }
.upload-zone svg {
  width: 40px; height: 40px; color: var(--c-text-soft); margin-bottom: var(--sp-3);
  display: block;
}
.upload-zone p { font-size: 14px; color: var(--c-text-soft); margin: 0; line-height: 1.5; }
.upload-zone strong { color: var(--c-accent-dark); }

/* ---------- CARD PANEL ---------- */
.panel {
  background: var(--c-surface); border-radius: var(--radius-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border); margin-bottom: var(--sp-5);
}
/* Uyarı paneli — itiraz oranı yüksekse gösterilir.
   Normal panelden ayrışmalı ki satıcı fark etsin. */
.panel--warning {
  border-color: #f5c26b;
  background: #fffaf0;
}
.panel--warning .panel__title { color: #92400e; }

.panel__title {
  font-size: 16px; font-weight: 700; margin-bottom: var(--sp-4);
}

/* ---------- TOAST ---------- */
.toast-container {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5);
  z-index: 9999; display: flex; flex-direction: column-reverse; gap: var(--sp-3);
}
.toast {
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: #fff;
  box-shadow: var(--shadow-lg); animation: toastIn .3s ease;
  max-width: 360px;
}
.toast--success { background: var(--c-success); }
.toast--error { background: var(--c-danger); }
.toast--info { background: var(--c-info); }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center; padding: var(--sp-8) var(--sp-5);
  color: var(--c-text-soft);
}
.empty-state svg { width: 56px; height: 56px; margin-bottom: var(--sp-4); }
.empty-state h3 { font-size: 16px; color: var(--c-text); margin-bottom: var(--sp-2); }
.empty-state p { font-size: 14px; max-width: 360px; margin-inline: auto; }

/* ---------- MOBILE ---------- */
.sidebar__toggle {
  display: none; position: fixed; bottom: var(--sp-4); left: var(--sp-4);
  z-index: 100; width: 48px; height: 48px; border-radius: 50%;
  background: var(--c-primary); color: #fff; border: none; cursor: pointer;
  box-shadow: var(--shadow-lg);
  align-items: center; justify-content: center;
}
.sidebar__toggle svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }

@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -280px; top: 0; z-index: 99;
    width: 280px; transition: left .3s;
  }
  .sidebar.is-open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .sidebar__toggle { display: flex; }
  .dash-main { padding: var(--sp-4); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 10px var(--sp-3); }

  /* ---- YATAY KAYMA ONARIMI ----
     SORUN: Siparisler/Odemeler sayfalari telefonda TUM SAYFA olarak
     yana kayiyordu (+101px). Sebep: 6 kolonlu tablo 390px'e sigmiyor,
     grid ogeleri de varsayilan min-width:auto ile icerik kadar genisliyor.

     COZUM: Ana icerigi viewport'a kilitle, tasan tabloyu KENDI icinde
     kaydir. Boylece sayfa sabit durur, yalnizca tablo parmakla kayar. */
  .dash-main {
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .data-table-wrap {
    /* Tablonun kendi yatay kaydirmasi — sayfayi degil kendini kaydirir. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    /* Kolonlar ezilip okunmaz hale gelmesin; kaydirilabilir olsun. */
    min-width: 520px;
  }
  .data-table-header {
    /* Baslik satiri tablonun genisligine degil ekrana uysun. */
    flex-wrap: wrap;
    gap: var(--sp-2);
  }
  .stat-grid, .stat-card { min-width: 0; }
  .stat-card__label, .stat-card__value, .stat-card__change {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ─── API anahtarı yönetimi ─────────────────────────────────── */

.panel__hint {
  font-size: 13px;
  color: var(--c-text-soft);
  line-height: 1.6;
  margin-bottom: var(--sp-4);
}

/* Tabloda veri yokken / yüklenirken gösterilen satır */
.table-empty {
  text-align: center;
  color: var(--c-text-soft);
  padding: var(--sp-6) var(--sp-4) !important;
  font-size: 14px;
}

/* Yeni anahtar oluşturma satırı */
.key-create {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.key-create input[type="text"] {
  flex: 1 1 240px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
}
.key-create input[type="text"]:focus {
  outline: none;
  border-color: var(--c-accent);
}
.key-create select {
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  background: var(--c-surface);
}

/* Anahtarın tek seferlik gösterildiği kutu — dikkat çekmesi gerekiyor */
.key-reveal {
  border: 1px solid var(--c-accent);
  background: rgba(53, 201, 142, .06);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.key-reveal__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--c-accent-dark);
  margin-bottom: var(--sp-2);
}
.key-reveal__value {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
  user-select: all;
  margin-bottom: var(--sp-2);
}
.key-reveal__warning {
  font-size: 12px;
  color: var(--c-warning);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}
.key-reveal__actions {
  display: flex;
  gap: var(--sp-2);
}

/* Anahtar tablosundaki kısaltılmış değer */
#apiKeysBody code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--c-text-soft);
}

.auth-note {
  display: block;
  font-size: 11px;
  color: var(--c-text-soft);
  margin-top: var(--sp-1);
}
