/* ================================================
   Material Design DataTable Styles - CeibeRRHH
   ================================================ */

/* ── TABLE BASE ─────────────────────────────────── */

.material-table {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.material-thead {
    background: linear-gradient(to right, #a78bfa, #6366f1);
    border-bottom: 1px solid #6366f1;
}

.material-th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    padding: 8px 20px;
    font-weight: 600;
    text-align: left;
}

.material-table tbody tr,
.material-table tbody tr.odd,
.material-table tbody tr.even {
    height: 44px;
    background: white !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.material-table tbody tr:hover {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.material-table tbody td {
    font-size: 14px;
    color: #334155;
    padding: 8px 20px;
    border-bottom: none;
}

.material-table tbody tr:last-child td {
    border-bottom: none !important;
}

/* Evitar doble borde inferior */
table.material-table.dataTable {
    margin-bottom: 0 !important;
}

/* ── ACTION BUTTONS ─────────────────────────────── */

.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    margin: 0 3px;
    font-size: 11px;
}

.btn-edit:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    margin: 0 3px;
    font-size: 11px;
}

.btn-delete:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* ── TOP CONTROLS (buttons + length + search) ───── */

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 12px;
    order: 1;
}

.controls-right {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
}

/* ── EXPORT BUTTONS ─────────────────────────────── */

.dataTables_wrapper .dt-buttons {
    margin: 0;
    display: flex;
    gap: 4px;
}

.dataTables_wrapper .dt-buttons .dt-button {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-size: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dataTables_wrapper .dt-buttons .dt-button:hover {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.dataTables_wrapper .dt-buttons .dt-button i {
    margin-right: 0;
    font-size: 14px;
}

/* ── LENGTH MENU ────────────────────────────────── */

.dataTables_wrapper .dataTables_length,
div.dt-container .dt-length {
    margin: 0;
}

.dataTables_wrapper .dataTables_length label,
div.dt-container .dt-length label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
}

.dataTables_wrapper .dataTables_length select,
div.dt-container .dt-length select {
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 28px 4px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    height: 32px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.dataTables_wrapper .dataTables_length select:hover,
div.dt-container .dt-length select:hover {
    border-color: #94a3b8;
}

.dataTables_wrapper .dataTables_length select:focus,
div.dt-container .dt-length select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* ── SEARCH INPUT ───────────────────────────────── */

div.dt-container .dt-search input,
div.dt-container .dt-search input[type="search"],
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_filter input[type="search"],
div.dataTables_wrapper div.dataTables_filter input,
div.dt-container .dt-input {
    background: #ffffff !important;
    border: 1.5px solid #3b82f6 !important;
    border-radius: 8px !important;
    padding: 0 12px !important;
    height: 32px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    box-shadow: none !important;
    width: 200px !important;
    margin-left: 8px !important;
    box-sizing: border-box !important;
    outline: none !important;
}

div.dt-container .dt-search input:focus,
div.dt-container .dt-search input[type="search"]:focus,
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_filter input[type="search"]:focus,
div.dataTables_wrapper div.dataTables_filter input:focus,
div.dt-container .dt-input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    outline: none !important;
}

/* ── FOOTER (info + pagination wrapper) ─────────── */

.dt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 4px;
    border-top: 1px solid #f1f5f9;
    margin-top: 12px;
    gap: 16px;
    flex-wrap: wrap;
}

/* ── INFO TEXT ───────────────────────────────────── */

.dataTables_wrapper .dataTables_info,
div.dt-container .dt-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 14px;
    margin: 0;
    white-space: nowrap;
    float: none;
}

/* ── PAGINATION ─────────────────────────────────── */

.dataTables_wrapper .dataTables_paginate,
div.dt-container .dt-paging {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0;
    margin-left: auto;
    float: none;
    padding: 0;
}

.dataTables_wrapper .dataTables_paginate span,
div.dt-container .dt-paging span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* All pagination buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button,
div.dt-container .dt-paging .dt-paging-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px !important;
    font-size: 12px !important;
    font-weight: 500;
    color: #475569;
    background: white;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    text-decoration: none !important;
    box-sizing: border-box;
}

/* Hover */
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current),
div.dt-container .dt-paging .dt-paging-button:hover:not(.disabled):not(.current) {
    background: #f1f5f9;
    border-color: #cbd5e1 !important;
    color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Current/Active page */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: white !important;
    border-color: #3b82f6 !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* Disabled */
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    background: #f9fafb !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Previous / Next — replace text with icons via CSS */
.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next,
.dataTables_wrapper .dataTables_paginate .paginate_button.first,
.dataTables_wrapper .dataTables_paginate .paginate_button.last,
div.dt-container .dt-paging .dt-paging-button.previous,
div.dt-container .dt-paging .dt-paging-button.next,
div.dt-container .dt-paging .dt-paging-button.first,
div.dt-container .dt-paging .dt-paging-button.last {
    font-size: 0 !important;
    min-width: 32px;
    padding: 0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.previous::before,
div.dt-container .dt-paging .dt-paging-button.previous::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f053";
    font-size: 11px;
    color: inherit;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.next::before,
div.dt-container .dt-paging .dt-paging-button.next::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f054";
    font-size: 11px;
    color: inherit;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.first::before,
div.dt-container .dt-paging .dt-paging-button.first::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f100";
    font-size: 11px;
    color: inherit;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.last::before,
div.dt-container .dt-paging .dt-paging-button.last::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f101";
    font-size: 11px;
    color: inherit;
}

/* ── LOADING STATE ──────────────────────────────── */

.dataTables_wrapper .dataTables_processing {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,250,252,0.95));
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* ── SORTING ICONS (DT 2.x) ────────────────────── */

.no-sort::after {
    display: none !important;
}

table.dataTable thead > tr > th span.dt-column-order::before,
table.dataTable thead > tr > td span.dt-column-order::before {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    content: "\f0de" !important;
}

table.dataTable thead > tr > th span.dt-column-order::after,
table.dataTable thead > tr > td span.dt-column-order::after {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    content: "\f0dd" !important;
}

/* ── MATERIAL MODAL STYLES ──────────────────────── */

.material-input {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.material-input:focus {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.material-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.material-btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.material-btn-secondary {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: #64748b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.material-btn-secondary:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ── MATERIAL FAB BUTTON ────────────────────────── */

.material-fab {
    position: relative;
    overflow: hidden;
}

.material-fab::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.material-fab:hover::before {
    width: 300px;
    height: 300px;
}

.material-fab:active {
    transform: scale(0.95);
}

/* ── RESPONSIVE ─────────────────────────────────── */

@media (max-width: 640px) {
    .dt-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .dataTables_wrapper .dataTables_paginate,
    div.dt-container .dt-paging {
        margin-left: 0;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-left,
    .controls-right {
        justify-content: center;
    }
}
