body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    overflow-x: hidden;
}

/* ── Header ── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #1a1a1a;
    position: relative;
    z-index: 1000;
    border-bottom: 1px solid #2d2d2d;
    box-sizing: border-box;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffffff;
}

.nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: #cccccc;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #ffffff;
}

/* ── Layout ── */
.layout-container {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    margin: 2rem 0;
    padding: 0 2rem;
    gap: 2rem;
}

.main-content  { flex: 3; }

.sidebar-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Hero / Noticia ── */
.hero {
    background-color: #1e222b;
    border: 1px solid #2d3139;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hero-content h1 {
    color: #ffffff;
    margin-top: 0;
    font-size: 2.2rem;
}

.hero-content p {
    color: #94a3b8;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.main-article {
    background-color: #161920;
    border-left: 4px solid #3b82f6;
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
}

.news-date {
    color: #3b82f6;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.main-article h2 {
    color: #ffffff;
    margin: 0.5rem 0 1rem 0;
    font-size: 1.5rem;
}

.main-article p {
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.btn-read-more {
    display: inline-block;
    color: #3b82f6;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease, transform 0.2s ease;
}

.btn-read-more:hover {
    color: #60a5fa;
    transform: translateX(4px);
}

/* ── Sidebar ── */
.moodle-panel {
    background-color: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    padding: 1rem;
}

.btn-moodle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #ffffff;
    text-decoration: none;
    background-color: #2d2d2d;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-moodle:hover { background-color: #3b82f6; }

.btn-moodle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ── Menú hamburguesa ── */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

/* ── Carrusel ── */
.carousel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* NUEVO: El carrusel calculará su alto automáticamente */
    margin: 2rem 0 0 0;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #2d3139;
}

/* Nota: Si usas aspect-ratio, asegúrate de mantener .carousel-track y .carousel-slide con height: 100% */

.carousel-track-container {
    position: relative;
    width: 100%;
    /* Transición si usas el Truco 1 */
    transition: height 300ms ease-in-out; 
}

.carousel-track {
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative;
    width: 100%;
    /* height: 100%; <-- ELIMINADO */
    display: flex;
    transition: transform 300ms ease-in-out;
}
/* NUEVO: Asegura el tamaño de cada diapositiva */

.carousel-slide {
    width: 100%;       
    /* height: 100%; <-- ELIMINADO */
    flex-shrink: 0;    
}

.carousel-slide img {
    width: 100%;
    height: auto;
    /* TRUCO: Si viene una foto muy vertical, no estirará el diseño infinito */
    max-height: 550px; 
    /* Mantiene la foto entera y centrada si llega a tocar el tope de 550px */
    object-fit: contain; 
    display: block;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(22, 25, 32, 0.8);
    border: 1px solid #2d3139;
    color: #ffffff;
    padding: 0.8rem 1rem;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
}

.carousel-button-left  { left: 15px; }
.carousel-button-right { right: 15px; }

.carousel-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    position: absolute;
    bottom: 15px;
    width: 100%;
    z-index: 10;
}

.carousel-indicator {
    border: 0;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

.carousel-indicator.current-slide {
    background: #3b82f6;
    width: 25px;
    border-radius: 5px;
}

.is-hidden { display: none; }

/* ── Historial de noticias ── */
.news-history-panel {
    background-color: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.news-history-panel h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #ffffff;
    border-bottom: 1px solid #2d2d2d;
    padding-bottom: 0.5rem;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-list li {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-date {
    font-size: 0.75rem;
    color: #8aa4cc;
    font-weight: bold;
}

.history-link {
    color: #cccccc;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.history-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* ── Footer ── */
.main-footer {
    background-color: #1a1a1a;
    border-top: 1px solid #2d2d2d;
    margin-top: 4rem;
    padding: 3rem 1rem 1.5rem 1rem;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
}

.footer-card {
    background-color: #161920;
    border: 1px solid #2d3139;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.footer-card h3 {
    color: #ffffff;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #3b82f6;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.footer-card p {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.social-icon {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.social-icon:hover {
    color: #60a5fa;
    transform: translateX(4px);
}

.footer-bottom {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #2d2d2d;
    color: #64748b;
    font-size: 0.85rem;
}

/* ── GridView ── */
.grid-view {
    background: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 1.25rem;
    margin-bottom: 2rem;
    border: 1px solid #2d2d2d;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.grid-view .table {
    margin-bottom: 0;
    vertical-align: middle;
    width: 100%;
    color: #e0e0e0;
    border-collapse: collapse;
}

.grid-view .table thead th {
    background-color: #252525;
    color: #b0b0b0;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border: 1px solid #2d2d2d;
    border-bottom: 2px solid #2d2d2d;
    padding: 14px 12px;
    white-space: nowrap;
}

.grid-view .table thead th a {
    color: #ffffff;
    text-decoration: none;
    display: inline-block;
}

.grid-view .table thead th a:hover {
    color: #39a0ff;
    text-decoration: underline;
}

.grid-view .filters { background-color: #1a1a1a; }

.grid-view .filters td { padding: 8px 6px !important; }

.grid-view .filters input,
.grid-view .filters select {
    width: 100%;
    border-radius: 4px;
    font-size: 0.85rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid #2d2d2d;
    background-color: #252525;
    color: #ffffff;
    box-sizing: border-box;
}

.grid-view .filters input:focus,
.grid-view .filters select:focus {
    border-color: #39a0ff;
    background-color: #2d2d2d;
    box-shadow: 0 0 0 0.2rem rgba(57, 160, 255, 0.25);
    outline: 0;
}

.grid-view .table tbody td {
    padding: 12px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e0e0e0;
    vertical-align: middle;
    border: 1px solid #2d2d2d !important;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background-color: #1e1e1e !important;
}

.grid-view .table tbody td.text-wrap {
    white-space: normal;
    word-break: break-word;
}

.grid-view .table tbody td:first-child {
    font-weight: 600;
    color: #888888;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.grid-view .table tbody td:last-child {
    white-space: nowrap;
    text-align: center;
    width: 90px;
}

.grid-view .table tbody td.text-number,
.grid-view .table tbody td.text-right { text-align: right; }

.grid-view .table tbody td a {
    margin: 0 4px;
    display: inline-block;
    color: #a0a0a0;
    transition: transform 0.15s ease, color 0.15s ease;
}

.grid-view .table tbody td a:hover {
    transform: scale(1.2);
    color: #39a0ff;
}

.grid-view .table tbody td a[data-method="post"]:hover { color: #ff6b6b; }

.grid-view .table .badge {
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 30px;
    letter-spacing: 0.5px;
}

.grid-view .empty {
    padding: 2rem;
    text-align: center;
    color: #888888;
    font-style: italic;
}

/* Resumen del GridView */
.grid-view .summary {
    color: #8a9bb0;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    display: inline-block;
    background-color: #252525;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #2d2d2d;
}

.grid-view .table-striped tbody tr:nth-of-type(odd) td {
    background-color: #252525 !important;
}

.grid-view .table-hover tbody tr:hover td {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
}

.grid-view .filters td {
    background-color: #1a1a1a !important;
    border-color: #2d2d2d !important;
}

.grid-view .table tbody tr:hover { background-color: #2a2a2a; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .layout-container {
        flex-direction: column;
        padding: 0 1rem;
    }

    .menu-toggle { display: flex; }

    .nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #1a1a1a;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }

    .nav.active { max-height: 300px; }

    .nav ul {
        flex-direction: column;
        padding: 1.5rem;
        gap: 1rem;
        width: 100%;
    }

    .menu-toggle.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .menu-toggle.open span:nth-child(2) { opacity: 0; }
    .menu-toggle.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    .carousel-track-container { height: 220px; }
}




/* === ESTILOS PARA FORMULARIOS NATIVOS DE YII2 (DARK) === */
.form-group {
    margin-bottom: 1.5rem;
}

/* Etiquetas (Labels) */
.form-group label {
    display: block;
    color: #ffffff;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* Inputs, Textareas y Selects de Yii2 */
.form-group .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #161920; /* Fondo oscuro de tarjeta */
    border: 1px solid #2d3139; /* Borde sutil */
    border-radius: 6px;
    color: #e0e0e0; /* Texto claro */
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Efecto Focus (Al hacer clic para escribir) */
.form-group .form-control:focus {
    outline: none;
    background-color: #1a1e26; /* Un tono ligeramente más claro al enfocar */
    border-color: #3b82f6; /* Azul tecnológico institucional */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    color: #ffffff;
}

/* Estilos específicos para elementos Select (Listas desplegables) */
.form-group select.form-control {
    appearance: none; /* Remueve el diseño por defecto del sistema */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://w3.org' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Estilo para los textos de ayuda de Yii2 (Hint block) */
.form-group .hint-block {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: #94a3b8; /* Gris azulado suave */
}

/* Estilo para los mensajes de error de validación (Help block) */
.form-group .help-block {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: #ef4444; /* Rojo vibrante para errores */
}

/* === ESTADOS DE VALIDACIÓN NATIVOS DE YII2 === */

/* Cuando un campo tiene un error (Clase inyectada por Yii2) */
.form-group.has-error .form-control {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.form-group.has-error label {
    color: #f87171; /* Label se vuelve rojo suave */
}

/* Cuando un campo es válido tras la validación AJAX/Client de Yii2 */
.form-group.has-success .form-control {
    border-color: #10b981; /* Verde esmeralda de éxito */
}

/* === BOTONES DE FORMULARIO === */
.btn-primary {
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
    background-color: #2563eb; /* Azul un poco más oscuro al pasar el cursor */
}

.btn-primary:active {
    transform: scale(0.98); /* Efecto de presión sutil */
}



/* === PAra el formulario de Publicación, editor y subir fotos === */

/* Corrección para el borde dashed en modo oscuro */
.border-dashed {
    border-style: dashed !important;
}

/* Lista de archivos seleccionados en formato oscuro */
.list-group-dark .list-group-item {
    background-color: #1a1e26;
    color: #cbd5e1;
    border: 1px solid #2d3139;
}

.list-group-dark .list-group-item:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.list-group-dark .list-group-item:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Modificación de TinyMCE para acoplar la barra de herramientas al fondo */
.tox-tinymce {
    border: 1px solid #2d3139 !important;
    border-radius: 6px !important;
}





/* ── Media Queries para Celulares ── */
@media (max-width: 768px) {
    /* Ajustes generales de espaciado */
    .header, .layout-container {
        padding: 1rem;
    }
    
    /* Mostrar botón hamburguesa y ocultar menú original */
    .menu-toggle {
        display: flex;
    }
    
    .nav {
        display: none; /* Nota: Yii2 requerirá JS para alternar una clase .active */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #1a1a1a;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
        border-bottom: 1px solid #2d2d2d;
    }
    
    .nav.active {
        display: block;
    }
    
    .nav ul {
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }
    
    .nav-link {
        display: block;
        padding: 1rem 2rem;
        border-bottom: 1px solid #252525;
    }
    
    /* Layout: Pasa de 2 columnas a 1 sola columna vertical */
    .layout-container {
        flex-direction: column;
        margin: 1rem 0;
        gap: 1.5rem;
    }
    
    /* Reducción de textos en Hero */
    .hero {
        padding: 1.5rem;
    }
    
    .hero-content h1 {
        font-size: 1.6rem;
    }
    
    /* Carrusel adaptable */
    .carousel-container {
        aspect-ratio: 4 / 3; /* Proporción más cómoda para celulares */
    }
    
    .carousel-button {
        padding: 0.5rem 0.7rem;
    }
    
    /* Cierre de GridView (Línea que faltaba) */
    .grid-view .table thead th {
        letter-spacing: 0.05em;
    }
}
