/* Grafiker Panel — tema katmanı (Bootstrap 5.3 üzerine).
   Backend/JS'e dokunmaz; yalnızca görsel sistem: tokenlar, sidebar+topbar, bileşen temaları. */

:root {
  /* Marka */
  --brand-mint: #63ffcf;
  --primary: #0e9f84;
  --primary-hover: #0c8a72;
  --primary-soft: #e6f7f2;

  /* Yüzeyler */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e6e8ec;
  --border-strong: #d6d9df;

  /* Metin */
  --text: #161a1e;
  --muted: #6a7280;
  --heading: #0d1116;

  /* Sidebar (koyu) */
  --side-bg: #0f1724;
  --side-bg-2: #0c121c;
  --side-text: #9aa4b2;
  --side-text-strong: #e8ecf1;
  --side-active-bg: rgba(99, 255, 207, .12);
  --side-hover-bg: rgba(255, 255, 255, .06);

  /* Sistem */
  --radius: 12px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, .08);
  --sidebar-w: 248px;

  /* Bootstrap değişkenlerini markaya bağla */
  --bs-primary: var(--primary);
  --bs-primary-rgb: 14, 159, 132;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-hover);
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--bs-font-sans-serif);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 { color: var(--heading); font-weight: 650; letter-spacing: -.01em; }

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

/* Tablo içi bağlantılar ham mavi link gibi durmasın */
.table a { font-weight: 500; color: var(--primary); }
.table a:visited { color: var(--primary); }
.table a:hover { text-decoration: underline; }

/* Kayıt no / referans çipi (ham numara linki yerine) */
.id-link {
  display: inline-block; font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 0 7px; line-height: 1.7; font-size: .78rem; text-decoration: none;
}
.id-link:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }

/* ============ Uygulama iskeleti ============ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; }
}

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--side-text-strong); font-weight: 700; font-size: 1.05rem;
  text-decoration: none; letter-spacing: -.02em;
}
.brand-logo {
  display: grid; place-items: center; width: 30px; height: 30px;
  background: var(--brand-mint); color: #06281f; border-radius: 8px;
  font-size: 16px; font-weight: 800; letter-spacing: -.02em;
}
.stat-sep { color: var(--border-strong); font-weight: 400; margin: 0 2px; }

.sidebar-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--side-text); text-decoration: none; font-weight: 500;
  position: relative; transition: background .12s ease, color .12s ease;
}
.side-link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.side-link:hover { background: var(--side-hover-bg); color: var(--side-text-strong); }
.side-link.active { background: var(--side-active-bg); color: #fff; }
.side-link.active svg { opacity: 1; color: var(--brand-mint); }
.side-link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-mint);
}
.sidebar-sep { margin: 10px 12px; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #5b6472; }

.sidebar-foot {
  padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.side-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.side-user .avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .8rem;
}
.side-user .u-name { color: var(--side-text-strong); font-weight: 500; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout { color: var(--side-text); border: 1px solid rgba(255, 255, 255, .14); border-radius: var(--radius-sm); padding: 5px 10px; text-decoration: none; font-size: .8rem; }
.btn-logout:hover { color: #fff; background: rgba(255, 255, 255, .08); }

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

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 60px; display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(16px, 3vw, 28px);
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 1.05rem; font-weight: 650; margin: 0; color: var(--heading); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .8rem;
}
.btn-ghost {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); width: 38px; height: 38px; display: grid; place-items: center; padding: 0;
}
.btn-ghost:hover { background: var(--surface-2); }

.content { padding: clamp(18px, 3vw, 28px); width: 100%; max-width: 1340px; }

/* Sayfa başlığı deseni */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 1.4rem; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .85rem; }

/* ============ Kartlar ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  font-weight: 600; color: var(--heading);
}
.card-body { padding: 18px; }

/* İstatistik kartı */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .stat-label { color: var(--muted); font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat .stat-value { font-size: 1.7rem; font-weight: 700; color: var(--heading); line-height: 1.1; letter-spacing: -.02em; }
.stat .stat-meta { color: var(--muted); font-size: .8rem; }
.stat-ico {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 2px;
}
.stat-ico svg { width: 21px; height: 21px; }

/* ============ Butonlar ============ */
.btn { border-radius: var(--radius-sm); font-weight: 550; padding: .45rem .9rem; }
.btn-sm { border-radius: 7px; padding: .3rem .6rem; }
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(14, 159, 132, .28); }

.btn-dark, .btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn-dark:hover, .btn-primary:hover,
.btn-dark:focus, .btn-primary:focus {
  background: var(--primary-hover); border-color: var(--primary-hover); color: #fff;
}
.btn-outline-dark {
  color: var(--text); border-color: var(--border-strong);
}
.btn-outline-dark:hover { background: var(--surface-2); color: var(--heading); border-color: var(--border-strong); }
.btn-link { color: var(--primary); text-decoration: none; }
.btn-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ============ Formlar ============ */
.form-label { font-weight: 550; color: #3a414a; margin-bottom: .3rem; font-size: .85rem; }
.form-label.small { font-size: .78rem; }
.form-control, .form-select {
  border-color: var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background-color: var(--surface);
}
.form-control::placeholder { color: #9aa1aa; }
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 159, 132, .15);
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14, 159, 132, .15); }

/* ============ Tablolar ============ */
.table { --bs-table-bg: transparent; color: var(--text); margin-bottom: 0; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 600; color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px; white-space: nowrap;
}
.table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover > * { background: var(--surface-2); }
.card > .table-responsive:last-child .table tbody tr:last-child td { border-bottom: 0; }
.card > .table-responsive { border-radius: 0 0 var(--radius) var(--radius); }

/* ============ Rozetler ============ */
.badge { font-weight: 600; padding: .34em .6em; border-radius: 6px; font-size: .72rem; letter-spacing: .01em; }
.badge.text-bg-success { background: #e7f6ef !important; color: #0a7b52 !important; }
.badge.text-bg-danger { background: #fdecec !important; color: #c0392b !important; }
.badge.text-bg-warning { background: #fef5e7 !important; color: #a86a00 !important; }
.badge.text-bg-secondary { background: #eef0f3 !important; color: #5a6472 !important; }
.badge.text-bg-dark { background: #e9ebef !important; color: #343a40 !important; }

/* ============ Uyarılar ============ */
.alert { border: 1px solid transparent; border-radius: var(--radius-sm); padding: .8rem 1rem; }
.alert-success { background: #e9f7f1; border-color: #bfe8d8; color: #0a6b48; }
.alert-danger { background: #fdecec; border-color: #f5c6c6; color: #a52a2a; }
.alert-warning { background: #fef6e8; border-color: #f6dca8; color: #8a5a00; }
.alert-info { background: var(--primary-soft); border-color: #bfe6dc; color: #0a6b58; }

/* ============ Pagination ============ */
.pagination { --bs-pagination-color: var(--text); --bs-pagination-border-color: var(--border); gap: 4px; }
.page-link { border-radius: 8px; border-color: var(--border); color: var(--text); }
.page-link:hover { background: var(--surface-2); color: var(--heading); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.page-item .page-link:focus { box-shadow: 0 0 0 3px rgba(14, 159, 132, .18); }

/* ============ Diğer ============ */
.list-group-item { border-color: var(--border); background: transparent; padding: 11px 16px; }
.nav-tabs { border-bottom: 1px solid var(--border); gap: 2px; }
.nav-tabs .nav-link { border: 0; color: var(--muted); font-weight: 550; border-radius: 0; padding: 10px 14px; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link:hover { color: var(--heading); border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active { color: var(--primary); background: transparent; border-bottom-color: var(--primary); }
.progress { background: var(--surface-2); border-radius: var(--radius-pill); }
.progress-bar.bg-success { background: var(--primary) !important; }
details > summary { cursor: pointer; }

/* Yardımcılar (layout'tan taşınan) */
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #e9ebef; }
.ref-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #e9ebef; }
.strip-prev { max-width: 100%; max-height: 60px; background: repeating-conic-gradient(#d7dade 0 25%, #fff 0 50%) 0 0/16px 16px; border-radius: 6px; }
.text-clip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
code.copy { cursor: pointer; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); }

/* ============ Giriş ekranı ============ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #11202e 0%, #0b0f14 55%);
}
.auth-card { flex: 0 0 auto; width: 100%; max-width: 380px; }
.auth-card .row, .auth-card .col-sm-8, .auth-card [class*="col-"] { width: 100%; max-width: 100%; flex: 0 0 100%; margin: 0; }
.auth-card .card { box-shadow: var(--shadow-md); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; margin-bottom: 20px; font-weight: 700; font-size: 1.25rem; }
.auth-brand .brand-logo { display: grid; place-items: center; width: 34px; height: 34px; background: var(--brand-mint); color: #06281f; border-radius: 9px; }

/* ============ Responsive ============ */
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { width: min(84vw, 300px); }
}
@media (max-width: 575.98px) {
  body { font-size: 13.5px; }
  .content { padding: 14px; }
  .stat .stat-value { font-size: 1.45rem; }
  .page-head h1 { font-size: 1.2rem; }
}
