
/* ========== CONTENEDOR DE TABLA ========== */
.table-container {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* ========== ESTRUCTURA DE TABLA ========== */
.table-responsive {
    overflow-x: auto;
}

table, .table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

/* ========== ENCABEZADO ========== */
thead {
    background: var(--bg-card);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* ========== FILAS ========== */
tbody tr {
    background: var(--bg-card);
    transition: all 0.3s ease;
}

tbody tr:hover {
    background: var(--bg-hover);
    transform: translateX(5px);
    box-shadow: 0 4px 12px var(--shadow);
}

/* ========== CELDAS ========== */
td {
    padding: 1rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

td:first-child {
    border-left: 1px solid var(--border);
    border-radius: 12px 0 0 12px;
}

td:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 12px 12px 0;
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* ========== BOTONES DE ACCIÓN COMPACTOS ========== */
.actions, .action-buttons {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== BOTONES CON ICONOS (32x32px) ========== */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    color: white;
}

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

.btn-icon:active {
    transform: scale(0.95);
}

/* Tooltips para botones con iconos */
.btn-icon::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 0.3rem;
    z-index: 1000;
}

.btn-icon:hover::after {
    opacity: 1;
}

/* ========== BOTONES ESTÁNDAR (btn-xs) ========== */
.btn-xs {
    padding: 0;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.btn-xs:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-xs:active {
    transform: scale(0.95);
}

/* Tooltips para botones estándar */
.btn-xs::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 0.3rem;
    z-index: 1000;
}

.btn-xs:hover::after {
    opacity: 1;
}

/* ========== COLORES DE BOTONES ========== */
.btn-icon-primary,
.btn-primary.btn-xs,
.btn-primary.btn-icon {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.btn-icon-secondary,
.btn-secondary.btn-xs,
.btn-secondary.btn-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.btn-icon-success,
.btn-success.btn-xs,
.btn-success.btn-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-icon-warning,
.btn-warning.btn-xs,
.btn-warning.btn-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-icon-danger,
.btn-danger.btn-xs,
.btn-danger.btn-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* ========== BOTONES DE CREAR  ========== */
.btn-primary.btn-sm {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-primary.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary.btn-sm:active {
    transform: translateY(0);
}

/* ========== ESTADO VACÍO ========== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}


/* ========== TEMA CLARO PARA LAS TABLAS ========== */
body.light-theme .table-container {
    background: rgba(255, 255, 255, 0.9);
    border-color: #dee2e6;
}

body.light-theme thead {
    background: #f8f9fa;
}

body.light-theme tbody tr {
    background: #ffffff;
}

body.light-theme tbody tr:hover {
    background: #f8f9fa;
}

body.light-theme td {
    color: #212529;
    border-color: #dee2e6;
}

body.light-theme th {
    color: #6c757d;
}

body.light-theme .btn-icon::after,
body.light-theme .btn-xs::after {
    background: rgba(0, 0, 0, 0.85);
}

/* ========== RESPONSIVE PARA TABLAS ========== */
@media (max-width: 768px) {
    .table-container {
        padding: 1rem;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .btn-icon,
    .btn-xs {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .actions,
    .action-buttons {
        gap: 0.3rem;
    }
    
    td,
    th {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .table-title {
        font-size: 1.25rem;
    }
    
    .btn-primary.btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .btn-icon,
    .btn-xs {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
}

/* ========== SCROLL HORIZONTAL ========== */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

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

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

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

tbody tr {
    animation: fadeIn 0.3s ease;
}

