/* ============================================================
 *  custom-fixes.css  —  Hedefli arayuz duzeltmeleri (v2)
 *  Konum: public_html/assets/custom-fixes.css
 *  YUKLEME: index.html icinde app.css'ten SONRA yuklenir.
 *  app.css'i DEGISTIRMEZ; uzerine yazar.
 *
 *   A) Denetimler (ve tum liste sayfalari): baslik + butonlar ic ice gecmesi
 *   B) Mobilde tum modullerde kartlar arasi bosluk
 *   C) Mobilde gereksiz fazla alt bosluk
 * ============================================================ */


/* ------------------------------------------------------------
 *  A) BASLIK + BUTONLAR IC ICE GECMESI  (web)
 *  Denetimler basliginda 7 buton var (Uygunsuzluk Cozum Raporu,
 *  Analiz, Sorular, Kategoriler, Aksiyon Secenekleri, Aksiyonlar,
 *  Yeni Denetim). Bunlar baslikla ayni satirda sikisip ic ice
 *  giriyordu.
 *  KESIN COZUM: baslik 1. satirda tek basina; butonlar HER ZAMAN
 *  alt satira gecip kendi aralarinda sarar. Boylece ic ice gecme
 *  matematiksel olarak imkansiz olur.
 * ------------------------------------------------------------ */
.page-head{
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  row-gap: 14px !important;
}
.page-head__left{
  flex: 1 1 100% !important;   /* baslik tek basina ust satirda */
  min-width: 0 !important;
  max-width: 100% !important;
}
.page-head > .btn-group{
  flex: 1 1 100% !important;   /* butonlar daima alt satirda */
  width: 100% !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 8px !important;
}
.page-head > .btn-group > .btn{
  flex: 0 0 auto !important;   /* butonlar dogal genislikte, gerinmez */
  width: auto !important;
}


/* ============================================================
 *  MOBIL  (alt menunun goruldugu kirilim: <= 767px)
 * ============================================================ */
@media (max-width: 767px){

  /* --- B) TUM MODULLERDE KARTLAR ARASI BOSLUK --- */
  .p-list, .lv-list, .us-list, .sr-list,
  .eq-list, .in-list, .ts-list,
  .rdl-cards, .ncr-cards, .rc-cards{
    gap: 12px !important;
  }

  /* Liste kabugu (lps-card) mobilde saydam kapsayici olur. */
  .lps-card{
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  /* Her satir tekrar bagimsiz, aralikli KART olur. */
  .lps-card .p-row,  .lps-card .lv-row,  .lps-card .us-row,  .lps-card .sr-row,
  .p-row, .lv-row, .us-row, .sr-row{
    background: var(--color-white) !important;
    border: 1px solid var(--border) !important;
    border-radius: 14px !important;
    box-shadow: var(--shadow-sm) !important;
    border-bottom: 1px solid var(--border) !important;
  }

  /* --- C) GEREKSIZ FAZLA ALT BOSLUK --- */
  .app-main{
    padding-bottom: 0 !important;
  }
  .app-content{
    padding-bottom: calc(var(--bottomnav-height) + var(--safe-bottom) + 12px) !important;
  }
}


/* ============================================================
 *  D) MOBIL UST BUTONLAR + UST KART  (v3 — en sona eklendi)
 *  Konum: public_html/assets/custom-fixes.css
 *
 *  Bu blok, yukaridaki global ".page-head > .btn-group > .btn{width:auto}"
 *  kuralini SADECE MOBILDE ezer (en altta + media query + !important).
 *   1) Ust aksiyon butonlari -> tek sutun, TAM GENISLIK, hepsi ESIT
 *   2) Ust kisim (baslik + butonlar) -> ayri KART
 *   3) Arama/filtre kartlari arasi TEK-TIP 14px bosluk
 *  PDF/XLSX/XLS/CSV ve Import butonlarina dokunmaz (onlar .btn-group degil).
 * ============================================================ */
@media (max-width: 767px){

  /* (2) UST KISIM -> KART */
  .page-head{
    flex-direction: column !important;
    align-items: stretch !important;
    row-gap: 14px !important;
    background: var(--color-white) !important;
    border: 1px solid var(--border) !important;
    border-radius: 14px !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 16px 14px !important;
    margin-bottom: 14px !important;
  }
  .page-head__left{
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  /* (1) UST BUTONLAR -> tek sutun, tam genislik, ESIT en/boy */
  .page-head > .btn-group{
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    gap: 10px !important;
    margin: 0 !important;
  }
  .page-head > .btn-group > .btn{
    width: 100% !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    min-height: 46px !important;
    margin: 0 !important;
    justify-content: center !important;
  }

  /* (3) ARAMA/FILTRE KARTLARI ARASI ESIT 14px BOSLUK */
  .lps-card > .p-toolbar,  .lps-card > .p-filters,
  .lps-card > .lv-toolbar, .lps-card > .lv-filters,
  .lps-card > .in-toolbar, .lps-card > .in-filters,
  .lps-card > .us-toolbar, .lps-card > .us-filters,
  .lps-card > .sr-toolbar, .lps-card > .sr-filters,
  .lps-card > .ts-toolbar, .lps-card > .ts-filters,
  .lps-card > .eq-toolbar, .lps-card > .eq-filters{
    margin-bottom: 14px !important;
  }
}

/* ============================================================
 *  E) WEB (MASAUSTU) TABLO ISLEMLER SUTUNU  (v5 — duzeltildi)
 *  SADECE >=769px. Mobil (<=768px) HIC ETKILENMEZ.
 *
 *  ESKI SORUN: ".lps-web .rdl-table td{max-width:240px;overflow:hidden}"
 *  Islemler hucresini kirpiyordu. v4'te overflow:visible+width:1% verince
 *  bu kez ikonlar komsu sutunlarin (Isbasi/Durum) ustune TASTI.
 *
 *  KESIN COZUM: Islemler sutununa, onay bekleyen satirdaki 5 ikonu
 *  (Goruntule / Onayla / Reddet / Duzenle / Sil) rahat alacak SABIT
 *  genislik ver; ikonlar tek sirada, saga yasli; ne kirpilir ne tasar.
 *  Daha fazla ikon olursa sutun buyur (max-width yok), yine tasmaz.
 * ============================================================ */
@media (min-width: 769px){

  /* Islemler sutunu: yeterli genislik, kirpma yok, tasma yok */
  .lps-web .rdl-table th.rdl-th-actions,
  .lps-web .rdl-table td.rdl-td-actions{
    min-width: 240px !important;
    max-width: none !important;
    width: 240px !important;
    overflow: visible !important;
    white-space: nowrap !important;
    text-align: right !important;
    padding-left: 8px !important;
    padding-right: 14px !important;
  }

  /* Ikon grubu: tek sira, saga yasli, esit araliklar */
  .rdl-td-actions .lps-actions{
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
  }

  /* Ikonlar tek tip ve kompakt -> hepsi sutuna sigar */
  .rdl-td-actions .lps-actions .btn-icon{
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    flex: 0 0 34px !important;
  }
}
