/* ============================================================
   TASARIM TOKENLARI
   ============================================================ */
:root {
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --surface-2: #FAFBFD;
  --border: #E6E8F0;
  --border-strong: #D5D9E6;

  --ink: #131A2C;
  --text: #2B3350;
  --text-dim: #6B7188;
  --text-faint: #9BA1B5;

  --primary: #4338CA;
  --primary-dark: #362DA3;
  --primary-soft: #EEEDFC;
  --primary-softer: #F6F5FE;

  --accent: #EA5B3B;
  --accent-soft: #FDEBE6;

  --success: #128A5F;
  --success-soft: #E5F6EE;
  --danger: #D33A4B;
  --danger-soft: #FCEAEC;
  --warning: #B4700A;
  --warning-soft: #FDF1DE;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(19, 26, 44, 0.05);
  --shadow-md: 0 6px 20px rgba(19, 26, 44, 0.07);
  --shadow-lg: 0 16px 40px rgba(19, 26, 44, 0.12);

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .brand strong { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.01em; }

code {
  background: var(--primary-softer);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Basit ikon konteynerları — tüm SVG'ler currentColor kullanır */
.icon, .icon-inline { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.icon svg, .icon-inline svg { width: 100%; height: 100%; }
.icon-inline { width: 16px; height: 16px; margin-right: 7px; }
.stat-icon-wrap { display: inline-flex; width: 20px; height: 20px; }
.stat-icon-wrap svg { width: 100%; height: 100%; }

/* ============================================================
   UYGULAMA İSKELETİ
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sol menü (masaüstü) ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 20px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.28);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { font-size: 15.5px; color: var(--ink); font-weight: 700; }
.brand-text span { font-size: 11.5px; color: var(--text-dim); }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 13.8px;
  color: var(--text-dim);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar .nav-item:hover { background: var(--surface-2); color: var(--ink); }
.sidebar .nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.sidebar .nav-item .icon { color: inherit; opacity: 0.85; }

.sidebar-footer { padding: 16px 18px 22px; }

.live-pill {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 20px;
}
.live-pill.show { display: inline-flex; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.35); }
}

/* ---------- Ana alan ---------- */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 26px 36px 20px;
}
.topbar-title h1 { font-size: 24px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.topbar-title p { font-size: 13.5px; color: var(--text-dim); margin: 0; }

.stat-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 132px;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.stat-icon-wrap { color: var(--primary); }
.stat-value {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.25;
}
.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.content { padding: 28px 36px 60px; }

.app-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  padding: 18px 0 28px;
}

/* ============================================================
   SEKME PANELLERİ / KARTLAR
   ============================================================ */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.grid-2 {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.panel:hover { box-shadow: var(--shadow-md); }

.panel h2 { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 6px;
}

.sub { font-size: 13px; color: var(--text-dim); margin: 4px 0 14px; line-height: 1.55; }
.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; line-height: 1.5; }

.panel-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

/* ============================================================
   FORM ELEMANLARI
   ============================================================ */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 16px 0 6px; }

input[type="text"], input[type="email"], input[type="number"], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.code-area { min-height: 200px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }

.divider { border-top: 1px solid var(--border); margin: 24px 0; }

/* Dosya yükleme "drop" alanı */
.file-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.file-drop:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-softer); }
.file-drop .icon-inline { margin-right: 0; }

/* Segmented control (Düz Metin / HTML) */
.segmented {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-top: 14px;
  gap: 3px;
}
.segment { flex: 1; position: relative; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
  display: block;
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.segment input:checked + span { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow-sm); }

/* Toggle switch (TikTok zenginleştirme) */
.switch-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; }
.switch { position: relative; width: 40px; height: 23px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 20px;
  transition: background 0.2s ease;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 2.5px; left: 2.5px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}
.switch input:checked ~ .switch-track { background: var(--primary); }
.switch input:checked ~ .switch-track::after { transform: translateX(17px); }
.switch-label { font-size: 13.5px; color: var(--text); font-weight: 500; }

/* Radio satırları (hedef kitle) */
.target-block { margin-top: 20px; }
.radio-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 400; color: var(--text);
  padding: 8px 2px; cursor: pointer; margin: 0;
}
.radio-row input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* Gelişmiş ayarlar */
.advanced {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px 16px;
  background: var(--surface-2);
}
.advanced summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.advanced[open] summary::after { transform: rotate(-135deg); }
.advanced label:first-of-type { margin-top: 14px; }

/* ============================================================
   BUTONLAR
   ============================================================ */
button { font-family: 'Inter', sans-serif; cursor: pointer; border: none; }

.btn-primary {
  width: 100%;
  margin-top: 20px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 14.5px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(67, 56, 202, 0.18);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 5px 16px rgba(67, 56, 202, 0.28); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #C7CAD9; box-shadow: none; cursor: not-allowed; transform: none; }

.btn-send { background: var(--accent); box-shadow: 0 2px 8px rgba(234, 91, 59, 0.28); }
.btn-send:hover { background: #D14A2E; box-shadow: 0 5px 16px rgba(234, 91, 59, 0.35); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-danger { color: var(--danger); border-color: #F3C3C8; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-icon-sm {
  width: 34px; height: 34px; padding: 0;
  justify-content: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 9px;
}
.btn-icon-sm svg, .btn-icon-sm .icon { width: 16px; height: 16px; }
.job-controls { display: flex; gap: 8px; }

/* ============================================================
   LİSTELER (aboneler, hesaplar, şablonlar, geçmiş)
   ============================================================ */
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 480px;
  overflow-y: auto;
}
.item-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.item-list li:last-child { border-bottom: none; }
.item-list li.clickable { cursor: pointer; border-radius: var(--radius-sm); transition: background 0.15s ease; }
.item-list li.clickable:hover { background: var(--surface-2); }

.item-list .info { flex: 1; min-width: 0; }
.item-list .name { font-weight: 600; font-size: 14px; color: var(--ink); }
.item-list .email { font-size: 12.5px; color: var(--text-dim); word-break: break-all; margin-top: 1px; }
.item-list .meta {
  font-size: 11.5px; color: var(--text-dim);
  display: flex; align-items: center; gap: 5px;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.item-list .meta .icon { width: 13px; height: 13px; color: var(--primary); }

.icon-btn {
  background: none; border: none;
  color: var(--text-faint);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 40px 10px;
  color: var(--text-faint);
  font-size: 13px;
}

.count-badge {
  font-family: 'JetBrains Mono', monospace;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* Aktif/Pasif toggle (hesaplar listesi) */
.acc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 5px 10px;
  border-radius: 20px;
  cursor: pointer;
  border: 1.5px solid transparent;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.acc-toggle.on { background: var(--success-soft); color: var(--success); }
.acc-toggle.off { background: var(--surface-2); color: var(--text-faint); border-color: var(--border); }
.acc-toggle .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================
   CANLI LOG KONSOLU
   ============================================================ */
.log-console {
  background: linear-gradient(180deg, #131A2E 0%, #0D1220 100%);
  border: 1px solid #232B45;
  color: #C9D1E8;
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 12.8px;
  max-height: 480px;
  overflow-y: auto;
  margin-top: 14px;
}
.log-console::-webkit-scrollbar { width: 8px; }
.log-console::-webkit-scrollbar-thumb { background: #2A3350; border-radius: 8px; }
.log-console::-webkit-scrollbar-track { background: transparent; }

.log-placeholder { color: #626E90; font-style: italic; padding: 14px 10px; }

.log-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  animation: log-row-in 0.2s ease;
}
.log-row + .log-row { margin-top: 1px; }
.log-row:hover { background: rgba(255, 255, 255, 0.035); }
@keyframes log-row-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

.log-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.log-icon svg { width: 12px; height: 12px; }
.log-icon.dot::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.log-body { flex: 1; min-width: 0; }
.log-ts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #626E90;
  display: block;
  margin-bottom: 1px;
}
.log-msg { font-family: 'Inter', sans-serif; line-height: 1.5; word-break: break-word; }

.log-row.type-success .log-icon { background: rgba(74, 222, 128, 0.15); color: #4ADE80; }
.log-row.type-success .log-msg { color: #C7EED4; }
.log-row.type-error .log-icon { background: rgba(248, 113, 113, 0.15); color: #F87171; }
.log-row.type-error .log-msg { color: #F9C6C6; }
.log-row.type-info .log-icon { background: rgba(136, 145, 173, 0.15); color: #8891AD; }
.log-row.type-info .log-msg { color: #AEB6D0; }
.log-row.type-account_switch .log-icon { background: rgba(251, 191, 36, 0.15); color: #FBBF24; }
.log-row.type-account_switch .log-msg { color: #FCE7B0; }
.log-row.type-warning .log-icon { background: rgba(251, 146, 60, 0.15); color: #FB923C; }
.log-row.type-warning .log-msg { color: #FCD2AC; }
.log-row.type-done { background: rgba(74, 222, 128, 0.06); }
.log-row.type-done .log-icon { background: rgba(74, 222, 128, 0.2); color: #4ADE80; }
.log-row.type-done .log-msg { color: #C7EED4; font-weight: 600; }

.summary-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-top: 14px;
  font-size: 13px;
}
.summary-box .row { display: flex; justify-content: space-between; padding: 4px 0; }
.summary-box .row strong { font-family: 'JetBrains Mono', monospace; }

/* ============================================================
   MOBİL ALT GEZİNME
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(19,26,44,0.08);
}
.bottom-nav .nav-item {
  flex: 1;
  flex-direction: column;
  gap: 3px;
  padding: 9px 4px 10px;
  border-radius: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
}
.bottom-nav .nav-item.active { color: var(--primary); }
.bottom-nav .icon { width: 21px; height: 21px; margin: 0 auto; }
.nav-label { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .main-area { padding-bottom: 68px; }
  .topbar { padding: 20px 18px 16px; }
  .content { padding: 20px 18px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-row { gap: 10px; }
  .stat-card { min-width: 112px; padding: 10px 12px; }
  .panel { padding: 20px; border-radius: var(--radius-md); }
}

@media (max-width: 480px) {
  .topbar-title h1 { font-size: 20px; }
  .stat-card { min-width: 96px; }
  .stat-value { font-size: 16px; }
}
