/* ============================================================
   BULUT ENERJİ ERP — Arayüz Teması (kurumsal enerji: mavi / yeşil / beyaz)
   ============================================================ */
:root{
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --brand: #0d6efd;
  --brand-2: #16a34a;
  --ink: #1e293b;
  --muted: #64748b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --sidebar-bg: #0f2540;
  --sidebar-ink: #cbd5e1;
  --sidebar-active: #1d4ed8;
}
*{ box-sizing: border-box; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
a{ color: var(--brand); text-decoration: none; }
a:hover{ text-decoration: underline; }

/* ---------- Shell ---------- */
.app-shell{ display: flex; min-height: 100vh; }
.app-sidebar{
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: transform .2s ease;
}
.app-main{
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-width: 0;
}
.app-content{ padding: 20px; flex: 1; }
.app-footer{
  padding: 12px 20px; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--border); background: var(--card);
}

/* ---------- Sidebar ---------- */
.sidebar-brand{
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-mark{
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex: none;
}
.sidebar-logo{ max-height: 40px; max-width: 150px; background: #fff; border-radius: 6px; padding: 3px; }
.brand-text strong{ display: block; color: #fff; font-size: 14px; line-height: 1.2; }
.brand-text small{ color: #7f9cc0; font-size: 11px; }

.sidebar-nav{ padding: 10px 10px 24px; overflow-y: auto; flex: 1; }
.sidebar-nav .nav-group{
  font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: #5f7ba0; padding: 14px 10px 5px;
}
.sidebar-nav .nav-link{
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px;
  color: var(--sidebar-ink); font-size: 13.5px; margin-bottom: 2px;
}
.sidebar-nav .nav-link:hover{ background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link.active{ background: var(--sidebar-active); color: #fff; }
.sidebar-nav .nav-link i{ font-size: 16px; width: 18px; text-align: center; }

/* ---------- Topbar ---------- */
.app-topbar{
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; position: sticky; top: 0; z-index: 1030;
}
.topbar-search{ position: relative; flex: 1; max-width: 520px; }
.topbar-search .input-icon{
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.topbar-search .form-control{ padding-left: 34px; background: var(--bg); border-color: transparent; }
.topbar-search .form-control:focus{ background: #fff; }
.topbar-right{ display: flex; align-items: center; gap: 8px; margin-left: auto; }
.notif-badge{ position: absolute; top: 2px; right: 2px; font-size: 10px; }
.avatar-sm{
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.notif-menu .notif-item{ padding: 10px 14px; border-bottom: 1px solid var(--border); display: block; color: var(--ink); }
.notif-menu .notif-item:hover{ background: var(--bg); text-decoration: none; }

/* ---------- Page header ---------- */
.page-header{ display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title{ font-size: 20px; font-weight: 650; margin: 0; }
.page-subtitle{ color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.page-actions{ display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards / tables ---------- */
.card{ border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header{ background: var(--card); border-bottom: 1px solid var(--border); }
.table > :not(caption) > * > *{ padding: .6rem .75rem; }
.table thead th{ font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--border); }
.filter-bar{ display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select{ max-width: 320px; }

/* ---------- Stat card ---------- */
.stat-card{
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 12px; padding: 14px 16px; height: 100%;
}
.stat-card .stat-icon{
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stat-value{ font-size: 20px; font-weight: 700; line-height: 1.1; }
.stat-label{ font-size: 12px; color: var(--muted); }
.stat-sub{ font-size: 11px; color: var(--muted); margin-top: 2px; }
a.text-decoration-none .stat-card:hover{ box-shadow: 0 4px 14px rgba(15,23,42,.08); }

/* ---------- Grafik kutuları (Chart.js sonsuz büyüme fix) ---------- */
.chart-box{ position: relative; width: 100%; height: 300px; }
.chart-box canvas{ position: absolute; inset: 0; }
.chart-box-sm{ height: 240px; }
@media (max-width: 575.98px){
  .chart-box{ height: 240px; }
  .chart-box-sm{ height: 220px; }
}

/* ---------- Login ---------- */
.login-page{ background: linear-gradient(135deg, #0f2540, #1d4ed8 60%, #16a34a); min-height: 100vh; }
.login-wrap{ min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.login-card{ background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-brand{ text-align: center; margin-bottom: 22px; }
.login-brand .brand-mark{
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.login-brand h1{ font-size: 19px; margin: 0; }
.login-brand p{ font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.login-footer{ color: rgba(255,255,255,.8); font-size: 12px; margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px){
  .app-sidebar{ transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .app-sidebar.open{ transform: translateX(0); }
  .app-main{ margin-left: 0; }
  .sidebar-backdrop{ position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
}
@media print{
  .app-sidebar, .app-topbar, .app-footer, .page-actions{ display: none !important; }
  .app-main{ margin: 0; }
}

/* ============================================================
   v2 — Profesyonel cila + %100 mobil uyum
   (yalnızca görünüm; hiçbir sayfa mantığına dokunmaz)
   ============================================================ */

/* ---- Form tipografisi & odak ---- */
.form-label{ font-weight: 500; font-size: 12.5px; color: #334155; margin-bottom: 4px; }
.form-text{ font-size: 12px; color: var(--muted); }
.form-control, .form-select{ font-size: 14px; }
.form-control:focus, .form-select:focus{
  border-color: var(--brand);
  box-shadow: 0 0 0 .18rem rgba(13,110,253,.18);
}
.input-group-text{ background: #f8fafc; color: var(--muted); font-weight: 600; }

/* Alt panel (fiyat kutusu vb.) — sert gri yerine yumuşak zemin */
.card-body .border.rounded.bg-light{ background: #f8fafc !important; border-color: var(--border) !important; }

/* ---- Butonlar ---- */
.btn{ font-weight: 500; }
.btn-sm{ --bs-btn-padding-y: .3rem; }
.btn-lg{ --bs-btn-padding-y: .7rem; }

/* ---- Tablolar ---- */
.table-responsive{ -webkit-overflow-scrolling: touch; }
.table-hover > tbody > tr:hover > *{ background: #f6f9ff; }
.table thead th{ white-space: nowrap; }
.card > .table-responsive{ border-radius: 12px; }

/* ---- Kart ritmi ---- */
.card + .card{ margin-top: 16px; }
.card-footer{ padding: .85rem 1rem; }

/* ---- Modal (mobilde tam otursun) ---- */
@media (max-width: 575.98px){
  .modal-dialog{ margin: .5rem; }
  .modal-body{ padding: 1rem; }
}

/* ============================================================
   Tablet ve altı (<= 768px)
   ============================================================ */
@media (max-width: 767.98px){
  body{ font-size: 13.5px; }
  .app-content{ padding: 14px 12px calc(20px + env(safe-area-inset-bottom)); }

  /* Başlık + aksiyonlar alt alta, butonlar tam genişlik */
  .page-header{ gap: 10px; }
  .page-title{ font-size: 17px; }
  .page-actions{ width: 100%; }
  .page-actions > .btn,
  .page-actions > form,
  .page-actions > form > .btn{ flex: 1 1 auto; }

  /* Filtre çubuğu tek sütun, alanlar tam genişlik */
  .filter-bar{ flex-direction: column; align-items: stretch; }
  .filter-bar > *{ width: 100% !important; max-width: none !important; }

  /* Form içi input-group'lar (KDV Dahil/Hariç seçimi vb.) taşmasın */
  .input-group{ flex-wrap: wrap; }
  .input-group > .form-select[style*="max-width"]{ max-width: none !important; flex: 1 0 46% !important; }

  /* Kaydet/Güncelle her zaman elin altında — form kartının alt barı yapışkan */
  form.card > .card-footer{
    position: sticky; bottom: 0; z-index: 20;
    background: var(--card);
    box-shadow: 0 -6px 18px rgba(15,23,42,.08);
    border-top: 1px solid var(--border);
  }
  form.card > .card-footer .btn{ flex: 1 1 auto; }

  /* İstatistik kartları 2'li grid */
  .stat-value{ font-size: 18px; }
  .stat-card{ padding: 12px; }

  /* Topbar: arama kısalsın, boşluklar daralsın */
  .app-topbar{ gap: 8px; padding: 0 10px; }
  .topbar-search{ max-width: none; }
  .app-topbar .btn{ padding: .35rem .55rem; }

  /* Dropdown menüler ekrandan taşmasın */
  .dropdown-menu.notif-menu{ width: min(92vw, 340px) !important; }

  /* Tablo hücrelerinde dokunma hedefi + yatay kaydırma ipucu */
  .table > :not(caption) > * > *{ padding: .55rem .6rem; }
  .card > .table-responsive::-webkit-scrollbar{ height: 6px; }
  .card > .table-responsive::-webkit-scrollbar-thumb{ background: #cbd5e1; border-radius: 3px; }
}

/* ============================================================
   Telefon (<= 576px)
   ============================================================ */
@media (max-width: 575.98px){
  .app-content{ padding: 12px 10px calc(18px + env(safe-area-inset-bottom)); }
  .page-actions{ flex-direction: column; }
  .page-actions > *{ width: 100%; }
  .row.g-3{ --bs-gutter-y: .75rem; }

  /* Dokunma hedefleri en az ~44px */
  .form-control, .form-select, .btn{ min-height: 42px; }
  .btn-sm, .table .btn{ min-height: 36px; }
  .form-control-sm, .form-select-sm{ min-height: 36px; }

  .card{ border-radius: 10px; }
}
