/* ============================================
   Kartik GridView + PlainAdmin + Bootstrap 5
   ============================================ */

/* Reset de estilos del template que interfieren */
.table-wrapper {
    overflow-x: auto;
}

/* Grid Container */
.kv-grid-container {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Panel */
.kv-panel-pager,
.panel-heading,
.kv-panel-before,
.kv-panel-after {
    background: #ffffff;
    border: none;
}

/* Panel Heading */
.panel-heading {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 10px 10px 0 0;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
   gap: 8px;
}

.panel-title i {
    font-size: 18px;
}

/* Toolbar */
.kv-panel-before {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Tabla */
.kv-grid-table {
    width: 100%;
    margin: 0;
    background: #ffffff;
    border: none;
}

/* Table Head */
.kv-grid-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.kv-grid-table thead th {
    padding: 15px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.3px;
    border: none;
    vertical-align: middle;
}

/* Asegurar que los filtros NO estén en mayúsculas */
.kv-grid-table thead tr.filters th {
    text-transform: none;
    letter-spacing: normal;
}

/* Table Body */
.kv-grid-table tbody td {
    padding: 12px;
    font-size: 14px;
    color: #4b5563;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

/* Hover Row */
.kv-grid-table tbody tr:hover {
    background-color: #f9fafb;
    transition: background-color 0.2s ease;
}

/* Striped Rows */
.kv-grid-table tbody tr.kv-grid-row-odd {
    background-color: #ffffff;
}

.kv-grid-table tbody tr.kv-grid-row-even {
    background-color: #f9fafb;
}

/* Filtros */
.kv-grid-table .filters input,
.kv-grid-table .filters select,
.kv-grid-table .filters .form-control {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    height: auto;
    min-height: 38px;
    text-transform: none;
    letter-spacing: normal;
}

.kv-grid-table .filters input:focus,
.kv-grid-table .filters select:focus,
.kv-grid-table .filters .form-control:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    outline: none;
}

/* Select2 en filtros */
.select2-container--krajee .select2-selection {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    min-height: 38px;
    background: #ffffff;
}

.select2-container--krajee .select2-selection__rendered {
    color: #374151;
    line-height: 36px;
    padding-left: 12px;
}

/* Select2 Dropdown */
.select2-container--krajee .select2-dropdown {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.select2-container--krajee .select2-results__option {
    padding: 8px 12px;
    color: #374151;
}

.select2-container--krajee .select2-results__option--highlighted {
    background-color: #4361ee;
    color: #ffffff;
}

/* Action Buttons en Grid */
.kv-grid-table .btnrh-update,
.kv-grid-table .btnrh-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.kv-grid-table .btnrh-update {
    background: #4361ee;
    color: #ffffff;
}

.kv-grid-table .btnrh-update:hover {
    background: #3451d9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.kv-grid-table .btnrh-delete {
    background: #ef4444;
    color: #ffffff;
}

.kv-grid-table .btnrh-delete:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Status Badges */
.btnrh-nbverde2,
.btnrh-nbrojo2 {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.btnrh-nbverde2 {
    background: #d1fae5;
    color: #065f46;
}

.btnrh-nbrojo2 {
    background: #fee2e2;
    color: #991b1b;
}

/* Paginación */
.kv-panel-pager {
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.pagination {
    margin: 0;
    gap: 5px;
}

.page-item {
    margin: 0;
}

.page-link {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.page-link:hover {
    color: #4361ee;
    background: #eff6ff;
    border-color: #4361ee;
}

.page-item.active .page-link {
    background: #4361ee;
    border-color: #4361ee;
    color: #ffffff;
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Summary */
.summary {
    font-size: 13px;
    color: #6b7280;
    padding: 10px 0;
}

/* Refresh Button */
.btnfresh {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btnfresh:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Export Dropdown */
.btn-group .btn-secondary {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    background: #64748b;
    border: none;
    border-radius: 6px;
}

.btn-group .btn-secondary:hover {
    background: #475569;
}

/* Loading */
.kv-grid-loading {
    background: rgba(255, 255, 255, 0.9);
    color: #374151;
}

/* Empty */
.kv-grid-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* Fix para el scroll horizontal */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    z-index: 1050;
    display: none;
    min-width: 10rem;
    padding: 0.5rem 0;
    margin: 0;
    font-size: 14px;
    color: #374151;
    text-align: left;
    list-style: none;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    clear: both;
    font-weight: 400;
    color: #374151;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #1f2937;
    background-color: #f3f4f6;
}

.dropdown-item.active,
.dropdown-item:active {
    color: #ffffff;
    text-decoration: none;
    background-color: #4361ee;
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid #e5e7eb;
}

/* Botón de exportación */
.btn-group .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-group .dropdown-toggle::after {
    margin-left: 0;
}

/* Posicionamiento del dropdown */
.btn-group {
    position: relative;
}

.btn-group > .dropdown-menu {
    top: 100%;
    left: 0;
    margin-top: 4px;
}

/* ============================================
   DARK THEME - PlainAdmin
   ============================================ */

/* IMPORTANTE: Usar !important para sobrescribir estilos del tema claro */

/* Grid Container */
body.darkTheme .kv-grid-container {
    background: #24303f !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3) !important;
}




/* Panel */
body.darkTheme .kv-panel-pager,
body.darkTheme .panel-heading,
body.darkTheme .kv-panel-before,
body.darkTheme .kv-panel-after {
    background: #24303f !important;
    border-color: #3c4d62 !important;
}

/* Panel Heading */
body.darkTheme .panel-heading {
    border-bottom: 1px solid #3c4d62 !important;
}

body.darkTheme .panel-title {
    color: #e5e7eb !important;
}

/* Toolbar */
body.darkTheme .kv-panel-before {
    border-bottom: 1px solid #3c4d62 !important;
}

/* Dark mode - card footer */
body.darkTheme .card-footer {
    background: #1a2332 !important;
    border-top: 1px solid #3c4d62 !important;
}

/* Panel pager dentro del footer */
body.darkTheme .card-footer .kv-panel-pager {
    background: transparent !important;
    border: none !important;
}

/* Tabla - MUY IMPORTANTE */
body.darkTheme .kv-grid-table {
    background: #24303f !important;
    color: #e5e7eb !important;
}

/* Table Head */
body.darkTheme .kv-grid-table thead {
    background: #1a2332 !important;
    border-bottom: 2px solid #3c4d62 !important;
}

body.darkTheme .kv-grid-table thead th {
    color: #9ca3af !important;
    background: #1a2332 !important;
}

/* Table Body - CRÍTICO */
body.darkTheme .kv-grid-table tbody td {
    color: #d1d5db !important;
    border-bottom: 1px solid #2a3a4d !important;
    background: transparent !important;
}

/* Hover Row */
body.darkTheme .kv-grid-table tbody tr:hover {
    background-color: #2a3a4d !important;
}

body.darkTheme .kv-grid-table tbody tr:hover td {
    background-color: #2a3a4d !important;
}

/* Striped Rows */
body.darkTheme .kv-grid-table tbody tr.kv-grid-row-odd {
    background-color: #24303f !important;
}

body.darkTheme .kv-grid-table tbody tr.kv-grid-row-odd td {
    background-color: #24303f !important;
}

body.darkTheme .kv-grid-table tbody tr.kv-grid-row-even {
    background-color: #1f2937 !important;
}

body.darkTheme .kv-grid-table tbody tr.kv-grid-row-even td {
    background-color: #1f2937 !important;
}

/* Filtros */
body.darkTheme .kv-grid-table .filters input,
body.darkTheme .kv-grid-table .filters select,
body.darkTheme .kv-grid-table .filters .form-control {
    background: #1a2332 !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .kv-grid-table .filters input::placeholder {
    color: #6b7280 !important;
}

/* Select2 */
body.darkTheme .select2-container--krajee .select2-selection {
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
    color: #e5e7eb !important;
}

body.darkTheme .select2-container--krajee .select2-selection__rendered {
    color: #e5e7eb !important;
}

body.darkTheme .select2-container--krajee .select2-selection__placeholder {
    color: #6b7280 !important;
}

body.darkTheme .select2-container--krajee .select2-selection__arrow b {
    border-color: #9ca3af transparent transparent transparent !important;
}

/* Select2 Dropdown */
body.darkTheme .select2-container--krajee .select2-dropdown {
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .select2-container--krajee .select2-results__option {
    color: #e5e7eb !important;
    background: #1a2332 !important;
}

body.darkTheme .select2-container--krajee .select2-results__option--highlighted {
    background-color: #4361ee !important;
    color: #ffffff !important;
}

body.darkTheme .select2-container--krajee .select2-results__option[aria-selected="true"] {
    background-color: #2a3a4d !important;
}

body.darkTheme .select2-container--krajee .select2-search__field {
    background: #1a2332 !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

/* Status Badges Dark */
body.darkTheme .btnrh-nbverde2 {
    background: #064e3b !important;
    color: #6ee7b7 !important;
}

body.darkTheme .btnrh-nbrojo2 {
    background: #7f1d1d !important;
    color: #fca5a5 !important;
}

/* Action Buttons */
body.darkTheme .btnrh-update {
    background: #4361ee !important;
}

body.darkTheme .btnrh-update:hover {
    background: #3451d9 !important;
}

body.darkTheme .btnrh-delete {
    background: #ef4444 !important;
}

body.darkTheme .btnrh-delete:hover {
    background: #dc2626 !important;
}

/* Paginación */
body.darkTheme .kv-panel-pager {
    border-top: 1px solid #3c4d62 !important;
    background: #24303f !important;
}

body.darkTheme .page-link {
    color: #e5e7eb !important;
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .page-link:hover {
    background: #2a3a4d !important;
    border-color: #4361ee !important;
    color: #ffffff !important;
}

body.darkTheme .page-item.active .page-link {
    background: #4361ee !important;
    border-color: #4361ee !important;
    color: #ffffff !important;
}

body.darkTheme .page-item.disabled .page-link {
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
    color: #6b7280 !important;
}

/* Summary */
body.darkTheme .summary {
    color: #9ca3af !important;
}

/* Refresh Button */
body.darkTheme .btnfresh {
    color: #e5e7eb !important;
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .btnfresh:hover {
    background: #2a3a4d !important;
    border-color: #6b7280 !important;
}

/* Loading */
body.darkTheme .kv-grid-loading {
    background: rgba(36, 48, 63, 0.95) !important;
    color: #e5e7eb !important;
}

/* Dropdown Menu */
body.darkTheme .dropdown-menu {
    background-color: #1a2332 !important;
    border-color: #3c4d62 !important;
    color: #e5e7eb !important;
}

body.darkTheme .dropdown-item {
    color: #e5e7eb !important;
}

body.darkTheme .dropdown-item:hover,
body.darkTheme .dropdown-item:focus {
    color: #ffffff !important;
    background-color: #2a3a4d !important;
}

body.darkTheme .dropdown-divider {
    border-top-color: #3c4d62 !important;
}

/* Export Button */
body.darkTheme .btn-group .btn-secondary {
    background: #475569 !important;
    border-color: #475569 !important;
    color: #ffffff !important;
}

body.darkTheme .btn-group .btn-secondary:hover {
    background: #334155 !important;
    border-color: #334155 !important;
}

/* Scrollbar Dark */
body.darkTheme .table-responsive::-webkit-scrollbar-track {
    background: #1a2332 !important;
}

body.darkTheme .table-responsive::-webkit-scrollbar-thumb {
    background: #3c4d62 !important;
}

body.darkTheme .table-responsive::-webkit-scrollbar-thumb:hover {
    background: #475569 !important;
}

/* Empty State */
body.darkTheme .kv-grid-empty {
    color: #6b7280 !important;
}

/* Toggle Data Button */
body.darkTheme .btn-default {
    background: #1a2332 !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .btn-default:hover {
    background: #2a3a4d !important;
    color: #ffffff !important;
}

/* Fila completa de filtros */
body.darkTheme .kv-grid-table tr.filters {
    background: #1a2332 !important;
}

body.darkTheme .kv-grid-table tr.filters td {
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
}

/* Inputs de texto en filtros */
body.darkTheme .kv-grid-table .filters input.form-control,
body.darkTheme .kv-grid-table .filters input[type="text"],
body.darkTheme .kv-grid-table .filters input[type="number"],
body.darkTheme .kv-grid-table .filters textarea.form-control {
    background: #24303f !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .kv-grid-table .filters input.form-control:focus,
body.darkTheme .kv-grid-table .filters input[type="text"]:focus,
body.darkTheme .kv-grid-table .filters input[type="number"]:focus {
    background: #24303f !important;
    border-color: #4361ee !important;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25) !important;
}

body.darkTheme .kv-grid-table .filters input::placeholder,
body.darkTheme .kv-grid-table .filters textarea::placeholder {
    color: #6b7280 !important;
}

/* Select normal en filtros */
body.darkTheme .kv-grid-table .filters select.form-control,
body.darkTheme .kv-grid-table .filters select {
    background: #24303f !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

/* ============================================
   SELECT2 EN FILTROS - MÁS ESPECÍFICO
   ============================================ */

/* Select2 - Contenedor principal en filtros */
body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5 .select2-selection--single,
body.darkTheme .filters .select2-container--krajee-bs5 .select2-selection--single {
    background: #24303f !important;
    border-color: #3c4d62 !important;
    color: #e5e7eb !important;
    height: 38px !important;
}

/* Select2 - Texto renderizado */
body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5 .select2-selection__rendered,
body.darkTheme .filters .select2-container--krajee-bs5 .select2-selection__rendered {
    color: #e5e7eb !important;
    line-height: 36px !important;
}

/* Select2 - Placeholder */
body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5 .select2-selection__placeholder,
body.darkTheme .filters .select2-container--krajee-bs5 .select2-selection__placeholder {
    color: #6b7280 !important;
}

/* Select2 - Flecha */
body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5 .select2-selection__arrow,
body.darkTheme .filters .select2-container--krajee-bs5 .select2-selection__arrow {
    height: 36px !important;
}

body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5 .select2-selection__arrow b,
body.darkTheme .filters .select2-container--krajee-bs5 .select2-selection__arrow b {
    border-color: #9ca3af transparent transparent transparent !important;
}

/* Select2 - Focus/Open */
body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5.select2-container--open .select2-selection--single,
body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5.select2-container--focus .select2-selection--single {
    border-color: #4361ee !important;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25) !important;
}

/* Select2 Dropdown - Menú desplegable */
body.darkTheme .select2-container--krajee-bs5 .select2-dropdown {
    background: #24303f !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .select2-container--krajee-bs5 .select2-results__option {
    color: #e5e7eb !important;
    background: #24303f !important;
}

body.darkTheme .select2-container--krajee-bs5 .select2-results__option--highlighted {
    background-color: #4361ee !important;
    color: #ffffff !important;
}

body.darkTheme .select2-container--krajee-bs5 .select2-results__option[aria-selected="true"] {
    background-color: #2a3a4d !important;
    color: #e5e7eb !important;
}

/* Select2 - Búsqueda en dropdown */
body.darkTheme .select2-container--krajee-bs5 .select2-search--dropdown .select2-search__field {
    background: #1a2332 !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

/* Select2 - Multiple (por si acaso) */
body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5 .select2-selection--multiple {
    background: #24303f !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .kv-grid-table .filters .select2-container--krajee-bs5 .select2-selection--multiple .select2-selection__choice {
    background: #2a3a4d !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

/* ============================================
   AJUSTES ADICIONALES PARA CONSISTENCIA
   ============================================ */

/* Asegurar que los TD de filtros no tengan override */
body.darkTheme .kv-grid-table thead tr.filters td {
    background-color: #1a2332 !important;
    padding: 8px !important;
}

/* Input group en filtros */
body.darkTheme .kv-grid-table .filters .input-group .input-group-text {
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
    color: #9ca3af !important;
}

/* Date pickers en filtros */
body.darkTheme .kv-grid-table .filters .input-group .form-control {
    background: #24303f !important;
    color: #e5e7eb !important;
    border-color: #3c4d62 !important;
}

/* Buttons en filtros (si hay) */
body.darkTheme .kv-grid-table .filters button,
body.darkTheme .kv-grid-table .filters .btn {
    background: #2a3a4d !important;
    border-color: #3c4d62 !important;
    color: #e5e7eb !important;
}

body.darkTheme .kv-grid-table .filters button:hover,
body.darkTheme .kv-grid-table .filters .btn:hover {
    background: #334155 !important;
    border-color: #475569 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .kv-panel-before {
        flex-direction: column;
        align-items: stretch;
    }
    
    .kv-grid-table {
        font-size: 13px;
    }
    
    .kv-grid-table thead th,
    .kv-grid-table tbody td {
        padding: 8px;
    }
}

/* ============================================
   Botones de acción circulares estilo PlainAdmin
   ============================================ */

/* Botón circular con icono */
.action-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    text-decoration: none;
    position: relative;
}

.action-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Variantes de color */
.action-icon-btn.text-primary {
    color: #4361ee;
    background: rgba(67, 97, 238, 0.1);
}

.action-icon-btn.text-primary:hover {
    background: rgba(67, 97, 238, 0.2);
    color: #3451d9;
}

.action-icon-btn.text-danger {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.action-icon-btn.text-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.action-icon-btn.text-success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.action-icon-btn.text-success:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.action-icon-btn.text-warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.action-icon-btn.text-warning:hover {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
}

.action-icon-btn.text-info {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.action-icon-btn.text-info:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #2563eb;
}

/* Icono dentro del botón */
.action-icon-btn i {
    font-size: 18px;
    line-height: 1;
}

/* Ajustar celdas de acción */
.kv-grid-table tbody .action {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

/* Quitar background de las celdas de acción */
.kv-grid-table tbody td:has(.action-icon-btn) {
    background: transparent !important;
}

/* Dark Theme */
body.darkTheme .action-icon-btn.text-primary {
    color: #5b7cff;
    background: rgba(91, 124, 255, 0.15);
}

body.darkTheme .action-icon-btn.text-primary:hover {
    background: rgba(91, 124, 255, 0.25);
    color: #7a96ff;
}

body.darkTheme .action-icon-btn.text-danger {
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
}

body.darkTheme .action-icon-btn.text-danger:hover {
    background: rgba(248, 113, 113, 0.25);
    color: #fca5a5;
}

body.darkTheme .action-icon-btn.text-success {
    color: #34d399;
    background: rgba(52, 211, 153, 0.15);
}

body.darkTheme .action-icon-btn.text-success:hover {
    background: rgba(52, 211, 153, 0.25);
    color: #6ee7b7;
}

body.darkTheme .action-icon-btn.text-warning {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
}

body.darkTheme .action-icon-btn.text-warning:hover {
    background: rgba(251, 191, 36, 0.25);
    color: #fcd34d;
}

body.darkTheme .action-icon-btn.text-info {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.15);
}

body.darkTheme .action-icon-btn.text-info:hover {
    background: rgba(96, 165, 250, 0.25);
    color: #93c5fd;
}

/* Versión con borde (opcional) */
.action-icon-btn.bordered {
    border: 2px solid currentColor;
    background: transparent;
}

.action-icon-btn.bordered:hover {
    background: currentColor;
}

.action-icon-btn.bordered.text-primary:hover {
    color: #ffffff;
}

.action-icon-btn.bordered.text-danger:hover {
    color: #ffffff;
}

/* Versión sólida (opcional) */
.action-icon-btn.solid {
    color: #ffffff;
}

.action-icon-btn.solid.text-primary {
    background: #4361ee;
}

.action-icon-btn.solid.text-primary:hover {
    background: #3451d9;
}

.action-icon-btn.solid.text-danger {
    background: #ef4444;
}

.action-icon-btn.solid.text-danger:hover {
    background: #dc2626;
}

/* Tamaños opcionales */
.action-icon-btn.btn-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.action-icon-btn.btn-sm i {
    font-size: 14px;
}

.action-icon-btn.btn-lg {
    width: 48px;
    height: 48px;
    font-size: 20px;
}

.action-icon-btn.btn-lg i {
    font-size: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .action-icon-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .action-icon-btn i {
        font-size: 16px;
    }
}

/* GridView font size */
.kv-grid-container,
.kv-grid-container table,
.kv-grid-container td,
.kv-grid-container input,
.kv-grid-container select,
.kv-grid-container .pagination {
    font-size: 12px !important;
}

/* ============================================
   PAGINACIÓN - PLAINADMIN STYLE (CORREGIDO)
   ============================================ */

/* Limpiar estilos de Kartik/Bootstrap */
.kv-panel-pager {
    background: transparent !important;
    border: none !important;    
}

/* Contenedor de paginación */
.dataTable-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.dataTable-pagination-list {
    display: flex;
    list-style: none;
    padding: 0 !important;
    margin: 0 !important;
    gap: 8px;
    align-items: center;
}

.dataTable-pagination-list li {
    display: inline-block;
    margin: 0 !important;
}

/* Estilo base de los links */
.dataTable-pagination-list li a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 14px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #4b5563 !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    line-height: 1 !important;
}

.dataTable-pagination-list li a:hover {
    background: #f3f4f6 !important;
    border-color: #4361ee !important;
    color: #4361ee !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.2);
}

/* Página activa */
.dataTable-pagination-list li.active a {
    background: linear-gradient(135deg, #4361ee 0%, #3451d9 100%) !important;
    border-color: #4361ee !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
    font-weight: 600 !important;
}

.dataTable-pagination-list li.active a:hover {
    transform: none;
}

/* Deshabilitado */
.dataTable-pagination-list li.disabled a {
    color: #d1d5db !important;
    background: #f9fafb !important;
    border-color: #e5e7eb !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Elipsis */
.dataTable-pagination-list li.ellipsis a {
    border: none !important;
    background: transparent !important;
    pointer-events: none !important;
    color: #9ca3af !important;
    min-width: 30px !important;
}

/* Botones pager (anterior/siguiente) */
.dataTable-pagination-list li.pager a {
    font-size: 16px !important;
    min-width: 40px !important;
}

.dataTable-pagination-list li.pager a i {
    font-size: 18px;
}

/* ============================================
   PAGINACIÓN - DARK MODE
   ============================================ */

body.darkTheme .kv-panel-pager {
    background: #24303f !important;
}

body.darkTheme .dataTable-pagination-list li a {
    color: #e5e7eb !important;
    background: #1a2332 !important;
    border-color: #3c4d62 !important;
}

body.darkTheme .dataTable-pagination-list li a:hover {
    background: #2a3a4d !important;
    border-color: #4361ee !important;
    color: #4fc3f7 !important;
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.2);
}

body.darkTheme .dataTable-pagination-list li.active a {
    background: linear-gradient(135deg, #4361ee 0%, #3451d9 100%) !important;
    border-color: #4361ee !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4);
}

body.darkTheme .dataTable-pagination-list li.disabled a {
    color: #6b7280 !important;
    background: #0f1419 !important;
    border-color: #2a3a4d !important;
    opacity: 0.5 !important;
}

body.darkTheme .dataTable-pagination-list li.ellipsis a {
    background: transparent !important;
    border: none !important;
    color: #6b7280 !important;
}

/* ============================================
   AJUSTES ADICIONALES
   ============================================ */

/* Forzar que no haya margin/padding extra del GridView */
.kv-grid-container .kv-panel-pager .pagination {
    margin: 0 !important;
}

/* Centrar la paginación */
.kv-panel-pager > .dataTable-pagination {
    justify-content: center;
}

/* Info de registros (si existe) */
.dataTable-info {
    color: #6b7280;
    font-size: 14px;
    padding: 0 15px;
}

body.darkTheme .dataTable-info {
    color: #9ca3af;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .dataTable-pagination-list {
        gap: 4px;
    }
    
    .dataTable-pagination-list li a {
        min-width: 36px !important;
        height: 36px !important;
        padding: 0 10px !important;
        font-size: 13px !important;
    }
    
    .dataTable-pagination-list li.pager a {
        min-width: 36px !important;
    }
    
    .dataTable-pagination-list li.pager a i {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .dataTable-pagination-list {
        gap: 3px;
    }
    
    .dataTable-pagination-list li a {
        min-width: 32px !important;
        height: 32px !important;
        padding: 0 8px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
    }
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dataTable-pagination-list li {
    animation: fadeIn 0.3s ease;
}

/* Efecto ripple en click */
.dataTable-pagination-list li a {
    position: relative;
    overflow: hidden;
}

.dataTable-pagination-list li a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.dataTable-pagination-list li a:active::before {
    width: 100px;
    height: 100px;
}