/* ========================================================
   ARCHIVO DE TABLAS - HORARIOS Y LISTAS
   ======================================================== */

/* ==================== TABLAS GENERALES ==================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    margin-bottom: 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background: var(--bg-primary);
}

th {
    background: var(--bg-primary);
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 18px 15px;
    border: 1px solid var(--border-light);
    text-align: center;
}

td {
    border: 1px solid var(--border-light);
    padding: 16px 15px;
    text-align: center;
    height: 85px;
    vertical-align: middle;
    color: var(--text-primary);
    font-weight: 400;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--bg-primary);
}

/* ==================== CELDAS ESPECIALES ==================== */
td.drop-zone-hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--color-secondary);
    box-shadow: inset 0 0 0 2px var(--color-secondary);
}

/* ==================== TABLA DE HORARIOS PRINCIPAL ==================== */
#main-schedule-table {
    min-width: 800px;
}

#main-schedule-table th:first-child {
    width: 150px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

#main-schedule-table td:first-child {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== VISTA GLOBAL DE HORARIOS ==================== */
.global-list-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.global-schedule-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.global-schedule-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.global-group-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
}

.global-group-header h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
}

.global-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
}

.global-table th {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-accent) 100%);
    color: var(--text-light);
    padding: 16px 12px;
    font-size: 0.8rem;
}

.global-table td {
    padding: 14px 12px;
    height: auto;
    min-height: 70px;
}

.global-table .subject-block {
    margin: 0;
    padding: 8px;
    font-size: 0.85rem;
}

/* ==================== TABLA DE MAESTROS ==================== */
#teacher-list-body tr {
    transition: all 0.3s ease;
}

#teacher-list-body tr:hover {
    background: var(--bg-primary);
    transform: scale(1.01);
}

#teacher-list-body td {
    padding: 20px 15px;
    height: auto;
}

#teacher-list-body td:first-child {
    font-weight: 600;
    color: var(--color-secondary);
}

#teacher-list-body td:last-child {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    border: none;
}

/* ==================== RESPONSIVE PARA TABLAS ==================== */
@media (max-width: 1024px) and (min-width: 769px) {
    /* Tabletas */
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 14px 12px;
    }
}

@media (max-width: 768px) {
    /* Móviles y tabletas pequeñas */
    .schedule-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        border-radius: 14px;
        /* Indicador visual de scroll */
        position: relative;
    }
    
    .schedule-container::after {
        content: '← Desliza →';
        position: sticky;
        right: 0;
        bottom: 10px;
        background: var(--color-secondary);
        color: var(--text-light);
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 0.7rem;
        font-weight: 600;
        display: inline-block;
        float: right;
        margin-top: 10px;
        box-shadow: var(--shadow-md);
        animation: pulseScroll 2s ease-in-out infinite;
    }
    
    @keyframes pulseScroll {
        0%, 100% { opacity: 0.7; transform: scale(1); }
        50% { opacity: 1; transform: scale(1.05); }
    }
    
    table {
        font-size: 0.8rem;
        min-width: 650px;
        border-radius: 10px;
    }
    
    th, td {
        padding: 12px 10px;
        font-size: 0.75rem;
    }
    
    td {
        height: 75px;
    }
    
    #main-schedule-table th:first-child {
        width: 110px;
        position: sticky;
        left: 0;
        z-index: 10;
        background: var(--bg-primary);
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
    }
    
    #main-schedule-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 9;
        background: var(--bg-primary);
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
    }
    
    .subject-block {
        font-size: 0.75rem;
        padding: 8px;
        border-radius: 6px;
    }
    
    /* Vista global responsive */
    .global-schedule-item {
        padding: 20px 15px;
        border-radius: 16px;
        margin-bottom: 20px;
    }
    
    .global-group-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .global-group-header h2 {
        font-size: 1.6rem;
    }
    
    .global-table {
        font-size: 0.75rem;
        min-width: 600px;
    }
    
    .global-table th {
        padding: 12px 10px;
        font-size: 0.7rem;
    }
    
    .global-table td {
        padding: 10px 8px;
        min-height: 65px;
    }
    
    .global-table .subject-block {
        padding: 6px;
        font-size: 0.7rem;
    }
    
    /* Tabla de maestros */
    #teacher-list-body td {
        padding: 15px 12px;
    }
    
    #teacher-list-body td:last-child {
        flex-direction: column;
        gap: 8px;
    }
    
    #teacher-list-body td:last-child button {
        width: 100%;
        font-size: 0.75rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    /* Móviles pequeños */
    .schedule-container {
        padding: 10px;
        border-radius: 12px;
    }
    
    .schedule-container::after {
        font-size: 0.65rem;
        padding: 5px 10px;
    }
    
    table {
        font-size: 0.7rem;
        min-width: 550px;
    }
    
    th, td {
        padding: 10px 8px;
        font-size: 0.7rem;
    }
    
    td {
        height: 65px;
    }
    
    #main-schedule-table th:first-child {
        width: 100px;
    }
    
    .subject-block {
        font-size: 0.7rem;
        padding: 6px;
    }
    
    .global-list-container {
        gap: 20px;
    }
    
    .global-schedule-item {
        padding: 15px 12px;
        border-radius: 14px;
    }
    
    .global-group-header {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }
    
    .global-group-header h2 {
        font-size: 1.4rem;
    }
    
    .global-table {
        min-width: 500px;
    }
    
    .global-table th {
        padding: 10px 8px;
        font-size: 0.65rem;
    }
    
    .global-table td {
        padding: 8px 6px;
        min-height: 60px;
    }
    
    .global-table .subject-block {
        padding: 5px;
        font-size: 0.65rem;
    }
    
    #teacher-list-body td {
        padding: 12px 10px;
    }
    
    #teacher-list-body td:last-child button {
        font-size: 0.7rem;
        padding: 7px 10px;
    }
}

/* ==================== ORIENTACIÓN LANDSCAPE ==================== */
@media (orientation: landscape) and (max-height: 500px) {
    .schedule-container {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 10px 8px;
    }
}

/* ==================== SCROLLBAR PERSONALIZADO PARA TABLAS ==================== */
.schedule-container::-webkit-scrollbar {
    height: 8px;
}

.schedule-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent);
}
