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

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e3e8f0;
  --text: #1c2333;
  --muted: #7a8499;
  --primary: #4f8cff;
  --primary-dark: #3a70d6;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 40, 80, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
}

h1, h2, h3, h4 { font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== BUTONLAR ===== */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
}
.btn:hover { border-color: #c6cede; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.mini-btn {
  padding: 3px 8px;
  margin: 0 2px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: var(--text);
}
.mini-btn:hover { background: #f2f5fb; }
.mini-btn.danger { color: var(--red); border-color: #f8d0d0; }

/* ===== FORM ===== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.12); }
textarea.input { resize: vertical; font-family: monospace; font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== UYARILAR ===== */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ===== LOGIN ===== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 400px;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--muted); margin-bottom: 20px; font-size: 14px; }

/* ===== TOPBAR + TABS ===== */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 13px; color: var(--muted); }

.tabs { background: #fff; border-bottom: 1px solid var(--border); }
.tabs-inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
.tab {
  padding: 13px 16px; border: none; background: none; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== LAYOUT ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== KARTLAR ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.cards.small { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card h3 { margin-bottom: 14px; font-size: 16px; }
.card.narrow { max-width: 620px; }
.stat { text-align: center; padding: 22px 16px; }
.stat-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.chart-wrap { position: relative; height: 260px; }

/* ===== TABLO ===== */
.table-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.table-toolbar .input { max-width: 320px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.table tr:hover td { background: #fafbfe; }
.url-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 30px !important; }
.short { font-weight: 600; margin-right: 6px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.off { background: #f1f5f9; color: #64748b; }
.badge.warn { background: #fef3c7; color: #b45309; }

/* ===== MODAL ===== */
.modal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 100; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal-box.center { text-align: center; max-width: 360px; }
.modal-close { position: absolute; top: 10px; right: 14px; border: none; background: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-box h3 { margin-bottom: 16px; }
.modal-box h4 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }

.mini-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.mini-row { display: flex; justify-content: space-between; padding: 7px 12px; background: #f8fafc; border-radius: 8px; font-size: 14px; }
.qr-box { display: flex; justify-content: center; margin: 16px 0; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #111827; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px;
  opacity: 0; transition: all .3s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }

/* ===== YÖNLENDİRME SAYFASI ===== */
.redirect-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.redirect-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 440px; text-align: center;
}
.redirect-icon { width: 56px; height: 56px; border-radius: 50%; background: #fee2e2; color: #b91c1c; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; margin: 0 auto 14px; }
.error-card h1 { font-size: 20px; margin-bottom: 8px; }

.progress { height: 8px; background: #eef2f7; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.step-info { font-size: 13px; color: var(--muted); margin-bottom: 18px; }

.ad-slot { min-height: 90px; border: 1px dashed #cbd5e1; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; overflow: hidden; }
.ad-placeholder { color: #94a3b8; font-size: 13px; }

.countdown { font-size: 52px; font-weight: 700; color: var(--primary); line-height: 1; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.create-result { margin-top: 16px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
  .cards.small { grid-template-columns: 1fr; }
}
