/* ── VizeCRM App Shell ─────────────────────────────────────────────────────
   Profesyonel, tutarlı bileşen sistemi. Sayfalar inline stil kullanmaz;
   buradaki sınıfları kullanır. */

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

:root {
  --brand:      #1a56db;
  --brand-dk:   #1e40af;
  --brand-lt:   #eff6ff;
  --ink:        #0f172a;
  --text:       #1e293b;
  --muted:      #64748b;
  --faint:      #94a3b8;
  --border:     #e2e8f0;
  --border-lt:  #f1f5f9;
  --bg:         #f1f5f9;
  --surface:    #ffffff;
  --green:      #16a34a;
  --green-lt:   #f0fdf4;
  --red:        #dc2626;
  --red-lt:     #fef2f2;
  --amber:      #d97706;
  --amber-lt:   #fffbeb;
  --radius:     10px;
  --radius-sm:  7px;
  --sb-w:       248px;
  --shadow-sm:  0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow:     0 4px 16px rgba(15,23,42,.08);
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: .9rem;
  -webkit-font-smoothing: antialiased;
}

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

/* ── APP SHELL LAYOUT ──────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── SIDEBAR ───────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sb-w);
  background: linear-gradient(180deg, #0f172a 0%, #131f3a 100%);
  display: flex; flex-direction: column;
  z-index: 100;
}

.brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.25rem 1.4rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  background: var(--brand);
  color: #fff; font-weight: 800; font-size: 1rem;
  border-radius: 8px;
}
.brand-name { color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }

.nav { flex: 1; padding: .9rem .7rem; overflow-y: auto; }

.nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .75rem;
  margin-bottom: .15rem;
  color: rgba(255,255,255,.62);
  font-size: .875rem; font-weight: 500;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.nav-link.active { color: #fff; background: var(--brand); box-shadow: 0 2px 8px rgba(26,86,219,.4); }
.nav-link .ico { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

.nav-section {
  padding: 1rem .75rem .4rem;
  color: rgba(255,255,255,.34);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em;
}

.sidebar-foot {
  padding: .8rem .9rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.user-chip { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  font-weight: 700; font-size: .9rem;
  border-radius: 50%;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: #fff; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.45); font-size: .72rem; }

.btn-logout {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; justify-content: center;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.1);
  padding: .5rem; border-radius: 8px;
  font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-logout:hover { background: rgba(220,38,38,.18); color: #fecaca; border-color: rgba(220,38,38,.4); }
.btn-logout .ico { width: 16px; height: 16px; fill: currentColor; }

/* ── CONTENT AREA ──────────────────────────────────────────────────────── */
.content-area { flex: 1; margin-left: var(--sb-w); min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex; align-items: center; gap: 1rem;
}
.topbar-titles { flex: 1; min-width: 0; }
.topbar h1 { font-size: 1.25rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.topbar .sub { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }

.page-body { padding: 1.75rem 2rem 2.5rem; max-width: 1240px; }

/* ── CARD ──────────────────────────────────────────────────────────────── */
.card, .dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.1rem; padding-bottom: .85rem;
  border-bottom: 1px solid var(--border-lt);
}
.card-title, .card h2, .dash-section h2 {
  font-size: 1rem; font-weight: 700; color: var(--ink);
}
.card h2, .dash-section h2 {
  margin-bottom: 1.1rem; padding-bottom: .85rem;
  border-bottom: 1px solid var(--border-lt);
}
.card-head .card-title { margin: 0; padding: 0; border: none; }
.count-pill {
  display: inline-block; margin-left: .5rem;
  background: var(--brand-lt); color: var(--brand-dk);
  font-size: .72rem; font-weight: 700;
  padding: .1rem .5rem; border-radius: 999px;
}

/* ── AY SEÇİM ÇUBUĞU (dashboard dönem butonları) ───────────────────────── */
.month-bar {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  margin-bottom: .75rem;
}
.month-bar-label {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-right: .25rem;
}
.month-btn {
  display: inline-block; padding: .38rem .7rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-size: .8rem; font-weight: 600; line-height: 1; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.month-btn:hover { background: var(--brand-lt); border-color: var(--brand); color: var(--brand-dk); }
.month-btn.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 2px 8px rgba(26,86,219,.35);
}
/* Verisi olmayan ay — tıklanabilir ama soluk */
.month-btn.empty { color: var(--faint); border-style: dashed; }
.month-btn.empty.active { color: #fff; border-style: solid; }
/* Çoklu seçimi tek aya indiren temizle butonu */
.month-btn.clear { background: var(--border-lt); color: var(--muted); font-weight: 500; }
.month-btn.clear:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Yıl butonları (birden fazla yıl veri varsa) */
.year-group { display: inline-flex; gap: .25rem; margin-right: .5rem; }
.year-btn {
  display: inline-block; padding: .38rem .6rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--border-lt); color: var(--muted);
  font-size: .78rem; font-weight: 700; line-height: 1;
}
.year-btn:hover { color: var(--brand-dk); border-color: var(--brand); }
.year-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ── KPI / STAT CARDS ──────────────────────────────────────────────────── */
.kpi-grid, .stat-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.25rem;
}
.kpi, .stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi::before, .stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--brand);
}
.kpi .label, .stat-card .label {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: .45rem;
}
.kpi .value, .stat-card .value {
  font-size: 1.65rem; font-weight: 700; line-height: 1.1; color: var(--ink);
}
.kpi .hint { font-size: .74rem; color: var(--faint); margin-top: .3rem; }
.kpi.green::before, .stat-card.green::before { background: var(--green); }
.kpi.green .value, .stat-card.green .value { color: #15803d; }
.kpi.red::before, .stat-card.red::before { background: var(--red); }
.kpi.red .value, .stat-card.red .value { color: #b91c1c; }
.kpi.blue::before, .stat-card.blue::before { background: var(--brand); }
.kpi.blue .value, .stat-card.blue .value { color: var(--brand-dk); }
.kpi.orange::before, .stat-card.orange::before { background: var(--amber); }
.kpi.orange .value, .stat-card.orange .value { color: #92400e; }

/* ── TABLES ────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: var(--border-lt);
  color: var(--muted); font-weight: 600;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: left;
}
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child  { border-top-right-radius: var(--radius-sm); }
tbody td { padding: .7rem .9rem; border-bottom: 1px solid var(--border-lt); color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--brand-lt); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── BADGES ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .6rem;
  border-radius: 999px; font-size: .73rem; font-weight: 600;
}
.badge-green  { background: var(--green-lt); color: var(--green); }
.badge-red    { background: var(--red-lt);   color: var(--red); }
.badge-yellow { background: var(--amber-lt); color: var(--amber); }
.badge-blue   { background: var(--brand-lt); color: var(--brand-dk); }
.badge-gray   { background: #f1f5f9;         color: var(--muted); }

/* ── BUTTONS ───────────────────────────────────────────────────────────── */
button, .btn, .btn-primary, .btn-action {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--brand); color: #fff; border: none;
  padding: .55rem 1.15rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background .15s, box-shadow .15s, opacity .15s;
}
button:hover, .btn:hover, .btn-primary:hover, .btn-action:hover {
  background: var(--brand-dk); text-decoration: none; box-shadow: 0 2px 8px rgba(26,86,219,.3);
}
.btn-ghost {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); border-color: var(--faint); box-shadow: none; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; box-shadow: 0 2px 8px rgba(220,38,38,.3); }

.btn-sm {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .32rem .7rem; font-size: .78rem; font-weight: 600;
  border-radius: 6px; background: var(--brand-lt); color: var(--brand-dk);
  border: 1px solid #bfdbfe; cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn-sm:hover { background: #dbeafe; text-decoration: none; }
.btn-sm.ghost { background: var(--surface); color: var(--muted); border-color: var(--border); }
.btn-sm.ghost:hover { background: var(--bg); }
.btn-sm.danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.btn-sm.danger:hover { background: #fecaca; }
.btn-sm.success { background: #16a34a; color: #fff; border-color: #15803d; }
.btn-sm.success:hover { background: #15803d; }
.btn-sm.warning { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.btn-sm.warning:hover { background: #ffedd5; }

/* Dashboard grafikleri */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.chart-box h4 { font-size: .9rem; margin-bottom: .6rem; }
.chart-box canvas { max-height: 260px; }

/* ── FORMS ─────────────────────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  padding: .55rem .8rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: .9rem; font-family: inherit;
  color: var(--text); background: var(--surface); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
label { font-size: .82rem; font-weight: 600; color: var(--text); }

.form-grid { display: grid; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field .suffix { font-size: .75rem; color: var(--faint); font-weight: 500; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { flex: 1; min-width: 150px; width: auto; }
.customer-form { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.customer-form input { flex: 1; min-width: 160px; }

/* ── ALERTS ────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1rem; }
.alert-success { background: var(--green-lt); border: 1px solid #bbf7d0; color: #15803d; }
.alert-error   { background: var(--red-lt);   border: 1px solid #fecaca; color: var(--red); }
.alert-info    { background: var(--brand-lt); border: 1px solid #bfdbfe; color: var(--brand-dk); }
.error { color: var(--red); font-size: .875rem; margin-bottom: 1rem; }

/* ── DEFINITION LIST (detay) ───────────────────────────────────────────── */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: .1rem .5rem; }
.dl dt { color: var(--muted); font-size: .82rem; padding: .55rem 0; }
.dl dd { color: var(--text); font-weight: 500; padding: .55rem 0; border-bottom: 1px solid var(--border-lt); }
.dl dt { border-bottom: 1px solid var(--border-lt); }
.dl > dt:last-of-type, .dl > dd:last-of-type { border-bottom: none; }

/* ── EMPTY STATE ───────────────────────────────────────────────────────── */
.empty-row, .empty { color: var(--muted); font-style: italic; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* ── LOGIN (split layout) ──────────────────────────────────────────────── */
.auth-shell { display: flex; min-height: 100vh; }

.auth-brand {
  flex: 1.1; position: relative;
  background: #0f172a;  /* görsel yüklenene kadar yedek */
  color: #fff; padding: 3rem 3.5rem;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
/* Flu pasaport arka planı + üstüne koyu gradyan (içerik bunların üstünde, z-index:1) */
.auth-brand::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(160deg, rgba(15,23,42,.90) 0%, rgba(21,38,74,.82) 55%, rgba(26,58,107,.78) 100%),
    url("/static/img/passport-bg.jpg") center/cover no-repeat;
  filter: blur(5px) brightness(.7);
  transform: scale(1.12);
}
.auth-brand::after {
  content: ""; position: absolute; right: -120px; top: -120px; z-index: 0;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(26,86,219,.4), transparent 70%);
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 460px; margin-top: auto; margin-bottom: auto; }
.auth-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 2.5rem; }
.auth-logo-mark {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 1.25rem; border-radius: 10px;
}
.auth-logo-name { font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; }
.auth-portal-tag {
  display: inline-block; margin-bottom: 1.75rem;
  color: #93b4ff; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
}
.auth-brand-inner h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 1rem; }
.auth-brand-inner > p { color: rgba(255,255,255,.7); font-size: 1rem; line-height: 1.6; margin-bottom: 2rem; }
.auth-features { list-style: none; display: flex; flex-direction: column; gap: .85rem; }
.auth-features li {
  position: relative; padding-left: 2rem; color: rgba(255,255,255,.85); font-size: .95rem;
}
.auth-features li::before {
  content: "✓"; position: absolute; left: 0; top: -1px;
  display: grid; place-items: center; width: 1.35rem; height: 1.35rem;
  background: rgba(26,86,219,.3); color: #93b4ff; border-radius: 50%; font-size: .8rem; font-weight: 700;
}
.auth-brand-foot { position: relative; z-index: 1; color: rgba(255,255,255,.4); font-size: .8rem; }

.auth-main {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: var(--bg); overflow: hidden;
}
/* Sağ panelde / mobilde çok hafif flu pasaport dokusu */
.auth-main::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: url("/static/img/passport-bg.jpg") center/cover no-repeat;
  filter: blur(8px) brightness(1.05) saturate(.4);
  opacity: .08;
  transform: scale(1.12);
}
.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 2.25rem 2rem;
}
.auth-card h2 { font-size: 1.6rem; font-weight: 800; color: var(--ink); margin-bottom: .35rem; }
.auth-card .sub { font-size: .9rem; color: var(--muted); margin-bottom: 2rem; }
.auth-card form { margin-bottom: 1.25rem; }
.auth-card button { width: 100%; padding: .7rem; margin-top: .35rem; }
.auth-foot { font-size: .82rem; color: var(--faint); text-align: center; }

@media (max-width: 860px) {
  .auth-brand { display: none; }
}

/* ── BULK MESSAGES ─────────────────────────────────────────────────────── */
.recipient-list {
  max-height: 260px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: .5rem;
}
.recipient-list label {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .5rem; border-radius: 6px; font-size: .875rem; cursor: pointer; font-weight: 500;
}
.recipient-list label:hover { background: var(--bg); }

/* ── FX RATE PILL ──────────────────────────────────────────────────────── */
.fx-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: .35rem .8rem;
  font-size: .8rem; color: var(--muted); font-weight: 500;
}
.fx-pill strong { color: var(--ink); font-weight: 700; }

/* ── UTILITY ───────────────────────────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.fw-bold    { font-weight: 700; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 1.25rem; }

/* ── MOBİL ALT SEKME ÇUBUĞU (PWA) ──────────────────────────────────────── */
.bottom-nav { display: none; }

@media (max-width: 720px) {
  /* Mobilde sidebar gizlenir; gezinme alttaki sekme çubuğundan yapılır. */
  .sidebar { display: none; }
  .content-area { margin-left: 0; }
  .page-body { padding: 1rem 1rem calc(72px + env(safe-area-inset-bottom)); }
  .topbar { padding: .9rem 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid, .stat-cards { grid-template-columns: 1fr 1fr; }

  .bottom-nav {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: #0f172a;
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .35rem 0; color: rgba(255,255,255,.6);
    font-size: .68rem; font-weight: 600; text-decoration: none;
  }
  .bottom-nav a svg { width: 22px; height: 22px; fill: currentColor; }
  .bottom-nav a.active { color: #fff; }
}
