/* ============================================================================
   MOBILE RESPONSIVE  —  yalnızca <= 767px ekranlarda çalışır.
   Tüm kurallar @media (max-width: 767px) içinde olduğundan MASAÜSTÜ (>=768px)
   görünümü HİÇBİR ŞEKİLDE ETKİLENMEZ.  (v: 20260819mob1)
   ============================================================================ */

@media (max-width: 767px) {

  /* ---- 0) Sayfa yatay taşmasını engelle ---- */
  html, body { overflow-x: hidden; max-width: 100%; }
  #page-wrapper { overflow-x: hidden; }

  /* NOT: Sol menü / üst header'a MOBİL ÖZEL bir değişiklik YAPILMAZ — tema varsayılanı korunur
     (kullanıcı orijinal menü davranışını tercih etti). Aşağıdakiler yalnız SAYFA İÇERİĞİ içindir. */

  /* ---- 3) Çok-sütun grid'ler → tek sütun ---- */
  .anasayfa-two-col,.arac-alerts,.arac-charts,.arac-detgrid,.arac-fields,.arac-form-grid,
  .arac-kpis,.cm-charts,.cm-cmpwrap,.cm-kpis,.cm-qgrid,.cm-qk,.cm-qmet,.cp-cmp,.cp-grid2,
  .cp-kpis,.cp-qgrid,.cp-qmet,.det-grid,.doc-grid,.ds-kpis,.dy-grid,.dy-row2,.ed-cat-wrap,
  .ed-list-2col,.env-grid,.env-stats,.hp-lic-grid,.iy-stats,.kd-grid,.kk-grid,.ko-grid,
  .ko-grid-1,.kr-kpis,.kt-widgets,.ku-grid,.lg-cards,.lg-grid2,.lg-kv,.md-builder-split,
  .mr-stats,.mt-grid,.mt-metagrid,.ob-grid2,.ob-row2,.pn-grid2,.pn-kpis,.pr-grid,.pzk-wrap,
  .rap-cards,.sat-actual-grid,.sd-stats,.sh-grid2,.sh-grid3,.sk-buy-grid,.sk-gallery,
  .ssk-hero-kpis,.ssl-kpi-strip,.syh-grid,.syh-tiles,.syt-stats,.syt-stats-4,.vr-dl,
  .vr-row2,.ypl-stats,.zm-stats { grid-template-columns: 1fr !important; }

  /* ---- 4) Tablolar: yatay kaydırma (kart/panel gövdeleri) ---- */
  .table-responsive,.ibox-content,.panel-body,
  .kt-card .table-responsive,.cz-card,.kd-card { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .table-responsive > table,.ibox-content > table { min-width: 560px; }

  /* ---- 5) Modallar tam genişlik ---- */
  .modal-dialog, .modal-lg, .modal-sm { width: auto !important; max-width: none !important; margin: 8px !important; }
  .modal-content { border-radius: 12px; }
  .modal-body { max-height: 78vh; overflow-y: auto; }

  /* ---- 6) Filtre / araç / hero barları sarsın; arama & tarih kutuları tam genişlik ---- */
  .kt-filters,.kt-hero,.cz-filters,.cz-head,.kd-topbar,.kd-tb-actions,.pr-toolbar,
  .arac-toolbar,.env-toolbar,.sk-toolbar,.talep-toolbar,.dy-toolbar { flex-wrap: wrap !important; gap: 8px !important; }
  .kt-fi-search,.pr-search { flex: 1 1 100% !important; min-width: 0 !important; }
  .cz-filters input,.cz-filters select { flex: 1 1 auto; min-width: 0; }

  /* ---- 7) Bootstrap inline formlar mobilde dikey ---- */
  .form-inline .form-group,
  .form-inline .form-control { display: block !important; width: 100% !important; margin-bottom: 8px; }

  /* ---- 8) ÜST HEADER: mobilde sığdır (taşma + çıkış butonu) — SOL MENÜ/SIDEBAR'A DOKUNMAZ ----
       (z-index, off-canvas, hamburger'a müdahale YOK; yalnız başlık+aksiyon barı sığdırılır) */
  .modern-top-bar, .modern-top-bar.app-header { padding: 0 8px !important; }
  /* Başlık esnesin ve gerekiyorsa … ile kısalsın */
  .navbar-header, .app-header-left { min-width: 0 !important; flex: 1 1 auto !important; }
  .app-header-title { flex: 1 1 auto; min-width: 0; max-width: none; font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Sağ aksiyonlar tek satır, sıkışık; ayraç gizli */
  .navbar-right, .app-header-actions { flex: 0 0 auto !important; gap: 1px !important; flex-wrap: nowrap !important; }
  .app-header-actions .hdr-btn { width: 30px !important; height: 30px !important; font-size: 14px !important; }
  .hdr-divider { display: none !important; }
  /* Çıkış: küçük ikon-buton, kaymasın (metin zaten hidden-xs) */
  .hdr-logout { padding: 0 9px !important; height: 30px !important; font-size: 13px !important; gap: 0 !important; }
  .hdr-badge { top: 0; right: -1px; }

  /* ---- 9) Genel: dokunma dostu, taşmayan kartlar ---- */
  .ibox, .panel, .kt-card, .cz-card, .kd-card { max-width: 100%; }
  img { max-width: 100%; height: auto; }

  /* ===== ENVANTER LİSTESİ (demirbaş/aksesuar/lisans/kişiler) ===== */
  .env-filterbar { gap: 8px !important; }
  .env-search { flex: 1 1 100% !important; }
  .env-filterbar .env-sel { flex: 1 1 calc(50% - 5px) !important; width: auto !important; min-width: 0 !important; height: 40px; }
  .env-viewtoggle, .env-clearbtn { flex: 0 0 auto; }
  .env-viewtoggle button { width: 42px; height: 40px; }
  .env-listhead { flex-wrap: wrap; gap: 4px; }
  /* Kart görünümü tek sütun (dokunmaya uygun) */
  .env-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  /* Liste görünümü tablosu: rahat kaydırma */
  .env-table { min-width: 640px; }
  .env-pager { gap: 10px !important; padding: 14px 6px !important; }

  /* ============================================================
     TÜM MODÜLLER — genel mobil desenler (sonek-selektörleriyle)
     Ana Sayfa, Çözüm Merkezi, Envanter, Stok, Talep, Araç,
     Öneri&Şikayet, Duyurular, 4F ve tüm diğer sayfaları kapsar.
     ============================================================ */

  /* Başlık / araç çubuğu / filtre / hero / aksiyon barları alt alta sarsın */
  [class$="-head"], [class$="-hero"], [class$="-toolbar"], [class$="-filterbar"],
  [class$="-filters"], [class$="-actions"], [class$="-topbar"], [class$="-toparea"],
  .page-head, .form-actions, .btn-group {
    flex-wrap: wrap !important;
  }

  /* Arama kutuları tam genişlik */
  [class$="-search"] { flex: 1 1 100% !important; min-width: 0 !important; width: 100% !important; }
  [class$="-search"] input, [class$="-search"] .form-control { width: 100% !important; }

  /* Filtre select/inputları viewport'u taşmasın */
  select.form-control, input.form-control, textarea.form-control { max-width: 100%; }
  [class$="-sel"], [class$="-select"] { min-width: 0 !important; }

  /* TÜM modül tabloları yatay kaydırılabilir olsun (kolonlar hizalı kalır) */
  [class$="-table"], [class$="-tbl"], table.table {
    display: block !important; width: 100% !important; overflow-x: auto !important;
    white-space: nowrap; -webkit-overflow-scrolling: touch;
  }

  /* Sayfalama ortalı + sarsın */
  [class$="-pager"], .pagination { flex-wrap: wrap !important; justify-content: center; }

  /* Kart/panel gövdeleri: içeriği taşırma */
  [class$="-card"], [class$="-panel"], [class$="-box"], .ibox-content, .panel-body { max-width: 100%; }

  /* Butonları dokunmaya uygun; toolbar butonları sarsın */
  .btn { touch-action: manipulation; }

  /* Bootstrap satır/sütunlar zaten col-xs ile alt alta; ekstra: form label üstte */
  .control-label { text-align: left !important; }

  /* ===== STOK LİSTESİ (ürünler) ===== */
  .sk-search { flex: 1 1 100% !important; }
  .sk-filterbar .sk-field { flex: 1 1 calc(50% - 5px) !important; min-width: 0 !important; }
  .sk-filterbar .sk-field .form-control, .sk-filterbar .sk-sel { min-width: 0 !important; width: 100% !important; }
  .sk-searchbtn, .sk-clearbtn { flex: 1 1 auto !important; height: 40px !important; }
  .sk-head-actions { width: 100%; }
  .sk-head-actions .btn { flex: 1 1 auto; }
  /* 15 kolonlu tablo rahat kaydırılsın */
  .sk-table { min-width: 900px; }
  .sk-thumb { width: 34px; height: 34px; }

  /* ===== TALEP LİSTESİ (Satın Alma Talepleri) ===== */
  .tlp-search { flex: 1 1 100% !important; min-width: 0 !important; }
  .tlp-filters select { flex: 1 1 calc(50% - 5px) !important; min-width: 0 !important; }
  .tlp-clear { flex: 0 0 auto; }
  .tlp-actions { width: 100%; }
  .tlp-actions .tlp-btn { width: 100%; justify-content: center; }
  .tlp-table { min-width: 600px; }
  .tlp-foot { flex-wrap: wrap; }

  /* ===== ARAÇ YÖNETİM LİSTESİ ===== */
  .arac-search { flex: 1 1 100% !important; }
  .arac-filterbar .arac-sel { flex: 1 1 calc(50% - 5px) !important; min-width: 0 !important; width: auto !important; }
  .arac-clearbtn { flex: 1 1 auto; }
  .arac-head-actions { width: 100%; }
  .arac-head-actions .arac-btn { flex: 1 1 auto; justify-content: center; }
  .arac-table { min-width: 720px; }

  /* ===== ÖNERİ & ŞİKAYET (Dilek & Şikayet) LİSTESİ ===== */
  .ds-hero { flex-wrap: wrap; }
  .ds-hero-actions { width: 100%; margin-top: 8px; }
  .ds-hero-actions .ds-btn { width: 100%; justify-content: center; }
  .ds-filters { display: flex !important; flex-wrap: wrap !important; gap: 8px; }
  .ds-filters .ds-sel { max-width: none !important; min-width: 0 !important; }
  .ds-filters select.ds-sel { flex: 1 1 calc(50% - 4px) !important; width: auto !important; }
  .ds-filters input.ds-sel { flex: 1 1 100% !important; }
  .ds-filters .ds-btn { flex: 1 1 auto !important; }
  /* ds-list bir <table> ama '-list' ile bittiğinden genel tablo kuralına takılmaz → burada kaydır */
  .ds-list { display: block !important; overflow-x: auto !important; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* ===== DUYURULAR LİSTESİ ===== */
  .dy-head { flex-wrap: wrap; }
  .dy-head .dy-btn { width: 100%; justify-content: center; margin-top: 6px; }
  .dy-tbl { min-width: 640px; }

  /* ===== ÇÖZÜM MERKEZİ — BAŞVURULAR ===== */
  .cm-cards { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .cm-filters { display: flex !important; flex-wrap: wrap !important; gap: 8px; }
  .cm-filters input.grow, .cm-filters input[type="text"] { flex: 1 1 100% !important; min-width: 0 !important; }
  .cm-filters select { flex: 1 1 calc(50% - 4px) !important; min-width: 0 !important; }
  .cm-filters .cm-btn { flex: 1 1 auto !important; }
  .cm-table { min-width: 720px; }
  .cm-foot { flex-wrap: wrap; justify-content: center; }

  /* ===== ÇÖZÜM MERKEZİ — cz-* ortak (Bilgi Havuzu, Kanal, Kalite, Geri Bildirim, Mola, Anket…) ===== */
  .cz-head { flex-wrap: wrap; }
  .cz-head .cz-btn { flex: 1 1 auto; justify-content: center; }
  .cz-filters { flex-wrap: wrap; gap: 8px; }
  .cz-filters .grow, .cz-filters input, .cz-filters select { flex: 1 1 100% !important; min-width: 0 !important; width: 100% !important; }
  .cz-filters .cz-btn { flex: 1 1 auto !important; }
  .cz-filters .cz-sub { flex: 1 1 100% !important; text-align: left; }
  .cz-foot { flex-wrap: wrap !important; justify-content: center; gap: 8px; }
  /* cz-table (varsa) genel kurala zaten girer; kart listeleri (cz-card) doğal olarak stacklenir */

  /* ===== ÇÖZÜM MERKEZİ — KALAN SAYFALAR =====
     Kalite/Kriterler = cz-* (kapsandı). Gelen Kutusu = kendi @media(760px) stack'i (kapsandı).
     Çağrı Panosu/Pano/Rehber = -head/-search/-table/-tbl/-filters/-pager + grid-collapse (kapsandı).
     Tek istisna: '-table' ile bitmeyen operatör tablosu → */
  .cp-optable { display: block !important; overflow-x: auto !important; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* ===== ANA SAYFA (Dashboard) ===== */
  .modul-data-grid { grid-template-columns: 1fr !important; }
  .as-hero { flex-wrap: wrap; }
  .as-hero-right { align-items: flex-start !important; width: 100%; }
  .as-cta { align-self: flex-start; }
}

/* ===== LOGIN (giriş) — tek merkezli kart; mobilde padding/logo küçült ===== */
@media (max-width: 767px) {
  .login-wrapper { padding: 14px !important; }
  .modern-login-container { padding: 26px 18px !important; max-width: 100% !important; }
  .login-logo { max-width: 200px !important; }
  .login-brand-title { font-size: 21px !important; }
}
