/* ==========================================================================
   Hedef Takip Sistemi - PuccaGSM
   Kurumsal, sade, koyu tema tasarım
   ========================================================================== */

:root {
  --bg: #0b0f17;
  --bg-soft: #10151f;
  --surface: #141a26;
  --surface-2: #1a2130;
  --surface-hover: #1f273a;
  --border: #232b3d;
  --border-soft: #1b2231;

  --text: #eef1f7;
  --text-muted: #93a0b8;
  --text-faint: #5b6780;

  --brand: #6c8bff;
  --brand-soft: #6c8bff22;
  --brand-strong: #4f6fe0;

  --success: #2fd191;
  --success-soft: #2fd19122;
  --warning: #ffb648;
  --warning-soft: #ffb64822;
  --danger: #ff6b6b;
  --danger-soft: #ff6b6b22;

  --gold: #f5c65b;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow-2: 0 8px 24px rgba(0,0,0,.35);
  --shadow-glow: 0 0 0 1px rgba(108,139,255,.15), 0 8px 30px rgba(108,139,255,.08);

  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  color-scheme: dark;
}

html[data-theme='light'] {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-hover: #eef1f8;
  --border: #e3e8f2;
  --border-soft: #ebeef6;

  --text: #17203a;
  --text-muted: #5b6780;
  --text-faint: #97a1b8;

  --brand-soft: #6c8bff17;
  --success-soft: #2fd19117;
  --warning-soft: #ffb64817;
  --danger-soft: #ff6b6b17;

  --shadow-1: 0 1px 2px rgba(20,30,60,.06);
  --shadow-2: 0 12px 28px rgba(20,30,60,.08);
  --shadow-glow: 0 0 0 1px rgba(108,139,255,.12), 0 8px 30px rgba(108,139,255,.06);

  color-scheme: light;
}

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

body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent 60%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

::selection { background: var(--brand); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ==========================================================================
   Layout
   ========================================================================== */

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: 26px;
  position: sticky;
  top: 14px;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #9a6cff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(108,139,255,.35);
}

.brand-text h1 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0;
  letter-spacing: .2px;
}

.brand-text span {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--text-faint); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-faint); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(108,139,255,.28);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ==========================================================================
   Page header
   ========================================================================== */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.page-head h2 {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 700;
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
}

.month-picker span {
  min-width: 130px;
  text-align: center;
  font-weight: 600;
  font-size: 13.5px;
}

/* ==========================================================================
   Stat cards
   ========================================================================== */

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }

.stat-card .icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  margin-bottom: 14px;
}

.stat-card .label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.stat-card .sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 5px;
}

.tone-brand .icon-wrap { background: var(--brand-soft); color: var(--brand); }
.tone-success .icon-wrap { background: var(--success-soft); color: var(--success); }
.tone-warning .icon-wrap { background: var(--warning-soft); color: var(--warning); }
.tone-gold .icon-wrap { background: #f5c65b22; color: var(--gold); }

/* ==========================================================================
   Panels
   ========================================================================== */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-1);
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}
.panel-head h3 i { color: var(--brand); font-size: 18px; }

.panel-head .desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

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

/* ==========================================================================
   Achievement banner
   ========================================================================== */

.banner {
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.banner.achieved {
  background: linear-gradient(120deg, var(--success-soft), transparent);
  border-color: #2fd19144;
}

.banner .banner-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.banner.achieved .banner-icon { background: var(--success-soft); color: var(--success); }
.banner.pending .banner-icon { background: var(--brand-soft); color: var(--brand); }

.banner h4 { margin: 0 0 4px; font-size: 15.5px; font-weight: 700; }
.banner p { margin: 0; font-size: 13px; color: var(--text-muted); }
.banner strong { color: var(--text); }

/* ==========================================================================
   Targets list
   ========================================================================== */

.target-list { display: flex; flex-direction: column; gap: 12px; }

.target-item {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  transition: border-color .2s ease, background .2s ease;
}
.target-item.is-achieved {
  border-color: #2fd19155;
  background: linear-gradient(90deg, var(--success-soft), var(--surface-2) 60%);
}
.target-item.is-next {
  border-color: var(--brand);
  box-shadow: var(--shadow-glow);
}

.target-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.target-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
}

.target-badge .num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
}
.is-achieved .target-badge .num { background: var(--success); color: #06231a; }
.is-next .target-badge .num { background: var(--brand); color: #fff; }

.target-amounts { text-align: right; }
.target-amounts .amount { font-weight: 700; font-size: 14px; }
.target-amounts .bonus { font-size: 11.5px; color: var(--gold); font-weight: 600; }

.progress-track {
  height: 8px;
  border-radius: 20px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--brand), #9a6cff);
  transition: width .5s ease;
}
.is-achieved .progress-fill { background: linear-gradient(90deg, var(--success), #29b57e); }

.target-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-faint);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-muted { background: var(--surface-hover); color: var(--text-muted); }

/* ==========================================================================
   Chart containers
   ========================================================================== */

.chart-wrap { position: relative; height: 280px; }
.chart-wrap.small { height: 220px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-faint);
}
.empty-state i { font-size: 34px; margin-bottom: 10px; opacity: .6; }
.empty-state p { margin: 0; font-size: 13px; }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  text-align: center;
  padding: 30px 10px 10px;
  color: var(--text-faint);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer a { color: var(--text-muted); font-weight: 600; }
.footer a:hover { color: var(--brand); }

/* ==========================================================================
   Forms (admin)
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }

.field input, .field select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
.field input:focus, .field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
thead th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
td.actions { display: flex; gap: 6px; }

.today-tag {
  display: inline-block;
  margin-left: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}

/* Targets edit grid */
.target-edit-row {
  display: grid;
  grid-template-columns: 46px 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.target-edit-row:last-child { border-bottom: none; }
.target-edit-row .level-chip {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand);
}

/* ==========================================================================
   Login page
   ========================================================================== */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow-2);
}

.login-card .brand-mark { margin: 0 auto 18px; }
.login-card h2 { text-align: center; margin: 0 0 4px; font-size: 19px; }
.login-card p.sub { text-align: center; margin: 0 0 26px; color: var(--text-muted); font-size: 13px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  margin-bottom: 16px;
}
.alert-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #ff6b6b33; }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid #2fd19133; }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.toast {
  min-width: 240px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toast-in .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast i { margin-top: 1px; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--brand); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 8px;
}
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.hidden { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .app-shell { padding: 14px 12px 40px; }
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-card .value { font-size: 19px; }
  .panel { padding: 16px; border-radius: var(--radius-md); }
  .topbar { padding: 10px 12px; top: 8px; flex-wrap: wrap; }
  .brand-text h1 { font-size: 13.5px; }
  .brand-text span { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .month-picker { align-self: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .target-edit-row { grid-template-columns: 40px 1fr; }
  .target-edit-row .field:nth-child(3) { grid-column: 1 / -1; }
  table { min-width: 480px; }
  .banner { flex-direction: column; text-align: center; }
  .toast-stack { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

@media (max-width: 380px) {
  .grid-stats { grid-template-columns: 1fr; }
}
