/* HalkaWeb DevX-tarzı tablo teması: hw-table görünümüyle uyumlu, modern DataTables stilleri */

.hw-dt-toolbar {
    padding: 0.75rem 1rem;
    gap: 0.6rem;
}

/* Kart başlığı (varsa) + arama + Sütunlar/Excel/PDF/Yazdır TEK satırda —
   kullanıcı isteği (05.08.2026). hw-datatable.js bu bloğu (class="hw-dt-card-title")
   DataTables init sonrası araç çubuğunun İLK öğesi yapıp .hw-dt-title-merged
   ekliyor; burada onu sola sabitleyip geri kalan grupları (arama/butonlar) sağa
   itiyoruz. JS henüz taşımadan ÖNCEki (başlangıç) hâli — kendi satırında,
   alt çizgili — .hw-dt-card-title kuralı karşılıyor.*/
.hw-dt-card-title {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--hw-border);
}
.hw-dt-toolbar .hw-dt-title-merged {
    padding: 0;
    border-bottom: 0;
    margin-right: auto;
    flex-shrink: 0;
}
.hw-dt-toolbar:has(.hw-dt-title-merged) {
    justify-content: flex-start;
}

/* --- Araç çubuğu butonları (Sütunlar / Excel / Yazdır) --- */
.dt-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Not: Butonlar Master Toolbar'a taşındığında div.dt-container dışında kalıyorlar.
   Bu yüzden genel .dt-buttons seçicisi kullanıyoruz. Tüm sayfalarda outline
   görünümünü zorlamak için background-color ve border netleştirildi. */
.dt-buttons button, button.dt-button {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.9rem !important;
    font-size: 0.8rem !important;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 0.55rem !important;
    border: 1px solid transparent;
    background-color: #fff !important;
    background: #fff !important;
    background-image: none !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    transition: all 0.12s ease;
    opacity: 1 !important;
}

.dt-buttons button:hover, button.dt-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
}

/* Sütunlar (colvis) — Outline */
.dt-buttons button.buttons-colvis, button.buttons-colvis {
    border-color: #dfe3ea !important;
    color: #475467 !important;
}
.dt-buttons button.buttons-colvis:hover, button.buttons-colvis:hover {
    background-color: #f8f9fc !important;
    background: #f8f9fc !important;
    border-color: #c7cdd9 !important;
}

/* Excel — Yeşil Outline */
.dt-buttons button.buttons-excel, button.buttons-excel {
    border-color: #16a34a !important;
    color: #16a34a !important;
}
.dt-buttons button.buttons-excel:hover, button.buttons-excel:hover {
    background-color: #f0fdf4 !important;
    background: #f0fdf4 !important;
}

/* PDF — Kırmızı Outline */
.dt-buttons button.buttons-pdf, button.buttons-pdf {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}
.dt-buttons button.buttons-pdf:hover, button.buttons-pdf:hover {
    background-color: #fef2f2 !important;
    background: #fef2f2 !important;
}

/* Yazdır — Mavi Outline */
.dt-buttons button.buttons-print, button.buttons-print {
    border-color: var(--hw-primary, #2b5aa8) !important;
    color: var(--hw-primary, #2b5aa8) !important;
}
.dt-buttons button.buttons-print:hover, button.buttons-print:hover {
    background-color: #f8faff !important;
    background: #f8faff !important;
}

/* "Diğer" toplu açılır menüsü — Sütunlar/Excel/PDF/Yazdır tek buton altında.
   Tasarım/renk (kullanıcı isteği, 16.08.2026: "diğer buton tasarım ve rengini
   değiştir"): önceki koyu-mor gradyan+beyaz metin açık durumu göz yorucu ve
   diğer renkli aksiyon butonlarıyla ("Onayla/Reddet/Arşivle" vb.) çakışıyordu
   — artık nötr kart yüzeyi + sadece açıkken ince marka rengi vurgusu. */
.dt-buttons button.hw-dt-more-btn, button.hw-dt-more-btn {
    border-color: var(--hw-border) !important;
    background: var(--hw-card-bg) !important;
    color: var(--hw-text, #3d4257) !important;
    font-weight: 600;
}
.dt-buttons button.hw-dt-more-btn:hover, button.hw-dt-more-btn:hover {
    background: var(--hw-bg) !important;
    border-color: var(--hw-primary, #4f46e5) !important;
    color: var(--hw-primary, #4f46e5) !important;
}
.dt-buttons button.hw-dt-more-btn[aria-expanded="true"], button.hw-dt-more-btn[aria-expanded="true"] {
    background: color-mix(in srgb, var(--hw-primary, #4f46e5) 12%, var(--hw-card-bg)) !important;
    border-color: var(--hw-primary, #4f46e5) !important;
    color: var(--hw-primary, #4f46e5) !important;
    box-shadow: 0 4px 14px rgba(16, 24, 40, .1) !important;
}
/* Açılır menü kartı — daha "pro" görünüm için hafif büyütülmüş gölge/radius. */
div.dt-button-collection {
    box-shadow: 0 16px 36px rgba(16, 24, 40, 0.16), 0 2px 8px rgba(16, 24, 40, 0.08);
    overflow: visible; /* hw-colvis-flyout dışarı taşabilsin */
}

/* "Sütunlar" hover-flyout (11.08.2026) — DataTables'ın collection mekanizması
   yerine saf CSS :hover; böylece "Diğer" popup'ı asla kaldırılmıyor (Yazdır/
   Excel/PDF kaybolmuyor), açılış üzerine gelince oluyor, sol ok gösteriyor,
   aşağı ok yok (bkz. hw-datatable.js buildFlyout). */
.hw-colvis-wrap {
    position: relative;
}
.hw-colvis-wrap > button.hw-colvis-trigger {
    width: 100%;
}
.hw-colvis-caret {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: auto;
    padding-left: .5rem;
}
div.dt-button-collection button.hw-colvis-trigger {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
}
.hw-colvis-flyout {
    display: none;
    position: absolute;
    top: 0;
    right: 100%;
    margin-right: 6px;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border-radius: 0.65rem;
    border: 1px solid #eef1f7;
    box-shadow: 0 16px 36px rgba(16, 24, 40, 0.16), 0 2px 8px rgba(16, 24, 40, 0.08);
    padding: 0.4rem;
    z-index: 1;
}
/* NOT (30.08.2026, kullanıcı bildirimi: "sütunlar alt menülerine geçerken
   hemen kayboluyor"): saf CSS :hover'a ("wrap:hover flyout" + "flyout:hover")
   güvenmek, wrap'ın kendi kutusu (yalnızca buton genişliği) ile flyout'un
   6px'lik margin-right boşluğu arasında bir "ölü bölge" oluşturuyordu —
   imleç bu boşluğu geçerken bir an için ne wrap'ın ne de flyout'un üzerinde
   olmuyor, :hover anında düşüyor, flyout display:none oluyor ve display:none
   bir öğe artık :hover alamadığından bir daha asla açılamıyordu. Kalıcı çözüm:
   görünürlük artık salt CSS değil, JS'in (hw-datatable.js) gecikmeli
   mouseenter/mouseleave ile eklediği/kaldırdığı .hw-colvis-show sınıfına
   bağlı — böylece boşluğu geçerken kısa süreli "hover kaybı" görmezden
   gelinir (bkz. aşağıdaki dosyanın JS tarafı, ~365. satır civarı). */
.hw-colvis-wrap.hw-colvis-show .hw-colvis-flyout {
    display: block;
}
/* Dar ekranlarda sol tarafta yer yoksa flyout sağa açılır (hw-datatable.js
   mouseenter ölçümüyle eklenen sınıf) — bkz. kullanıcı bildirimi 11.08.2026:
   "tıklanınca menü okunmuyor". */
.hw-colvis-wrap.hw-colvis-open-right .hw-colvis-flyout {
    right: auto;
    left: 100%;
    margin-right: 0;
    margin-left: 6px;
}

/* Sütun başlığına sağ tık → "Sütunu Gizle" bağlam menüsü (kullanıcı isteği,
   30.08.2026: "tüm sütunların üzerine sağ tıklanıp gizle çıksın"). */
.hw-col-ctx-menu {
    position: fixed;
    z-index: 2000;
    background: #fff;
    border: 1px solid #eef1f7;
    border-radius: 0.6rem;
    box-shadow: 0 16px 36px rgba(16, 24, 40, 0.16), 0 2px 8px rgba(16, 24, 40, 0.08);
    padding: 0.3rem;
    min-width: 170px;
}
.hw-col-ctx-menu button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    color: #344054;
    border-radius: 0.4rem;
    cursor: pointer;
}
.hw-col-ctx-menu button:hover {
    background: #f0f1fb;
    color: var(--hw-primary, #4f46e5);
}
[data-theme='dark'] .hw-col-ctx-menu {
    background: #111827;
    border-color: #1f2937;
}
[data-theme='dark'] .hw-col-ctx-menu button {
    color: #cbd2e6;
}
[data-theme='dark'] .hw-col-ctx-menu button:hover {
    background: #1e2436;
}
.hw-colvis-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    color: #344054;
    border-radius: 0.4rem;
    cursor: pointer;
    margin: 0;
}
.hw-colvis-item:hover {
    background: #f0f1fb;
    color: var(--hw-primary, #4f46e5);
}
.hw-colvis-item input {
    margin: 0;
    accent-color: var(--hw-primary, #4f46e5);
}

[data-theme='dark'] .hw-colvis-flyout {
    background: #111827;
    border-color: #1f2937;
}
[data-theme='dark'] .hw-colvis-item {
    color: #cbd2e6;
}
[data-theme='dark'] .hw-colvis-item:hover {
    background: #1e2436;
}

[data-theme='dark'] .dt-buttons button.hw-dt-more-btn, [data-theme='dark'] button.hw-dt-more-btn {
    background: var(--hw-card-bg) !important;
    border-color: var(--hw-border) !important;
    color: var(--hw-text) !important;
}
[data-theme='dark'] .dt-buttons button.hw-dt-more-btn[aria-expanded="true"], [data-theme='dark'] button.hw-dt-more-btn[aria-expanded="true"] {
    background: color-mix(in srgb, var(--hw-primary) 16%, var(--hw-card-bg)) !important;
    border-color: var(--hw-primary) !important;
    color: var(--hw-primary) !important;
}

div.dt-container .dt-buttons button i {
    font-size: 0.9rem;
}

/* Sütun gizleme açılır menüsü */
div.dt-button-collection {
    padding: 0.4rem;
    border-radius: 0.65rem;
    border: 1px solid #eef1f7;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
    /* DataTables varsayılanı sabit 200px genişlik veriyor; "Excel'den Stok
       Yükle" / "Mükerrer Stok Birleştir" gibi uzun etiketler bu genişlikte
       "..." ile kırpılıyordu (kullanıcı bildirimi, 11.08.2026: "tam
       okunmuyor"). min-width ile daha geniş bir taban veriyoruz, yine de
       gerekirse satır kırılsın diye butonlarda white-space:normal var. */
    min-width: 235px;
}
div.dt-button-collection button {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0.4rem;
    padding: 0.45rem 0.7rem !important;
    font-size: 0.82rem !important;
    color: #344054 !important;
    text-align: left;
    width: 100%;
    white-space: normal !important;
    text-overflow: unset !important;
    overflow: visible !important;
    line-height: 1.3;
}
div.dt-button-collection button:hover {
    background: #f0f1fb !important;
    color: var(--hw-primary, #4f46e5) !important;
}
div.dt-button-collection button.dt-button-active {
    background: var(--hw-primary, #4f46e5) !important;
    color: #fff !important;
}
div.dt-button-collection button.dt-button-active::before {
    content: "\2713  ";
}
/* "Diğer" menüsünden açılan Yazdır/Excel/PDF alt paneli (dt-button-collection)
   koyu temada da hep beyaz kalıyordu — hiç dark-theme kuralı yoktu (kullanıcı
   bildirimi, 12.08.2026). */
[data-theme='dark'] div.dt-button-collection {
    background: #111827 !important;
    border-color: #1f2937 !important;
}
[data-theme='dark'] div.dt-button-collection button {
    background: #111827 !important;
    color: #cbd2e6 !important;
}
[data-theme='dark'] div.dt-button-collection button:hover {
    background: #1e2436 !important;
    color: var(--hw-primary, #4f46e5) !important;
}

/* --- Canlı arama kutusu --- */
.hw-dt-toolbar .dt-search {
    display: flex;
    align-items: center;
}
.hw-dt-toolbar .dt-search label {
    display: none;
}
.hw-dt-toolbar .dt-search input {
    border-radius: 0.6rem;
    border: 1px solid #dfe3ea;
    padding: 0.42rem 0.75rem 0.42rem 2.1rem;
    font-size: 0.83rem;
    min-width: 230px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2398a2b3' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='5.2'/%3E%3Cline x1='11' y1='11' x2='14.5' y2='14.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0.7rem center;
    background-size: 15px 15px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hw-dt-toolbar .dt-search input:focus {
    outline: none;
    border-color: var(--hw-primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}
.hw-dt-toolbar .dt-search input::placeholder {
    color: #98a2b3;
}

[data-theme='dark'] .hw-dt-toolbar .dt-search input {
    background-color: #111827;
    border-color: #1f2937;
    color: #e5e7eb;
}

/* JS'te autoWidth:false verilse de eski bir DataTables sürümü ya da iframe'in
   ilk (gizliyken) init anında hesapladığı bir inline stil kalırsa diye son
   güvence: tablo her zaman kapsayıcısının tam genişliğini kaplasın. */
table.dataTable.hw-table {
    width: 100% !important;
}

/* --- Tablo başlığı --- */
table.dataTable.hw-table thead th {
    background: #f8f9fc;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: #667085;
    border-bottom: 1px solid #eef1f7;
    white-space: nowrap;
}

table.dataTable.hw-table thead th.dt-orderable-asc:hover,
table.dataTable.hw-table thead th.dt-orderable-desc:hover {
    color: var(--hw-primary, #4f46e5);
    background: #f0f1fb;
}

/* --- Filtre satırı (sütun bazlı) --- */
table.dataTable .hw-dt-filter-row th {
    padding: 0.4rem 0.45rem;
    background: #fbfbfe;
    border-bottom: 1px solid #eef1f7;
}

table.dataTable .hw-dt-filter-input {
    width: 100%;
    font-size: 0.78rem;
    padding: 0.32rem 0.6rem 0.32rem 1.75rem;
    border: 1px solid #e3e6ef;
    border-radius: 0.45rem;
    color: #344054;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23a4acb9'%3E%3Cpath d='M1 2h14l-5.5 6.2V13l-3 2V8.2L1 2z'/%3E%3C/svg%3E") no-repeat 0.5rem center;
    background-size: 11px 11px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
table.dataTable .hw-dt-filter-input::placeholder {
    color: #b0b7c3;
    font-style: italic;
}
table.dataTable .hw-dt-filter-input:hover {
    border-color: #c7cdd9;
}
table.dataTable .hw-dt-filter-input:focus {
    outline: none;
    border-color: var(--hw-primary, #4f46e5);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
table.dataTable .hw-dt-filter-input:not(:placeholder-shown) {
    border-color: var(--hw-primary, #4f46e5);
    background-color: #f5f5ff;
    font-weight: 600;
}

[data-theme='dark'] table.dataTable .hw-dt-filter-row th { background: #0f172a; border-color: #1f2937; }
[data-theme='dark'] table.dataTable .hw-dt-filter-input { background-color: #111827; border-color: #1f2937; color: #e5e7eb; }
[data-theme='dark'] table.dataTable .hw-dt-filter-input:not(:placeholder-shown) { background-color: #1e1b4b; }
[data-theme='dark'] table.dataTable.hw-table thead th { background: #0f172a; color: #9ca3af; border-color: #1f2937; }

/* --- Diğer --- */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before {
    background-color: var(--hw-primary, #4f46e5);
}

table.dataTable tbody tr.dtrg-group td {
    background: #f8f9fc;
    font-weight: 600;
    color: #374151;
}

/* --- Boş durum (hiç kayıt yokken) — Paraşüt örnek alındı, 06.08.2026 --- */
table.dataTable tbody tr.odd.no-records-found td.dataTables_empty,
table.dataTable tbody td.dataTables_empty {
    padding: 0 !important;
    border-bottom: none !important;
}
.hw-dt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    gap: .35rem;
}
.hw-dt-empty i {
    font-size: 2.4rem;
    color: #c7cdd9;
    margin-bottom: .5rem;
}
.hw-dt-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: #344054;
}
.hw-dt-empty-desc {
    font-size: .85rem;
    color: #98a2b3;
    max-width: 380px;
}

[data-theme='dark'] .hw-dt-empty i { color: #374151; }
[data-theme='dark'] .hw-dt-empty-title { color: #e5e7eb; }
[data-theme='dark'] .hw-dt-empty-desc { color: #6b7280; }
