/* ==========================================================================
   BM DataTables Override
   jQuery DataTables (jquery.dataTables.min.css + buttons.dataTables.min.css)
   default stillerini site palet'ine (bordo primary + kompakt modern görünüm)
   uyumlu hale getirir. Özellikler (search, sort, page, buttons) korunur;
   yalnızca görsel düzen değiştirilir.
   ========================================================================== */


/* ---------- Wrapper & spacing ---------- */

.dataTables_wrapper {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Excel tarzı resize: kolon büyütüldüğünde table wrapper'dan taşarsa yatay scroll çıksın */
.bm-table-wrap {
    overflow-x: auto;
    max-width: 100%;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-family: inherit;
    color: #495057;
    padding: .4rem 0;
}


/* ---------- Length selector ("Show X entries") ---------- */

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info {
    font-size: .78rem;
}

.dataTables_wrapper .dataTables_length select {
    padding: .15rem .4rem;
    font-family: inherit;
    font-size: .78rem;
    line-height: 1.2;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: #fff;
    min-width: 56px;
    margin: 0 .3rem;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: 0;
    border-color: var(--bs-primary, #8a0d1e);
    box-shadow: 0 0 0 .15rem rgba(var(--bs-primary-rgb, 138, 13, 30), .18);
}


/* ---------- Search input ---------- */

.dataTables_wrapper .dataTables_filter input {
    padding: .2rem .5rem;
    font-family: inherit;
    font-size: .78rem;
    line-height: 1.2;
    border: 1px solid #ced4da;
    border-radius: 5px;
    margin-left: .4rem;
    min-width: 160px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: 0;
    border-color: var(--bs-primary, #8a0d1e);
    box-shadow: 0 0 0 .15rem rgba(var(--bs-primary-rgb, 138, 13, 30), .18);
}


/* ---------- Table shell ---------- */

/* Card-like row paterni: İşletme rotaları/durak ayarları tablosu gibi
   Her satır ayrı bir küçük kart, aralarında hafif boşluk. */
table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0 2px !important;     /* satırlar arası boşluk: 3 → 2px (daha sık) */
    width: 100%;
    margin: .15rem 0 !important;
    border: 0;
    background: transparent;
    /* table-layout: auto (default) — page'lerin column-width yapılarını bozmasın.
       Resize sırasında bm-datatables.js dinamik olarak 'fixed'e alıyor. */
}

/* Header — sıfırdan minimal tasarım, kompakt + tüm sayfalarda tek tip */
table.dataTable thead th,
table.dataTable thead td {
    background: #f8f9fa;
    color: #495057;
    font-family: inherit;
    font-weight: 600;
    font-size: .75rem;                     /* .82 → .75 */
    padding: .35rem .55rem;                /* .5/.65 → .35/.55 */
    border-bottom: 1px solid #dee2e6;
    text-align: left !important;           /* DataTables 2.x ve Bootstrap utility'lerini ez */
    line-height: 1.2;
    /* Header her zaman tek satır + sığmazsa ellipsis. Bazı sayfalarda wrap olup
       header'ın yüksekliğini artırması yerine "..." ile kesilir, tüm header'lar
       aynı yükseklikte kalır. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* DataTables 2.x TH içeriğini <div class="dt-column-header"> + <span class="dt-column-title">
   + <span class="dt-column-order"> şeklinde sarmalıyor. Title sığmazsa ellipsize olsun,
   sort arrow her zaman görünsün. */
table.dataTable thead th .dt-column-header,
table.dataTable thead td .dt-column-header {
    display: flex;
    align-items: center;
    gap: .25rem;
    min-width: 0;
}

table.dataTable thead th .dt-column-title,
table.dataTable thead td .dt-column-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    vertical-align: middle;
}

/* Sort arrow her zaman görünür (clip olmasın) */
table.dataTable thead th .dt-column-order,
table.dataTable thead td .dt-column-order {
    flex: 0 0 auto;
}

/* DataTables 2.x son kolonu / actions kolonunu sağa yaslayan iç class'ları da ez */
table.dataTable thead th.bm-actions-col,
table.dataTable thead th.text-end,
table.dataTable thead th.text-right,
table.dataTable thead th.text-center,
table.dataTable thead th.text-start,
table.dataTable thead th[class*="dt-"] {
    text-align: left !important;
}

table.dataTable thead tr th:first-child {
    border-top-left-radius: 6px;
}
table.dataTable thead tr th:last-child {
    border-top-right-radius: 6px;
}

/* Body satırları — her biri card */
table.dataTable tbody tr {
    background: #fff;
    transition: background-color .12s, box-shadow .12s;
}

table.dataTable tbody td {
    padding: .2rem .55rem !important;      /* .28/.6 → .2/.55 (~%25 daha sık) */
    font-family: inherit;
    font-size: .78rem;                     /* inherit yerine sabit küçük */
    line-height: 1.2;
    vertical-align: middle;
    border: 0 !important;
    border-top: 1px solid rgba(0, 0, 0, .06) !important;
    border-bottom: 1px solid rgba(0, 0, 0, .06) !important;
    /* DEFAULT: uzun text taşmasın. table-layout: fixed varsa otomatik kesilir.
       Auto-layout'ta cell width'i içerikten geliyorsa ellipsis çalışmayabilir;
       bu durumlarda kolon width'i set edilmiş sayfalarda yine de devreye girer. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Action / button / dropdown / form içeren hücreler — clip ediLMEsin (modern :has()) */
table.dataTable tbody td.bm-actions-col,
table.dataTable tbody td:has(.dropdown),
table.dataTable tbody td:has(.btn-group),
table.dataTable tbody td:has(button),
table.dataTable tbody td:has(.badge),
table.dataTable tbody td:has(input),
table.dataTable tbody td:has(select) {
    overflow: visible;
    white-space: normal;
}

/* Opt-out: kolon zorla wrap yapsın */
table.dataTable tbody td.bm-cell-wrap {
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
}

table.dataTable tbody td:first-child {
    border-left: 1px solid rgba(0, 0, 0, .06) !important;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
table.dataTable tbody td:last-child {
    border-right: 1px solid rgba(0, 0, 0, .06) !important;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Hover — çok hafif gri (bordo tint yerine; istasyon tablosuna benzer) */
table.dataTable tbody tr:hover {
    background-color: #fafbfc !important;
}

/* Stripe — çok hafif (özellikle DataTables .stripe class'ı ile) */
table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
    background-color: #fcfcfd !important;
}
table.dataTable.stripe tbody tr.odd:hover,
table.dataTable.display tbody tr.odd:hover {
    background-color: #f6f7f9 !important;
}

/* Seçili satır */
table.dataTable tbody tr.selected,
table.dataTable tbody tr.selected:hover {
    background-color: rgba(var(--bs-primary-rgb, 138, 13, 30), .08) !important;
    color: inherit !important;
}

/* Pasif/deaktif satır (data-isactive="0" yaklaşımı kullanılıyorsa) */
table.dataTable tbody tr[data-isactive="0"] {
    background: #fff5f5 !important;
    opacity: .92;
}
table.dataTable tbody tr[data-isactive="0"]:hover {
    background: #ffeef0 !important;
    opacity: 1;
}


/* ---------- Column resize ----------
   Table default olarak table-layout: fixed (yukarıda tanımlandı). Hücreler
   TH genişliklerini takip eder, taşan içerik default ellipsis ile kesilir
   (tbody td kuralında tanımlı). bm-datatables.js drag sırasında pixel widths'i
   snapshot'lar; CSS-side ayrıca bir şey gerekmiyor. */

.bm-col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 14px;                        /* geniş tıklama alanı */
    cursor: col-resize;
    z-index: 50;
    user-select: none;
    background: transparent;
    pointer-events: auto;
    transition: background-color .15s;
}
.bm-col-resize-handle::after {
    content: "";
    position: absolute;
    top: 15%;
    bottom: 15%;
    right: 4px;
    width: 3px;
    border-radius: 2px;
    background: rgba(var(--bs-primary-rgb, 138, 13, 30), .35);  /* bariz bordo çizgi */
    transition: background-color .15s, width .15s;
    pointer-events: none;
}
.bm-col-resize-handle:hover::after,
body.bm-col-resizing .bm-col-resize-handle::after {
    background: var(--bs-primary, #8a0d1e);
    width: 4px;
}
.bm-col-resize-handle:hover {
    background: rgba(var(--bs-primary-rgb, 138, 13, 30), .06);
}

body.bm-col-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}
body.bm-col-resizing table.dataTable,
body.bm-col-resizing table.dataTable * {
    user-select: none !important;
    cursor: col-resize !important;
}


/* ---------- Sort — DataTables'ın kendi default sort ikonlarını kullanıyoruz,
   sadece tıklanabilir cursor + aktif durumda bordo vurgu. */

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    cursor: pointer;
}

table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    color: var(--bs-primary, #8a0d1e);
}


/* ---------- Pagination ----------
   Minimal — DataTables default render'ı + ortalama + bordo aktif sayfa.
*/

/* dom şablonu wrapper'ları */
.bm-dt-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .3rem 0 .5rem;
}

/* bmTable.init kullanan tablolarda info+paginate alt alta ortalanmış; .bm-dt-bottom container */
.bm-dt-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    padding: .35rem 0 .2rem;
    width: 100%;
}

/* === Pagination — TÜM .dataTable'larda ortada (button group + center) === */
/* DataTables default'unda paginate sağa float; tüm sayfalarda ortala.
   `display:flex + width:fit-content + margin:0 auto` = block-level, içerik kadar geniş, ortalı. */
.dataTables_wrapper .dataTables_paginate,
.dataTables_wrapper .dt-paging {                     /* DataTables 2.x */
    float: none !important;
    clear: both;
    display: flex;
    align-items: stretch;
    width: fit-content;
    max-width: 100%;
    margin: .35rem auto !important;
    padding: 0;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    height: 22px;
    font-size: .7rem;
    line-height: 1;
}

/* Numara grubu span (Previous ile Next arasındaki sayılar) inline-flex ile birleşsin */
.dataTables_wrapper .dataTables_paginate > span,
.dataTables_wrapper .dt-paging > span {
    display: inline-flex;
    align-items: stretch;
}

.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dt-paging .dt-paging-button,
.dataTables_wrapper .dt-paging button.first,
.dataTables_wrapper .dt-paging button.previous,
.dataTables_wrapper .dt-paging button.next,
.dataTables_wrapper .dt-paging button.last {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .55em;
    margin: 0;
    min-width: 22px;
    border: 0;
    border-right: 1px solid #dee2e6;
    border-radius: 0;
    background: #fff;
    color: #495057;
    font-size: .7rem;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
    text-decoration: none;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:last-child,
.dataTables_wrapper .dt-paging .dt-paging-button:last-child,
.dataTables_wrapper .dataTables_paginate > span:last-child .paginate_button:last-child {
    border-right: 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current):not(.disabled),
.dataTables_wrapper .dt-paging .dt-paging-button:hover:not(.current):not(.disabled) {
    background: #f1f3f5;
    color: #212529;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dt-paging .dt-paging-button.disabled,
.dataTables_wrapper .dt-paging .dt-paging-button.disabled:hover {
    color: #ced4da;
    cursor: not-allowed;
    background: #fff;
}

/* === Info ("X kayıttan Y - Z") — tüm tablolarda ortada === */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dt-info {
    float: none !important;
    clear: both;
    text-align: center;
    padding: .25rem 0 0 !important;
    margin: 0;
    font-size: .7rem;
    color: #6c757d;
    line-height: 1.2;
    width: 100%;
}

/* Aktif sayfa — sadece bordo renk */
.dataTables_wrapper .paginate_button.current,
.dataTables_wrapper .paginate_button.current:hover,
.dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--bs-primary, #8a0d1e);
    border-color: var(--bs-primary, #8a0d1e);
    color: #fff;
    font-weight: 600;
}


/* ---------- Buttons extension (Export / Print / Column visibility) ---------- */

.dt-buttons {
    margin-right: .5rem;
    display: inline-flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.dt-buttons .dt-button,
.dt-buttons .dt-button.buttons-csv,
.dt-buttons .dt-button.buttons-excel,
.dt-buttons .dt-button.buttons-pdf,
.dt-buttons .dt-button.buttons-copy,
.dt-buttons .dt-button.buttons-print,
.dt-buttons .dt-button.buttons-collection {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: .3rem .65rem !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: 1.25 !important;
    color: var(--bs-primary, #8a0d1e) !important;
    background: #fff !important;
    border: 1px solid rgba(var(--bs-primary-rgb, 138, 13, 30), .35) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    margin: 0 !important;
    transition: background-color .15s, border-color .15s, color .15s;
}

.dt-buttons .dt-button:hover,
.dt-buttons .dt-button:focus,
.dt-buttons .dt-button:active,
.dt-buttons .dt-button.active {
    background: var(--bs-primary, #8a0d1e) !important;
    border-color: var(--bs-primary, #8a0d1e) !important;
    color: #fff !important;
}

.dt-buttons .dt-button.disabled,
.dt-buttons .dt-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Buttons dropdown menu */
.dt-button-collection {
    padding: .3rem !important;
    border: 1px solid #e9ecef !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08) !important;
    background: #fff !important;
}
.dt-button-collection .dt-button {
    width: 100%;
    justify-content: flex-start;
    border: 0 !important;
    background: transparent !important;
    color: #212529 !important;
    padding: .35rem .55rem !important;
    border-radius: 4px !important;
}
.dt-button-collection .dt-button:hover,
.dt-button-collection .dt-button.active {
    background: rgba(var(--bs-primary-rgb, 138, 13, 30), .08) !important;
    color: var(--bs-primary, #8a0d1e) !important;
}


/* ---------- Processing (loader) ---------- */

.dataTables_wrapper .dataTables_processing {
    border: 1px solid #e9ecef !important;
    background: #fff !important;
    color: #6c757d !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
    padding: .6rem 1rem !important;
    font-size: .85rem !important;
    font-weight: 500;
}


/* ---------- Responsive / small viewport ---------- */

@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        float: none !important;
        margin-bottom: .35rem;
    }
    /* Info ve paginate mobilde de ortada (default davranışı koru) */
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dt-info,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dt-paging {
        text-align: center;
        float: none !important;
        margin-bottom: .35rem;
    }
    .dataTables_wrapper .dataTables_filter input {
        min-width: 0;
        width: 100%;
        margin-left: 0;
        margin-top: .2rem;
    }
}


