@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --primary: #0057FF;
  --primary-light: #4A9EFF;
  --bg: #0B0E14;
  --surface: #151A24;
  --surface-2: #1F2733;
  --text: #F3F4F6;
  --muted: #9CA3AF;
  --border: rgba(255,255,255,0.08);
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior: none; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
html { touch-action: manipulation; }
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.hidden { display: none !important; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.muted { color: var(--muted); }
.flex-1 { flex: 1; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ───── Login ───── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px); }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 24px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-card h1 { font-size: 26px; margin-bottom: 4px; text-align: center; }
.login-card h1 span { color: var(--primary-light); font-weight: 500; }
.login-card .muted { text-align: center; margin-bottom: 24px; }

/* ───── Form ───── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.input {
  width: 100%; padding: 13px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 15px;
}
.input:focus { outline: none; border-color: var(--primary); }
textarea.input { resize: vertical; }
select.input { cursor: pointer; }

.btn {
  padding: 12px 18px; border-radius: 10px; border: none;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: filter 0.15s, transform 0.08s;
  user-select: none;
}
.btn:active { transform: scale(0.97); filter: brightness(0.9); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; width: 100%; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: var(--error); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

.err { color: var(--error); margin-top: 12px; font-size: 13px; min-height: 20px; text-align: center; }

/* ───── Layout ───── */
#appView { display: flex; flex-direction: column; min-height: 100vh; }

/* Top app bar — mobilde görünür, desktop'ta gizli */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--safe-top) + 12px) 20px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar .brand { font-size: 17px; font-weight: 700; }
.topbar .brand span { color: var(--primary-light); font-weight: 500; }
.topbar .admin-name { font-size: 12px; color: var(--muted); }
.topbar .logout-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
}

/* Sidebar — DESKTOP ONLY */
.sidebar { display: none; }
.brand span { color: var(--primary-light); }

/* Bottom nav — MOBILE ONLY */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 4px calc(var(--safe-bottom) + 8px);
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-size: 10px; text-align: center;
  position: relative;
  transition: color 0.15s;
}
.bottom-nav a .icon { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--primary-light); }
.bottom-nav a .badge {
  position: absolute; top: 2px; right: calc(50% - 18px);
  background: var(--error); color: white;
  min-width: 16px; height: 16px; border-radius: 8px;
  font-size: 10px; font-weight: 700; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.6 } }

.main {
  flex: 1; padding: 16px 16px calc(var(--safe-bottom) + 84px);
  max-width: 100%; overflow-x: hidden;
}
.view { display: none; animation: fadeIn 0.25s; }
.view.active { display: block; }
.view h2 { font-size: 22px; margin-bottom: 16px; font-weight: 700; }
.view h2 span { font-weight: 400; font-size: 14px; margin-left: 8px; color: var(--muted); }

/* ───── Pending alert ───── */
.pending-alert {
  background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(245,158,11,0.08));
  border: 2px solid var(--error); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 20px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  animation: pulseBorder 3s ease-in-out infinite;
}
@keyframes pulseBorder { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4) } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0) } }
.pending-alert > span:first-child { font-size: 28px; }
.pending-alert > span:last-child { font-size: 20px; color: var(--muted); margin-left: auto; }
.pending-alert .pending-title { font-size: 15px; font-weight: 600; }
.pending-alert .pending-title b { color: var(--error); font-size: 18px; }
.pending-alert .pending-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ───── Stats grid ───── */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.stat-card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 500; }
.stat-card .value { font-size: 22px; font-weight: 700; margin-top: 6px; }
.stat-card .value.primary { color: var(--primary-light); }
.stat-card .value.success { color: var(--success); }

/* ───── Filter bar ───── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar .input { flex: 1; min-width: 140px; }

/* ───── Bulk bar ───── */
.bulk-bar {
  background: var(--primary); color: white; padding: 10px 12px;
  border-radius: 10px; margin-bottom: 14px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 13px;
}
.bulk-bar .btn { background: white; color: var(--primary); padding: 8px 12px; font-size: 13px; }
.bulk-bar .btn-ghost { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); }

/* ───── Table (mobile: card list) ───── */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; min-width: 600px; }
.desktop-only { display: none; }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card-list .row-card { background: var(--surface); border: 1px solid var(--border); }
.table th, .table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--surface-2); font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}

/* Mobilde tabloyu kart listesi olarak göster */
.table-mobile { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.row-card {
  background: var(--surface-2); border-radius: 10px; padding: 12px;
}
.row-card .row-main { display: flex; justify-content: space-between; gap: 8px; }
.row-card .row-title { font-weight: 600; font-size: 15px; }
.row-card .row-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row-card .row-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.row-card .row-meta b { color: var(--text); font-weight: 600; }
.row-card .row-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.row-card .row-actions .btn { padding: 6px 10px; font-size: 12px; border-radius: 6px; }

.chip {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
}
.chip-success { background: rgba(34,197,94,0.15); color: var(--success); }
.chip-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.chip-error { background: rgba(239,68,68,0.15); color: var(--error); }
.chip-muted { background: rgba(156,163,175,0.15); color: var(--muted); }
.chip-primary { background: rgba(0,87,255,0.15); color: var(--primary-light); }

.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}

/* ───── Transfer cards ───── */
.transfer-list { display: flex; flex-direction: column; gap: 12px; }
.transfer-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.transfer-card.pending { border-left: 4px solid var(--warning); }
.transfer-card.approved { border-left: 4px solid var(--success); }
.transfer-card.rejected { border-left: 4px solid var(--error); }
.transfer-user { font-size: 16px; font-weight: 600; }
.transfer-info { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; margin-top: 6px; }
.transfer-info b { color: var(--text); }
.transfer-ref {
  font-family: monospace; background: var(--surface-2);
  padding: 4px 8px; border-radius: 6px; display: inline-block;
  font-size: 11px; margin-top: 8px;
}
.transfer-amount { font-size: 22px; font-weight: 700; color: var(--primary-light); margin-top: 8px; }
.transfer-note {
  background: var(--surface-2); border-radius: 8px; padding: 10px;
  margin-top: 10px; font-size: 13px; color: var(--muted);
}
.transfer-actions { display: flex; flex-direction: row; gap: 8px; margin-top: 12px; }
.transfer-actions .btn { flex: 1; justify-content: center; }

/* ───── Modal ───── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px 20px 0 0; width: 100%; max-width: 520px;
  max-height: 92vh; display: flex; flex-direction: column;
  animation: slideUp 0.25s ease;
  padding-bottom: var(--safe-bottom);
}
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; }

.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; cursor: pointer; line-height: 1.5; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); flex-shrink: 0; margin-top: 1px; }

/* ───── Toast ───── */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 50%; transform: translateX(-50%);
  z-index: 1000;
  background: var(--surface); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  max-width: 92%; text-align: center;
  animation: toastSlide 0.25s ease;
}
@keyframes toastSlide { from { opacity: 0; transform: translate(-50%, -10px) } to { opacity: 1; transform: translate(-50%, 0) } }
.toast.success { border-color: var(--success); color: var(--success); background: rgba(34,197,94,0.08); }
.toast.error { border-color: var(--error); color: var(--error); background: rgba(239,68,68,0.08); }

/* ───── Config / Bank ───── */
.config-list { display: flex; flex-direction: column; gap: 8px; }
.config-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.config-item .meta .key { font-weight: 600; font-size: 14px; }
.config-item .meta .desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.config-item .input { width: 100%; }

.bank-card {
  background: linear-gradient(135deg, rgba(0,87,255,0.08), rgba(74,158,255,0.04));
  border: 1px solid rgba(0,87,255,0.3); border-radius: 16px;
  padding: 18px; margin-bottom: 20px;
}
.bank-card h3 { margin-bottom: 4px; font-size: 17px; }

/* ───── User detail ───── */
.user-detail { display: flex; flex-direction: column; gap: 16px; }
.user-detail .sidebar-info {
  background: var(--surface-2); border-radius: 12px; padding: 16px;
}
.user-detail .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.user-detail .section h3 { margin-bottom: 8px; font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
.user-detail .section { margin-bottom: 20px; }

/* ───── DESKTOP ≥ 768px: sidebar layout ───── */
@media (min-width: 768px) {
  #appView { flex-direction: row; }
  .topbar { display: none; }
  .bottom-nav { display: none; }
  .sidebar {
    display: flex; flex-direction: column;
    width: 240px; background: var(--surface); border-right: 1px solid var(--border);
    padding: 24px 16px; min-height: 100vh; position: sticky; top: 0;
  }
  .sidebar .brand { font-size: 20px; font-weight: 700; margin-bottom: 24px; padding: 0 8px; }
  .sidebar ul { list-style: none; flex: 1; }
  .sidebar li {
    padding: 12px 14px; border-radius: 10px; cursor: pointer;
    margin-bottom: 4px; color: var(--muted); transition: background 0.15s;
    display: flex; align-items: center; gap: 10px;
  }
  .sidebar li:hover { background: var(--surface-2); color: var(--text); }
  .sidebar li.active { background: var(--primary); color: white; }
  .side-badge {
    background: var(--error); color: white; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 700; margin-left: auto;
    animation: pulse 2s ease-in-out infinite;
  }
  .sidebar-foot { padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
  .sidebar-foot a { color: var(--primary-light); text-decoration: none; margin-left: auto; }

  .main { padding: 32px; padding-bottom: 32px; }
  .view h2 { font-size: 26px; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .stat-card { padding: 20px; } .stat-card .value { font-size: 28px; }

  .table { min-width: 0; }
  .table th, .table td { padding: 12px 14px; white-space: nowrap; }
  .desktop-only { display: block; }
  /* Desktop tablo varsa (sibling .desktop-only) mobil kart listesi gizlenir */
  .desktop-only + .card-list, .card-list:has(+ .desktop-only) { display: none; }
  /* Ama yanında desktop tablo yoksa (ör: reklamlar) kartlar gösterilir */

  .user-detail { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }

  .modal-bg { align-items: center; padding: 20px; }
  .modal { border-radius: 16px; max-width: 600px; }

  .toast { top: 20px; right: 20px; left: auto; transform: none; max-width: 360px; }
  @keyframes toastSlide { from { opacity: 0; transform: translateX(20px) } to { opacity: 1; transform: translateX(0) } }
}

/* Versiyon Etiketi */
.version-badge {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  font-family: monospace;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 5;
}
