/* Reklam Analiz Paneli — koyu tema */

:root {
  --bg: 224 36% 8%;
  --card: 224 32% 12%;
  --card-hover: 224 30% 15%;
  --border: 220 20% 22%;
  --foreground: 0 0% 98%;
  --muted-foreground: 218 12% 62%;
  --primary: 210 100% 69%;       /* #60B5FF */
  --primary-foreground: 0 0% 100%;
  --accent: 224 26% 18%;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.25), 0 1px 2px -1px rgb(0 0 0 / 0.2);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  --duration-fast: 150ms;

  --emerald: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: hsl(var(--bg));
  color: hsl(var(--foreground));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: hsl(var(--border)); border-radius: 9999px; }

.font-mono { font-variant-numeric: tabular-nums; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.font-display { letter-spacing: -0.01em; }
.muted { color: hsl(var(--muted-foreground)); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-2xl { font-size: 22px; }
.text-lg { font-size: 17px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.04em; }

/* ---------- Layout / Sidebar ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: hsl(var(--card));
  border-right: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid hsl(var(--border));
  font-weight: 700;
  font-size: 15px;
}
.sidebar-brand .icon-box {
  width: 32px; height: 32px; border-radius: 8px;
  background: hsl(var(--primary) / 0.15);
  display: flex; align-items: center; justify-content: center;
  color: hsl(var(--primary));
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: background-color var(--duration-fast), color var(--duration-fast);
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.sidebar-nav a.active { background: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); }
.sidebar-nav svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-footer { padding: 12px; border-top: 1px solid hsl(var(--border)); }
.sidebar-user { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; margin-top: 8px; }
.sidebar-user .name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.sidebar-user .email { font-size: 10.5px; color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

.topbar-mobile {
  display: none;
  position: fixed; inset: 0 0 auto 0; z-index: 40; height: 56px;
  align-items: center; justify-content: space-between;
  padding: 0 16px; background: hsl(var(--card) / 0.9); backdrop-filter: blur(6px);
  border-bottom: 1px solid hsl(var(--border));
}

.main-content { flex: 1; margin-left: 260px; padding: 28px 32px; max-width: 1400px; }

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; top: 56px; bottom: 0; width: 260px; }
  .topbar-mobile { display: flex; }
  .main-content { margin-left: 0; padding: 76px 16px 32px; }
  .mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 25; }
}

/* ---------- Cards ---------- */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-header {
  padding: 16px; border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px; font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: background-color var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
  background: transparent;
  color: hsl(var(--foreground));
}
.btn svg { width: 15px; height: 15px; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-primary { background: hsl(var(--primary)); color: #071019; border-color: hsl(var(--primary)); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline { border-color: hsl(var(--border)); }
.btn-outline:hover { background: hsl(var(--accent)); }
.btn-outline.active, .btn.active { background: hsl(var(--primary)); color: #071019; border-color: hsl(var(--primary)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn.syncing svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
  width: 100%; background: hsl(var(--bg)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm); padding: 9px 12px; color: hsl(var(--foreground));
  font-size: 13.5px; outline: none;
}
input:focus, select:focus { border-color: hsl(var(--primary)); }
.form-group { margin-bottom: 16px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: hsl(var(--muted-foreground)); width: 15px; height: 15px; }
.input-icon-wrap input { padding-left: 34px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid hsl(var(--border));
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { text-align: left; font-size: 11.5px; color: hsl(var(--muted-foreground)); background: hsl(var(--accent) / 0.4); }
th, td { padding: 11px 14px; border-bottom: 1px solid hsl(var(--border) / .6); }
th { font-weight: 500; }
tbody tr:hover { background: hsl(var(--accent) / 0.45); }
.text-right { text-align: right; }
.row-clickable { cursor: pointer; }
.subrow { background: hsl(var(--accent) / 0.25); font-size: 12px; }

.roas-good { color: var(--emerald); font-weight: 700; }
.roas-mid { color: var(--amber); font-weight: 700; }
.roas-bad { color: var(--red); font-weight: 700; }

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

.kpi-card { padding: 18px; }
.kpi-card .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-card .icon-box { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.kpi-card .icon-box svg { width: 16px; height: 16px; }
.kpi-card .value { font-size: 22px; font-weight: 700; }
.kpi-card .sub { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 5px; }

.charts-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1023px) { .charts-grid-2 { grid-template-columns: 1fr; } }

.chart-card canvas { width: 100% !important; }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-header p { color: hsl(var(--muted-foreground)); font-size: 13px; margin-top: 4px; }

/* ---------- Date range ---------- */
.date-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.auth-logo .icon-box { width: 56px; height: 56px; border-radius: 16px; background: hsl(var(--primary) / .15); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: hsl(var(--primary)); }
.auth-card { padding: 26px; box-shadow: var(--shadow-md); }
.auth-foot { text-align: center; font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 14px; }

/* ---------- Alerts / status ---------- */
.status-msg { padding: 34px 16px; text-align: center; color: hsl(var(--muted-foreground)); font-size: 13px; }
.status-msg.error { color: var(--red); }
.alert { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-error { background: rgb(248 113 113 / .1); border-color: rgb(248 113 113 / .35); color: #fca5a5; }
.alert-success { background: rgb(52 211 153 / .1); border-color: rgb(52 211 153 / .35); color: #6ee7b7; }
.alert-info { background: hsl(var(--primary) / .1); border-color: hsl(var(--primary) / .35); color: hsl(var(--primary)); }

/* ---------- Skeleton / loading ---------- */
.skeleton { background: linear-gradient(90deg, hsl(var(--accent)) 0%, hsl(var(--card-hover)) 50%, hsl(var(--accent)) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-kpi { height: 92px; }
.skeleton-chart { height: 300px; }

/* ---------- Toast ---------- */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.toast { padding: 12px 14px; border-radius: var(--radius-sm); background: hsl(var(--card)); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-md); font-size: 12.5px; animation: toast-in .2s ease; }
.toast.success { border-left: 3px solid var(--emerald); }
.toast.warning { border-left: 3px solid var(--amber); }
.toast.error { border-left: 3px solid var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Legend / misc ---------- */
.legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 11px; color: hsl(var(--muted-foreground)); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: middle; }

.rank-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.rank-badge { width: 20px; height: 20px; border-radius: 50%; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-right: 8px; }

.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

.province-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

#map-container { width: 100%; height: 520px; border-radius: var(--radius-sm); overflow: hidden; background: hsl(var(--bg)); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1023px) { .grid-2 { grid-template-columns: 1fr; } }

.gap-6 { display: flex; flex-direction: column; gap: 24px; }

.search-input-wrap { position: relative; max-width: 280px; }
