/*
 * SGD Tables — tema visual alineado con research-web
 * Paleta: #0a2e4c (navy), #ffb90b (gold), Montserrat
 * Aplica a todas las tablas DataTables del sistema
 */

/* ── Contenedor ──────────────────────────────────────────── */
.sgd-table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(10, 46, 76, 0.1);
    padding: 1.5rem;
    margin-top: 1rem;
    overflow-x: auto;
}

.dataTables_wrapper {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
}

/* ── Fila fantasma de DataTables (scrollX sizing row) ───── */
/* DataTables inserta un <tr style="height:2px"> para calcular
   anchos de columna; sin este fix aparece como franja blanca
   bajo la línea dorada del header.                          */
table.dataTable thead tr[style*="height: 0"],
table.dataTable thead tr[style*="height: 2px"] {
    display: none !important;
}

/* ── Header ──────────────────────────────────────────────── */
table.dataTable thead th,
table.dataTable thead td {
    background-color: #0a2e4c !important;
    color: #ffb90b !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    text-align: center !important;
    vertical-align: middle !important;
    border-bottom: 2px solid #ffb90b !important;
    border-right: 1px solid rgba(255, 185, 11, 0.2) !important;
    white-space: nowrap;
    padding: 0.85rem 0.75rem !important;
}

/* Flechas de ordenamiento */
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after,
table.dataTable thead th.sorting::before,
table.dataTable thead th.sorting_asc::before,
table.dataTable thead th.sorting_desc::before {
    color: rgba(255, 185, 11, 0.6) !important;
}

/* ── Filas ───────────────────────────────────────────────── */
table.dataTable tbody tr {
    transition: background-color 0.15s ease, color 0.15s ease;
}

table.dataTable tbody tr:hover > td {
    background-color: #fff8e1 !important;
    color: #0a2e4c !important;
}

table.dataTable.table-striped > tbody > tr.odd > * {
    background-color: #f8f9fa;
    box-shadow: none;
}

table.dataTable tbody td {
    vertical-align: middle;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    color: #2c3e50;
    border-color: #e9ecef !important;
    padding: 0.65rem 0.75rem !important;
}

/* ── Barra superior (search + length) ───────────────────── */
.dataTables_filter label,
.dataTables_length label {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    color: #0a2e4c;
    font-weight: 500;
}

.dataTables_filter input,
.dataTables_length select {
    border: 1.5px solid #cbd5e0 !important;
    border-radius: 8px !important;
    padding: 0.3rem 0.6rem !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.85rem !important;
    transition: border-color 0.2s;
}

.dataTables_filter input:focus,
.dataTables_length select:focus {
    border-color: #ffb90b !important;
    box-shadow: 0 0 0 3px rgba(255, 185, 11, 0.15) !important;
    outline: none;
}

/* ── Info ────────────────────────────────────────────────── */
.dataTables_info {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    color: #6c757d;
}

/* ── Paginación ──────────────────────────────────────────── */
.dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.8rem !important;
    margin: 0 2px !important;
    border: 1px solid #dee2e6 !important;
    transition: all 0.2s !important;
}

.dataTables_paginate .paginate_button:hover {
    background: #ffb90b !important;
    border-color: #ffb90b !important;
    color: #0a2e4c !important;
}

.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button.current:hover {
    background: linear-gradient(135deg, #0a2e4c, #1e3c72) !important;
    border-color: #0a2e4c !important;
    color: #fff !important;
}

.dataTables_paginate .paginate_button.disabled,
.dataTables_paginate .paginate_button.disabled:hover {
    color: #adb5bd !important;
    background: transparent !important;
    border-color: #dee2e6 !important;
    cursor: not-allowed;
}

/* ── Toolbar de exportación custom ──────────────────────── */
.sgd-export-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.sgd-export-toolbar .sgd-btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #0a2e4c, #1e3c72);
    border: none;
    border-radius: 20px;
    padding: 0.45rem 1.1rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.sgd-export-toolbar .sgd-btn-export:hover {
    background: linear-gradient(135deg, #ffb90b, #e5a500);
    color: #0a2e4c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(10, 46, 76, 0.25);
}

.sgd-export-toolbar .sgd-btn-export i {
    font-size: 0.85rem;
}

/* ── Badges de estado ────────────────────────────────────── */
.sgd-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.sgd-badge-success {
    background-color: #d4edda;
    color: #155724;
}

.sgd-badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.sgd-badge-info {
    background-color: #cce5ff;
    color: #004085;
}

.sgd-badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.sgd-badge-secondary {
    background-color: #e2e3e5;
    color: #383d41;
}

/* ── Celdas con texto largo (observación, asignatura) ────── */
td.prewrap,
.prewrap {
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 280px;
}

/* ── Tabla resumen (no-DataTable) usada en cards de detalle ─ */
.sgd-summary-table {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    margin-bottom: 0;
}

.sgd-summary-table thead th {
    background-color: #f1f4f7 !important;
    color: #0a2e4c !important;
    font-weight: 600;
    border-bottom: 2px solid #0a2e4c !important;
}

.sgd-summary-table tbody th {
    font-weight: 500;
    color: #2c3e50;
    background-color: #fafbfc;
}

.sgd-summary-table tbody tr:hover {
    background-color: #fff8e1;
}

.sgd-summary-table tfoot th,
.sgd-summary-table tfoot td {
    background-color: rgba(10, 46, 76, 0.08) !important;
    color: #0a2e4c;
    font-weight: 700;
    border-top: 2px solid #0a2e4c !important;
}
