/* =========================================================================
   KMC Tedarik Zinciri — Tasarim Sistemi (style.css)
   Tum sayfalar bu dosyayi kullanir. Kurumsal, modern, temiz. Limak Cimento.
   ========================================================================= */

:root {
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #dc2626;
  --accent: #dc2626;
  --accent-dark: #b91c1c;
  --page-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #2563eb;

  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .10);
  --sidebar-w: 250px;
}

/* ---------- Reset / temel ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; color: var(--text); }

/* =========================================================================
   LAYOUT: sol sidebar + sag icerik
   ========================================================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand .brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, .18);
  flex: 0 0 auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: var(--shadow);
}

.nav-link .nav-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: .9;
}

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: .8rem;
}

.sidebar-foot .u-name { color: #fff; font-weight: 600; }
.sidebar-foot .u-meta { color: var(--sidebar-text); opacity: .8; margin-top: 2px; }
.sidebar-foot .u-ver {
  margin-top: 8px;
  font-size: .72rem;
  color: var(--muted);
  opacity: .9;
}

/* ---------- Ana icerik ---------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 62px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip .u-txt { text-align: right; line-height: 1.15; }
.user-chip .u-txt .n { font-weight: 600; font-size: .9rem; }
.user-chip .u-txt .f { font-size: .78rem; color: var(--muted); }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: var(--shadow);
}

/* ---------- Icerik alani ---------- */
.content {
  padding: 24px;
  flex: 1;
}

.page-head {
  margin-bottom: 18px;
}
.page-head h1 { font-size: 1.4rem; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }

/* =========================================================================
   KARTLAR
   ========================================================================= */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card + .card { margin-top: 18px; }

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .count-pill {
  font-size: .72rem;
  font-weight: 600;
  background: var(--page-bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 9px;
}

/* ---------- KPI kartlari ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow .15s, transform .15s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi-ico {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.kpi-ico svg { width: 22px; height: 22px; }

.kpi-ico.i-total  { background: rgba(37, 99, 235, .12);  color: var(--info); }
.kpi-ico.i-wait   { background: rgba(217, 119, 6, .12);  color: var(--warn); }
.kpi-ico.i-ok     { background: rgba(22, 163, 74, .12);  color: var(--ok); }
.kpi-ico.i-danger { background: rgba(220, 38, 38, .12);  color: var(--danger); }

.kpi-body .kpi-val { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.kpi-body .kpi-lbl { color: var(--muted); font-size: .82rem; margin-top: 4px; }

/* =========================================================================
   BUTONLAR
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s;
  font-family: inherit;
  line-height: 1.2;
}
.btn:hover { box-shadow: var(--shadow); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--page-bg); color: var(--text); box-shadow: none; }

.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }

.btn svg { width: 16px; height: 16px; }

/* =========================================================================
   ROZETLER (badge)
   ========================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.badge-ok     { background: rgba(22, 163, 74, .12);  color: var(--ok); }
.badge-warn   { background: rgba(217, 119, 6, .12);  color: var(--warn); }
.badge-danger { background: rgba(220, 38, 38, .12);  color: var(--danger); }
.badge-info   { background: rgba(37, 99, 235, .12);  color: var(--info); }
.badge-muted  { background: var(--page-bg);          color: var(--muted); }

/* =========================================================================
   TABLOLAR
   ========================================================================= */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--page-bg);
  color: var(--muted);
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:nth-child(even) { background: rgba(241, 245, 249, .5); }
.table tbody tr:hover { background: rgba(220, 38, 38, .05); }

.table tbody tr.clickable { cursor: pointer; }

.table .col-no { font-weight: 600; color: var(--accent); white-space: nowrap; }
.table .muted { color: var(--muted); }

/* ---------- Bos durum ---------- */
.empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
}
.empty svg { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }

/* ---------- Onay bekleyen liste ---------- */
.approve-list { display: flex; flex-direction: column; gap: 10px; }

.approve-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 10px;
  background: #fff;
  transition: box-shadow .15s;
}
.approve-item:hover { box-shadow: var(--shadow); }

.approve-item .ai-main { min-width: 0; }
.approve-item .ai-title { font-weight: 600; }
.approve-item .ai-meta { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* =========================================================================
   FLASH mesajlari
   ========================================================================= */
.flash-wrap { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }

.flash {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid;
  font-size: .9rem;
  background: #fff;
}
.flash .fl-msg { flex: 1; }
.flash .fl-close {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
}
.flash .fl-close:hover { opacity: 1; }
.flash .fl-ico { width: 18px; height: 18px; flex: 0 0 auto; }

.flash-success { border-color: rgba(22, 163, 74, .35);  background: rgba(22, 163, 74, .08);  color: #14532d; }
.flash-success .fl-ico { color: var(--ok); }
.flash-danger  { border-color: rgba(220, 38, 38, .35);  background: rgba(220, 38, 38, .08);  color: #7f1d1d; }
.flash-danger .fl-ico { color: var(--danger); }
.flash-warning { border-color: rgba(217, 119, 6, .35);  background: rgba(217, 119, 6, .08);  color: #78350f; }
.flash-warning .fl-ico { color: var(--warn); }
.flash-info    { border-color: rgba(37, 99, 235, .35);  background: rgba(37, 99, 235, .08);  color: #1e3a8a; }
.flash-info .fl-ico { color: var(--info); }

/* =========================================================================
   FORMLAR (ortak — diger ajanlar da kullanabilir)
   ========================================================================= */
.form-group { margin-bottom: 15px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .85rem;
  margin-bottom: 6px;
  color: var(--text);
}
.form-control,
input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="email"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: .92rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }

/* =========================================================================
   LOGIN sayfasi
   ========================================================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 55%, #7f1d1d 130%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .28);
  padding: 34px 30px 28px;
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}
.login-brand .lb-badge {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
}
.login-brand .lb-badge svg { width: 28px; height: 28px; }
.login-brand h1 { font-size: 1.3rem; margin: 0; }
.login-brand .lb-sub { color: var(--muted); font-size: .9rem; margin-top: 3px; }

.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px; margin-top: 4px; }

.login-foot {
  text-align: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.6;
}
.login-foot .lf-ver { display: block; margin-top: 4px; opacity: .8; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 860px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  .sidebar-toggle { display: inline-flex; }

  .app-shell { flex-direction: column; }

  .sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 90;
  }
  .sidebar-backdrop.show { display: block; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .user-chip .u-txt { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
}
