/* ============================================================
   styles.css — Comunidad Educativa Mi Guía
   Estilos personalizados (complementa Tailwind CSS)
   ============================================================ */

:root {
    --primary: #0A2342;
    --accent: #FFD700;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}

/* Forzar que el header y el hero ocupen el ancho total de la pantalla */
#siteHeader, .bg-gradient-to-br {
    width: 100% !important;
    max-width: 100vw !important;
    left: 0;
    right: 0;
}

/* --- Scrollbars Personalizados --- */
/* Webkit (Chrome, Safari, Brave, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* --- Tabla de Horarios --- */
.schedule-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border-radius: 1rem;
    width: 100%;
    max-width: 100%;
    border: 1px solid #e2e8f0;
}

.schedule-table {
    min-width: 100%; /* Ajustado para que ocupe todo el contenedor */
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto; /* Permite que las materias con nombres largos no se corten */
}

/* Ancho fijo para la columna de hora para que no varíe entre tablas */
.schedule-table th:first-child,
.schedule-table td:first-child {
    width: 95px;
    min-width: 95px;
}

.schedule-table td,
.schedule-table th {
    padding: 14px 8px; /* Más padding para celdas más robustas */
    text-align: center;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    line-height: 1.2;
    word-wrap: break-word; /* Evita que el texto largo rompa la tabla */
}

/* Primera columna fija al hacer scroll horizontal */
.schedule-table th:first-child,
.schedule-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 30;
    background-color: #f8fafc !important;
    border-right: 2px solid #e2e8f0;
    font-weight: 800;
    min-width: 90px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.schedule-table thead th:first-child {
    z-index: 40;
    background-color: #f1f5f9 !important;
}

/* --- Modo Administrador: hover en celdas --- */
.admin-mode td:not([colspan]):hover {
    outline: 2px solid var(--accent);
    cursor: cell;
    background-color: rgba(255, 215, 0, 0.05);
    z-index: 5;
}

/* --- Área de código generado --- */
#codeArea {
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    white-space: pre;
    background: #111827;
    color: #10b981;
    border-radius: 12px;
    padding: 20px;
    line-height: 1.5;
}

/* --- Título editable (modo admin) --- */
.editable-title:focus {
    outline: none;
    border-bottom: 2px solid var(--accent);
}

/* --- Botones de herramientas del admin --- */
.tool-btn {
    background-color: #ffffff;
    color: var(--primary);
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.tool-btn:hover {
    background-color: #f8fafc;
    border-color: var(--accent);
    transform: translateY(-1px);
}

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

/* --- Botones de historial (undo/redo) --- */
.history-btn {
    background-color: #334155;
    color: #ffffff;
    padding: 0.5rem 0.9rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.history-btn:hover:not(:disabled) {
    background-color: #475569;
}

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

/* --- Optimizaciones para iOS/iPhone --- */
input, select, textarea {
    font-size: 16px !important; /* Evita zoom automático en Safari iOS al enfocar */
}

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

/* Sombra dinámica cuando hay scroll horizontal */
.schedule-table-container.is-scrolled td:first-child,
.schedule-table-container.is-scrolled th:first-child {
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

/* Indicador de scroll (desliza hacia la derecha) */
@media (max-width: 1024px) {
    .schedule-table-container::after {
        content: '↔ Desliza para ver más';
        position: absolute;
        bottom: 0.5rem;
        right: 1rem;
        background: rgba(10, 35, 66, 0.8);
        color: white;
        font-size: 8px;
        padding: 4px 10px;
        border-radius: 999px;
        pointer-events: none;
        opacity: 0.7;
        font-weight: 800;
        text-transform: uppercase;
        z-index: 50;
    }
    
    .schedule-table-container.is-scrolled::after {
        display: none;
    }
}
