/*
 * LA OLA - Red Psico Legal
 * Estilos de Tablas de Datos
 * Archivo: static/css/tables.css
 * Versión: 2.0 - Paleta LGBT+
 */

:root {
    /* Pasteles suaves LGBT+ */
    --pastel-purple: #FAE8FF;
    --pastel-purple-light: #F5D0FE;
    --pastel-green: #D1FAE5;
    --pastel-yellow: #FEF3C7;
    --pastel-blue: #E0E7FF;
    --pastel-pink: #FCE7F3;
    --pastel-celeste: #D1EEF0;
    
    /* Colores fuertes LGBT+ */
    --strong-purple: #7C3AED;
    --strong-purple-dark: #5B21B6;
    --strong-pink: #D946EF;
    --strong-green: #10B981;
    --strong-green-dark: #059669;
    
    /* Grises neutros */
    --text-dark: #1F2937;
    --text-medium: #4B5563;
    --text-muted: #9CA3AF;
    --bg-light: #F9FAFB;
    --border-light: #E5E7EB;
}

/* ========================================
   TABLA PRINCIPAL
======================================== */

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.table-wrapper {
    overflow-x: auto;
}

.table-laola {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}

/* ========================================
   ENCABEZADO DE TABLA - MORADO FUERTE
======================================== */

.table-laola thead {
    background: linear-gradient(135deg, var(--strong-purple), var(--strong-purple-dark));
}

.table-laola thead th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
}

.table-laola thead th:first-child {
    border-top-left-radius: 0;
}

.table-laola thead th:last-child {
    border-top-right-radius: 0;
}

/* Icono de ordenamiento */
.table-sort-icon {
    margin-left: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.table-laola thead th:hover .table-sort-icon {
    opacity: 1;
}

/* ========================================
   CUERPO DE TABLA
======================================== */

.table-laola tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.table-laola tbody tr:hover {
    background: var(--pastel-purple);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table-laola tbody tr:last-child {
    border-bottom: none;
}

.table-laola tbody td {
    padding: 1rem 1.25rem;
    color: var(--text-dark);
    vertical-align: middle;
}

/* ========================================
   ESTILOS DE CELDAS
======================================== */

/* Celda con avatar */
.table-cell-avatar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.table-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--strong-purple), var(--strong-purple-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.table-cell-info {
    display: flex;
    flex-direction: column;
}

.table-cell-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.table-cell-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   BADGES EN TABLAS - PASTELES SUAVES
======================================== */

.table-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.table-badge-success {
    background: var(--pastel-green);
    color: var(--strong-green-dark);
}

.table-badge-warning {
    background: var(--pastel-yellow);
    color: #92400E;
}

.table-badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.table-badge-info {
    background: var(--pastel-blue);
    color: #3730A3;
}

.table-badge-purple {
    background: var(--pastel-purple);
    color: var(--strong-purple-dark);
}

/* ========================================
   ACCIONES EN TABLA - BOTONES FUERTES
======================================== */

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.table-action-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    font-weight: 600;
}

.table-action-btn-primary {
    background: var(--strong-purple);
    color: white;
}

.table-action-btn-primary:hover {
    background: var(--strong-purple-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(124, 58, 237, 0.3);
}

.table-action-btn-secondary {
    background: #F3F4F6;
    color: var(--text-muted);
}

.table-action-btn-secondary:hover {
    background: var(--border-light);
}

.table-action-btn-success {
    background: var(--strong-green);
    color: white;
}

.table-action-btn-success:hover {
    background: var(--strong-green-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.table-action-btn-danger {
    background: #DC2626;
    color: white;
}

.table-action-btn-danger:hover {
    background: #B91C1C;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

/* ========================================
   TABLA VACÍA
======================================== */

.table-empty {
    text-align: center;
    padding: 3rem 1.5rem;
}

.table-empty-icon {
    font-size: 4rem;
    color: var(--strong-purple);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.table-empty-text {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.table-empty-action {
    margin-top: 1.5rem;
}

/* ========================================
   PAGINACIÓN
======================================== */

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-light);
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pagination-info strong {
    color: var(--text-dark);
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-light);
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dark);
    font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--strong-purple);
    color: var(--strong-purple);
    background: var(--pastel-purple);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--strong-purple);
    color: white;
    border-color: var(--strong-purple);
}

/* ========================================
   FILTROS Y BÚSQUEDA
======================================== */

.table-filters {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    align-items: center;
}

.table-search {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.table-search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.table-search-input:focus {
    outline: none;
    border-color: var(--strong-purple);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.table-search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.table-filter-select {
    padding: 0.625rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-filter-select:focus {
    outline: none;
    border-color: var(--strong-purple);
}

/* ========================================
   TABLA RESPONSIVA
======================================== */

@media (max-width: 768px) {
    .table-laola {
        font-size: 0.85rem;
    }
    
    .table-laola thead th,
    .table-laola tbody td {
        padding: 0.75rem 1rem;
    }
    
    .table-actions {
        flex-direction: column;
        gap: 0.35rem;
    }
    
    .table-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .table-pagination {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination-controls {
        width: 100%;
        justify-content: center;
    }
    
    .table-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-search {
        min-width: 100%;
    }
}

/* ========================================
   TABLA COMPACTA (Variante)
======================================== */

.table-laola.table-compact thead th,
.table-laola.table-compact tbody td {
    padding: 0.75rem 1rem;
}

.table-laola.table-compact {
    font-size: 0.9rem;
}

/* ========================================
   TABLA CON HOVER DESTACADO
======================================== */

.table-laola.table-hover tbody tr:hover {
    background: var(--pastel-purple);
    border-left: 3px solid var(--strong-purple);
}

/* ========================================
   TABLA CON BORDES
======================================== */

.table-laola.table-bordered {
    border: 1px solid var(--border-light);
}

.table-laola.table-bordered thead th,
.table-laola.table-bordered tbody td {
    border-right: 1px solid var(--border-light);
}

.table-laola.table-bordered thead th:last-child,
.table-laola.table-bordered tbody td:last-child {
    border-right: none;
}

/* ========================================
   LOADING STATE
======================================== */

.table-loading {
    text-align: center;
    padding: 3rem;
}

.table-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top-color: var(--strong-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}