/* ================================================================
   Elbir İlaç B2B — Panel Ana CSS
   Konum: /assets/css/panel.css
   ================================================================ */

/* ── CSS DEĞİŞKENLERİ ─────────────────────────────────────────── */
:root {
  /* Marka renkleri */
  --blue:       #3c87bc;
  --blue-mid:   #5596c5;
  --blue-light: #7baed2;
  --blue-xlt:   #d8e7f2;
  --blue-pale:  #f0f6fb;
  --blue-dark:  #2d6a96;

  /* Nötr */
  --gray-900:   #1a1a2e;
  --gray-700:   #565656;
  --gray-500:   #888;
  --gray-300:   #d0d8e4;
  --gray-100:   #f5f8fc;
  --white:      #ffffff;

  /* Durum renkleri */
  --success:    #2ecc71;
  --warning:    #f39c12;
  --danger:     #e74c3c;
  --info:       #3498db;

  /* ── Faz 2-7 modül alias değişkenleri ──────────────────────── */
  --text:         #1a1a2e;   /* = gray-900 */
  --text-muted:   #888888;   /* = gray-500 */
  --bg:           #ffffff;   /* = white    */
  --bg-alt:       #f5f8fc;   /* = gray-100 */
  --border:       #d0d8e4;   /* = gray-300 */
  --shadow-lg:    0 8px 32px rgba(60,135,188,.20);
  --blue-light:   #e8f4fd;   /* pale blue — icon/tag backgrounds */

  /* Layout */
  --sidebar-w:  240px;
  --header-h:   60px;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 2px 12px rgba(60,135,188,.10);
  --shadow-md:  0 4px 24px rgba(60,135,188,.14);

  /* Tipografi */
  --font:       'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

/* ── RESET & TEMEL ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

img { max-width: 100%; display: block; }

/* ── PANEL LAYOUT ─────────────────────────────────────────────── */
.panel-wrap {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--blue-xlt);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--header-h);
  border-bottom: 1px solid var(--blue-xlt);
  flex-shrink: 0;
}

.sidebar-logo-img {
  height: 36px;
  width: auto;
  display: block;
  max-width: 100%;
}

.sidebar-logo-mark {
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  padding: 4px 8px;
  border-radius: 5px;
}

.sidebar-logo-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
}

.sidebar-logo-sub {
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 400;
}

/* Navigasyon */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 4px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 10px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  position: relative;
}

.nav-item:hover {
  background: var(--blue-pale);
  color: var(--blue);
}

.nav-item.active {
  background: var(--blue-pale);
  color: var(--blue);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .7;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar alt kullanıcı alanı */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid var(--blue-xlt);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10px;
  color: var(--gray-500);
  text-transform: capitalize;
}

.sidebar-user-logout {
  color: var(--gray-500);
  transition: color .15s;
  flex-shrink: 0;
}
.sidebar-user-logout:hover { color: var(--danger); }

/* ── ANA İÇERİK ALANI ─────────────────────────────────────────── */
.panel-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── HEADER ───────────────────────────────────────────────────── */
.panel-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--blue-xlt);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--gray-700);
}

.header-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
  min-width: 0;
}

.header-breadcrumb a { color: var(--gray-500); }
.header-breadcrumb a:hover { color: var(--blue); }
.header-breadcrumb-sep { color: var(--gray-300); }
.header-breadcrumb-current { color: var(--gray-900); font-weight: 500; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Bildirim zil ikonu */
.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--gray-300);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  transition: background .15s, border-color .15s;
}

.notif-btn:hover {
  background: var(--blue-pale);
  border-color: var(--blue-xlt);
  color: var(--blue);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
}

/* WhatsApp butonu */
.whatsapp-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #25d366;
  color: #fff;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(37,211,102,.4);
  transition: background .15s, box-shadow .15s, transform .15s;
}

.whatsapp-btn:hover {
  background: #20b858;
  color: #fff;
  box-shadow: 0 6px 20px rgba(37,211,102,.5);
  transform: translateY(-2px);
}

/* RTL: sol alt köşe */
[dir="rtl"] .whatsapp-btn { right: auto; left: 24px; }

/* ── SAYFA İÇERİĞİ ───────────────────────────────────────────── */
.panel-content {
  flex: 1;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.page-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ── KARTLAR ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--blue-xlt);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--blue-xlt);
  gap: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body { padding: 20px; }
.card-body-sm { padding: 14px 20px; }

/* ── İSTATİSTİK KUTULARI ─────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--blue-xlt);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: .3px;
  text-transform: uppercase;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

.stat-value.blue    { color: var(--blue); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger  { color: var(--danger); }

.stat-note {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ── TABLO ───────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--blue-xlt);
  box-shadow: var(--shadow);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: 13px;
}

.data-table thead th {
  background: var(--blue-pale);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: .4px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--blue-xlt);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--blue-pale); }

.data-table td {
  padding: 11px 14px;
  color: var(--gray-700);
  vertical-align: middle;
}

.data-table td strong { color: var(--gray-900); }

/* ── BADGE (DURUM ETİKETİ) ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success  { background: #e8fdf1; color: #166534; }
.badge-warning  { background: #fff8e1; color: #92400e; }
.badge-danger   { background: #fff1f0; color: #991b1b; }
.badge-primary  { background: var(--blue-pale); color: var(--blue-dark); }
.badge-info     { background: #e0f2fe; color: #075985; }
.badge-secondary{ background: var(--gray-100); color: var(--gray-500); }

/* ── BUTONLAR ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-xs  { padding: 3px 8px;  font-size: 11px; border-radius: var(--radius-sm); }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 22px; font-size: 14px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

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

.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--blue-pale); color: var(--blue); border-color: var(--blue-xlt); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #27ae60; color: #fff; }

.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #c0392b; color: #fff; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--blue);
  color: var(--blue);
}
.btn-outline:hover { background: var(--blue); color: #fff; }

/* ── FORM ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
}

.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(60,135,188,.12);
}

.form-control::placeholder { color: var(--gray-300); }

select.form-control { cursor: pointer; }

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

.form-hint {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

.form-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }

/* ── ALERT ───────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-success { background: #e8fdf1; color: #166534; border-color: #bbf7d0; }
.alert-danger  { background: #fff1f0; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fff8e1; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #e0f2fe; color: #075985; border-color: #bae6fd; }

/* ── BOŞLUKLAR ───────────────────────────────────────────────── */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.gap-grid { display: flex; gap: 14px; flex-wrap: wrap; }
.col-half { flex: 1; min-width: 260px; }

/* ── FOOTER ─────────────────────────────────────────────────── */
.panel-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--blue-xlt);
  background: var(--white);
  font-size: 11px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}


/* ── SİDEBAR DARALTMA (icon-only 60px) ──────────────────────── */
.sidebar.collapsed {
  width: 60px;
  overflow: visible;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-logo-sub,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-user-logout span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-badge {
  display: none;
}

.sidebar.collapsed .sidebar-logo-img {
  height: 28px;
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 0 10px;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.sidebar.collapsed .nav-icon {
  margin-right: 0;
}

.sidebar.collapsed .sidebar-user {
  flex-direction: column;
  align-items: center;
  padding: 10px;
}

.sidebar.collapsed + .panel-main {
  margin-left: 60px;
}

.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: 64px;
  background: var(--gray-900);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.sidebar.collapsed .nav-item { position: relative; }

/* Toggle butonu */
.sidebar-collapse-btn {
  position: absolute;
  right: -12px;
  top: 68px;
  width: 24px;
  height: 24px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  z-index: 101;
  box-shadow: 0 2px 6px rgba(60,135,188,.4);
  transition: background .15s;
}
.sidebar-collapse-btn:hover { background: var(--blue-dark); }

/* RTL daraltma */
[dir="rtl"] .sidebar.collapsed + .panel-main { margin-right: 60px; margin-left: 0; }
[dir="rtl"] .sidebar-collapse-btn { right: auto; left: -12px; }
[dir="rtl"] .sidebar.collapsed .nav-item:hover::after { left: auto; right: 64px; }

/* ── RTL (Arapça) ────────────────────────────────────────────── */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-left: 1px solid var(--blue-xlt);
  border-right: none;
}

[dir="rtl"] .panel-main { margin-left: 0; margin-right: var(--sidebar-w); }

[dir="rtl"] .nav-item.active::before {
  left: auto;
  right: -12px;
  border-radius: 3px 0 0 3px;
}

/* RTL — form ve tablo */
[dir="rtl"] .form-label       { text-align: right; }
[dir="rtl"] .form-control     { text-align: right; }
[dir="rtl"] .table th,
[dir="rtl"] .table td         { text-align: right; }
[dir="rtl"] .page-header      { flex-direction: row-reverse; }
[dir="rtl"] .card-header      { flex-direction: row-reverse; }
[dir="rtl"] .btn              { direction: rtl; }
[dir="rtl"] .badge            { direction: rtl; }
[dir="rtl"] .alert            { text-align: right; border-right: 4px solid; border-left: none; }
[dir="rtl"] .sidebar-nav .nav-icon { margin-left: 8px; margin-right: 0; }
[dir="rtl"] .notification-list    { text-align: right; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }

  .sidebar.open { transform: translateX(0); }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  [dir="rtl"] .sidebar.open { transform: translateX(0); }

  .panel-main { margin-left: 0; }
  [dir="rtl"] .panel-main { margin-right: 0; }

  .header-menu-btn { display: flex; }

  .panel-content { padding: 16px; }

  .stat-grid { grid-template-columns: 1fr 1fr; }

  .whatsapp-btn span { display: none; }
}

/* ── OVERLAY (mobil sidebar için) ────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* ════════════════════════════════════════════════════════════
   DARK MODE — prefers-color-scheme
   ════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --blue:         #5596c5;
    --blue-mid:     #7baed2;
    --blue-light:   #2a4a63;
    --blue-xlt:     #1a2e3e;
    --blue-pale:    #0f1e2b;
    --blue-dark:    #7baed2;
    --blue-lt:      #1e3a50;

    --text:         #e8edf3;
    --text-muted:   #8a99ad;
    --bg-alt:       #141b24;
    --border:       #263548;

    --white:        #1a2535;
    --sidebar-bg:   #0f1922;
  }

  body        { background: #0f1922; color: var(--text); }
  .card       { background: #1a2535; border-color: #263548; }
  .card-header{ border-color: #263548; }
  input, select, textarea, .form-control {
    background: #1a2535; color: var(--text); border-color: #263548;
  }
  input::placeholder, textarea::placeholder { color: #5a6e84; }
  .table thead th { background: #141b24; color: #8a99ad; border-color: #263548; }
  .table td, .table th { border-color: #263548; }
  .table tbody tr:hover { background: #1f2f40; }
  .btn-outline { border-color: #263548; color: var(--text); }
  .btn-outline:hover { background: #1f2f40; }
  .stat-card  { background: #1a2535; border-color: #263548; }
  .badge-secondary { background: #263548; color: #8a99ad; }
  .modal-content  { background: #1a2535; border-color: #263548; }
  .dropdown-menu  { background: #1a2535; border-color: #263548; }
  .dropdown-item:hover { background: #1f2f40; }
  .pub-header { background: #1a2535; border-color: #263548; }
  .lang-select { background: #1a2535; color: var(--text); border-color: #263548; }
  .cat-chip   { background: #1a2535; }
  .filter-drawer { background: #1a2535; }
  .mob-filter-btn { background: #1a2535; }
  #lb-overlay img { box-shadow: 0 0 40px rgba(0,0,0,.8); }
}
