/* =========================================
   Fleet Admin – DataTables Overrides
   Matcher lys UI + accent #17be74
   ========================================= */

/* Wrapper layout tweaks */
.dataTables_wrapper {
    font-size: 0.95rem;
}

.dataTables_wrapper .top,
.dataTables_wrapper .bottom {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Length + Filter */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    font-weight: 500;
    color: #495057;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #cfd4da;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #17be74;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
    color: #6c757d;
    padding-top: 0.4rem;
}

/* Processing state */
.dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    transform: translate(-50%, -50%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    color: #212529;
    z-index: 2;
}

/* Table base */
table.dataTable {
    border-collapse: collapse !important;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

table.dataTable thead th {
    background: #eef3f1;
    border-bottom: 2px solid #dee2e6 !important;
    color: #374151;
    font-weight: 600;
    white-space: nowrap;
}

/* Hover rows */
table.dataTable tbody tr:hover {
    background: #f7faf9;
}

/* Selected rows */
table.dataTable tbody tr.selected,
table.dataTable tbody tr.selected:hover {
    background: #e8fff3 !important;
}

/* Compact cell padding (optional utility) */
table.dataTable td, table.dataTable th {
    padding: 0.75rem 0.75rem;
}

/* Sort icons (no images, pure CSS) */
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 1.5rem;
    cursor: pointer;
}

table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
    content: "↕";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    opacity: 0.35;
}

table.dataTable thead th.sorting_asc:after {
    content: "▲";
    opacity: 0.8;
    color: #17be74;
}

table.dataTable thead th.sorting_desc:after {
    content: "▼";
    opacity: 0.8;
    color: #17be74;
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate {
    padding-top: 0.4rem;
    text-align: right;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid #dfe3e6;
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    margin: 0 0.15rem;
    background: #ffffff;
    color: #495057 !important;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: #17be74;
    color: #0e7e51 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #17be74 !important;
    color: #fff !important;
    border-color: #17be74 !important;
}

/* Disabled state */
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    color: #adb5bd !important;
    border-color: #e9ecef !important;
    background: #f8f9fa !important;
    cursor: default;
}

/* Search/Length stacking on small screens */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        width: 100%;
        text-align: left;
    }
    .dataTables_wrapper .dataTables_paginate {
        text-align: left;
        margin-top: 0.25rem;
    }
}

/* Action buttons inside tables (icons/links) */
.table-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.table-actions .btn,
.table-actions a {
    padding: 0.35rem 0.55rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Status badges (optional helper) */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 999px;
    line-height: 1;
    font-weight: 600;
}

.badge-success { background: #e8fff3; color: #0e7e51; }
.badge-warning { background: #fff5e6; color: #a05a00; }
.badge-danger  { background: #ffe8ea; color: #9c1c2b; }

/* Images inside cells */
.table-image {
    width: 56px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Responsive rows (if using DataTables Responsive ext) */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    background-color: #17be74 !important;
    line-height: 1.2;
}

/* Focus states for accessibility */
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_paginate .paginate_button:focus {
    outline: 2px solid rgba(23,190,116,0.25);
    outline-offset: 2px;
}
