/* Responsive Tables CSS */
/* Este archivo contiene estilos para hacer las tablas responsivas sin cambiar el diseño original */

/* Contenedor responsivo para tablas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Prevenir que las tablas se desborden */
table {
    min-width: 100%;
    border-collapse: collapse;
}

/* Para móviles - Transformar tabla en cards */
@media screen and (max-width: 768px) {
    /* Ocultar encabezados de tabla en móvil */
    .responsive-table thead {
        display: none;
    }
    
    /* Convertir filas en bloques */
    .responsive-table tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 1rem;
        position: relative;
    }
    
    /* Convertir celdas en filas */
    .responsive-table tbody td {
        display: block;
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    /* Agregar labels antes de cada celda */
    .responsive-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        text-align: left;
        font-weight: bold;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Primera celda sin padding superior */
    .responsive-table tbody td:first-child {
        padding-top: 0;
    }
    
    /* Última celda sin padding inferior */
    .responsive-table tbody td:last-child {
        padding-bottom: 0;
    }
    
    /* Ajustar botones en móvil */
    .responsive-table .btn,
    .responsive-table .btn-action {
        font-size: 0.875rem;
        padding: 0.4rem 0.8rem;
        margin: 0.2rem;
    }
    
    /* Ajustar contenedor de acciones */
    .responsive-table .actions-container {
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}

/* Tabla con scroll horizontal para mantener diseño */
@media screen and (max-width: 768px) {
    .table-scroll {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-scroll table {
        min-width: 600px;
    }
    
    /* Indicador de scroll */
    .table-scroll::-webkit-scrollbar {
        height: 8px;
    }
    
    .table-scroll::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .table-scroll::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }
    
    .table-scroll::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* Ajustes para tablets */
@media screen and (max-width: 992px) {
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    .btn-action {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
}

/* Hacer celdas más compactas en móvil */
@media screen and (max-width: 576px) {
    .table-responsive table {
        font-size: 0.85rem;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.4rem;
    }
}

/* Estilos para indicar que se puede hacer scroll */
.table-scroll-indicator {
    position: relative;
    overflow: hidden;
}

.table-scroll-indicator::after {
    content: '→';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
    padding: 1rem 2rem 1rem 3rem;
    font-size: 1.5rem;
    color: #666;
    pointer-events: none;
    animation: scroll-hint 2s ease-in-out infinite;
}

@keyframes scroll-hint {
    0%, 100% { opacity: 0.3; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(5px); }
}

/* Ocultar indicador cuando no hay scroll */
.table-scroll-indicator.no-scroll::after {
    display: none;
}

/* Estilos para hacer las badges más pequeñas en móvil */
@media screen and (max-width: 768px) {
    .status-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Ajustar el ancho de columnas específicas en móvil */
@media screen and (max-width: 768px) {
    .table-responsive td[data-priority="low"] {
        display: none;
    }
}

/* Mantener visible el contenido importante */
.table-responsive .important {
    font-weight: bold;
    white-space: nowrap;
}

/* Fix para formularios dentro de tablas en móvil */
@media screen and (max-width: 768px) {
    .responsive-table form {
        display: inline-block;
        margin: 0;
    }
    
    .responsive-table form button {
        white-space: nowrap;
    }
}