/* ===== ESTILOS ESPECÍFICOS PARA TABLAS RESPONSIVAS ===== */

/* Contenedor de tabla */
.table-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    overflow: hidden;
    margin: 2rem 0;
}

/* Tabla principal */
.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

/* Encabezados de tabla */
.table thead th {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table thead th:first-child {
    border-top-left-radius: 15px;
}

.table thead th:last-child {
    border-top-right-radius: 15px;
}

/* Celdas de tabla */
.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    color: #2c3e50;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Filas alternadas */
.table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Hover en filas */
.table tbody tr:hover {
    background-color: #e3f2fd;
    transform: scale(1.01);
    transition: all 0.3s ease;
}

/* Badges y estados */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.badge-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

/* Botones de acción en tabla */
.table .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    margin: 0.125rem;
}

.table .btn-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Iconos en tabla */
.table .icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Texto truncado */
.table .text-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Filtros de tabla */
.table-filters {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.table-filters .form-group {
    margin-bottom: 0;
    min-width: 200px;
}

.table-filters .form-control,
.table-filters .form-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Paginación */
.table-pagination {
    background: #f8f9fa;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e9ecef;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.875rem;
}

.pagination {
    margin: 0;
    display: flex;
    gap: 0.25rem;
}

.page-link {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    background: white;
    color: #3498db;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-1px);
}

.page-item.active .page-link {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.page-item.disabled .page-link {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Búsqueda en tabla */
.table-search {
    position: relative;
    min-width: 250px;
}

.table-search .form-control {
    padding-left: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 1rem;
}

/* ===== RESPONSIVE DESIGN PARA TABLAS ===== */

/* Tablets */
@media (max-width: 768px) {
    .table-container {
        margin: 1rem 0;
        border-radius: 12px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .table-filters {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .table-filters .form-group {
        min-width: 150px;
    }
    
    .table-pagination {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .table-search {
        min-width: 200px;
    }
    
    /* Ocultar columnas menos importantes */
    .table-responsive .d-none-tablet {
        display: none !important;
    }
}

/* Móviles */
@media (max-width: 576px) {
    .table-container {
        margin: 0.5rem 0;
        border-radius: 10px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .table thead th {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    .table-filters {
        padding: 0.5rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-filters .form-group {
        min-width: auto;
        width: 100%;
    }
    
    .table-pagination {
        padding: 0.5rem;
        text-align: center;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .table-search {
        min-width: auto;
        width: 100%;
    }
    
    .table .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .table .btn-group {
        flex-direction: column;
        gap: 0.125rem;
    }
    
    .badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Ocultar más columnas en móviles */
    .table-responsive .d-none-mobile {
        display: none !important;
    }
    
    /* Vista de tarjetas para móviles */
    .table-responsive {
        overflow: visible;
    }
    
    .table-responsive .table {
        display: block;
    }
    
    .table-responsive .table thead {
        display: none;
    }
    
    .table-responsive .table tbody {
        display: block;
    }
    
    .table-responsive .table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 1rem;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }
    
    .table-responsive .table tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    
    .table-responsive .table td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
        position: relative;
    }
    
    .table-responsive .table td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #6c757d;
        min-width: 120px;
        display: inline-block;
        margin-right: 0.5rem;
    }
    
    .table-responsive .table .actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .table-responsive .table .actions:before {
        content: "Acciones: ";
        font-weight: 600;
        color: #6c757d;
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

/* Móviles muy pequeños */
@media (max-width: 375px) {
    .table thead th,
    .table tbody td {
        padding: 0.375rem 0.125rem;
        font-size: 0.75rem;
    }
    
    .table thead th {
        font-size: 0.7rem;
        padding: 0.375rem 0.125rem;
    }
    
    .table-filters {
        padding: 0.375rem;
    }
    
    .table-pagination {
        padding: 0.375rem;
    }
    
    .page-link {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }
    
    .table .btn {
        padding: 0.125rem 0.375rem;
        font-size: 0.7rem;
    }
    
    .badge {
        padding: 0.125rem 0.375rem;
        font-size: 0.65rem;
    }
    
    /* Ocultar aún más columnas */
    .table-responsive .d-none-mobile-sm {
        display: none !important;
    }
}

/* ===== TABLA DE TARJETAS PARA MÓVILES ===== */

/* Convertir tabla a tarjetas en móviles */
@media (max-width: 576px) {
    .table-card-view {
        display: block;
    }
    
    .table-card-view thead {
        display: none;
    }
    
    .table-card-view tbody {
        display: block;
    }
    
    .table-card-view tr {
        display: block;
        background: white;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .table-card-view td {
        display: block;
        border: none;
        padding: 0.5rem 0;
        text-align: left;
    }
    
    .table-card-view td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #2c3e50;
        display: inline-block;
        width: 120px;
    }
    
    .table-card-view .actions {
        text-align: center;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #e9ecef;
    }
    
    .table-card-view .actions:before {
        display: none;
    }
}

/* ===== ANIMACIONES PARA TABLAS ===== */

@keyframes tableSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-container {
    animation: tableSlideIn 0.5s ease-out;
}

@keyframes rowHighlight {
    0% {
        background-color: #e3f2fd;
    }
    100% {
        background-color: transparent;
    }
}

.table tbody tr.highlight {
    animation: rowHighlight 2s ease-out;
}

/* ===== ESTADOS ESPECIALES ===== */

/* Tabla vacía */
.table-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.table-empty .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Tabla cargando */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.table-loading::before {
    content: '⏳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 11;
}

/* ===== UTILIDADES ===== */

.table-sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-sortable th {
    cursor: pointer;
    user-select: none;
}

.table-sortable th:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
}

.table-sortable th::after {
    content: '↕';
    margin-left: 0.5rem;
    opacity: 0.5;
}

.table-sortable th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.table-sortable th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

.table-selectable tbody tr {
    cursor: pointer;
}

.table-selectable tbody tr.selected {
    background-color: #e3f2fd;
    border-left: 4px solid #3498db;
}

.table-export {
    margin-bottom: 1rem;
}

.table-export .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
} 