/* =============================================================
   Kafanet Admin — tasarım dili uygulamayla birebir uyumlu
   bg: #FDFBF6, ink: #1A1614, accent: #D4491C
   ============================================================= */

:root {
  --bg: #FDFBF6;
  --bg-alt: #F5F1E8;
  --ink: #1A1614;
  --ink-soft: #524742;
  --accent: #D4491C;
  --accent-soft: #F4E3D6;
  --gold: #B8924D;
  --green: #5A7A3A;
  --red: #C94545;
  --border: #E8DFD0;
  --card: #FFFFFF;
  --shadow-sm: 0 2px 6px rgba(26, 22, 20, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 22, 20, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-xxl: 20px;
  --sidebar-w: 260px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--ink);
  letter-spacing: -0.3px;
}

h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; font-family: 'DM Sans', sans-serif; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: #fff;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
}
.sidebar-logo-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
}
.sidebar-logo-text {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.8px;
}
.sidebar-logo-badge {
  font-size: 9px;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.sidebar-section {
  padding: 10px 20px 4px;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a.active {
  background: rgba(212, 73, 28, 0.15);
  border-left-color: var(--accent);
  color: #fff;
}
.sidebar-nav .icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 20px;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

/* ── Main ─────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; }
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-soft);
}
.topbar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 16px;
}
.topbar-user-name { color: var(--ink); font-weight: 500; }

.container {
  padding: 28px 32px 60px;
  max-width: 1400px;
  width: 100%;
}

/* ── Flash messages ───────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.flash-success { background: #e6f2dc; color: var(--green); border: 1px solid #cfe3bd; }
.flash-error   { background: #f9dbdb; color: var(--red);   border: 1px solid #f0bfbf; }
.flash-info    { background: var(--accent-soft); color: var(--accent); border: 1px solid #ebc7a8; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-dark {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 20px;
}
.card-dark h2, .card-dark h3 { color: #fff; }
.card-title {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}
.card-caption {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 700;
}

/* ── Grid ─────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Stats ────────────────────────────────────────────────── */
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
}
.stat-label {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 700;
}
.stat-value {
  font-family: 'Fraunces', serif;
  font-size: 32px; font-weight: 600;
  letter-spacing: -1px;
  margin-top: 6px;
}
.stat-hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s, opacity 0.15s;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-dark    { background: var(--ink); color: #fff; }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-soft    { background: var(--bg-alt); color: var(--ink); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-ghost   { background: transparent; color: var(--ink-soft); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.form-label .req { color: var(--red); }
.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--ink);
}
textarea.form-control { resize: vertical; min-height: 100px; font-family: 'DM Sans', sans-serif; }
.form-control-code {
  font-family: ui-monospace, SF Mono, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}
.form-help { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-alt);
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-alt); }
.table-empty { padding: 40px; text-align: center; color: var(--ink-soft); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-ags { background: rgba(212,73,28,0.13); color: var(--accent); }
.badge-kpss { background: rgba(184,146,77,0.18); color: var(--gold); }
.badge-both { background: rgba(90,122,58,0.15); color: var(--green); }
.badge-kolay { background: rgba(90,122,58,0.15); color: var(--green); }
.badge-orta { background: rgba(184,146,77,0.18); color: var(--gold); }
.badge-zor { background: rgba(201,69,69,0.15); color: var(--red); }
.badge-karma { background: var(--bg-alt); color: var(--ink-soft); }
.badge-free { background: rgba(90,122,58,0.15); color: var(--green); }
.badge-premium { background: var(--gold); color: #fff; }
.badge-pending { background: var(--bg-alt); color: var(--ink-soft); }
.badge-success { background: rgba(90,122,58,0.15); color: var(--green); }
.badge-failed { background: rgba(201,69,69,0.15); color: var(--red); }

/* ── Section header ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-header-text h1 { margin: 0; }
.page-header-text p { color: var(--ink-soft); margin-top: 4px; font-size: 13px; }
.page-header-actions { display: flex; gap: 8px; }

/* ── Login ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xxl);
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 32px;
}
.login-logo-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); }
.login-logo-text {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -1.5px;
  color: var(--ink);
}
.login-subtitle { text-align: center; color: var(--ink-soft); margin-bottom: 28px; }

/* ── AI page ────────────────────────────────────────────── */
.ai-panel {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-xxl);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.ai-panel::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: var(--accent); opacity: 0.15;
}
.ai-panel h2, .ai-panel h3 { color: #fff; }
.ai-panel .form-label { color: rgba(255,255,255,0.7); }
.ai-panel .form-control {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #fff;
}
.ai-panel .form-control:focus { border-color: var(--accent); }
.ai-panel .form-help { color: rgba(255,255,255,0.55); }

.ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Misc ──────────────────────────────────────────────── */
.muted { color: var(--ink-soft); }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.code-block {
  background: var(--ink);
  color: #f0e9df;
  border-radius: var(--radius-lg);
  padding: 16px;
  font-family: ui-monospace, SF Mono, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Question/card preview ─────────────────────────────── */
.q-preview {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.q-preview-text { font-weight: 500; margin-bottom: 12px; }
.q-option {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  margin-bottom: 6px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.q-option-correct { background: rgba(90,122,58,0.12); border: 1px solid var(--green); }
.q-option-letter {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 50%; font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
.q-option-correct .q-option-letter { background: var(--green); color: #fff; border-color: var(--green); }

.fc-preview {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.fc-preview-front { font-weight: 600; }
.fc-preview-back { color: var(--accent); font-weight: 500; margin-top: 4px; }
.fc-preview-hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-soft);
}
.empty-state-emoji { font-size: 44px; margin-bottom: 12px; }
.empty-state-title { font-family: 'Fraunces', serif; font-size: 18px; color: var(--ink); margin-bottom: 6px; }

/* ── Responsive sidebar (mobile) ─────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 100; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .container { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
}
