/* =========================================
   1. VARIABLES Y CONFIGURACIÓN GLOBAL
   ========================================= */
:root {
    --primary-color: #016301;    /* Verde Institucional */
    --secondary-color: #f8f9fa;  
    --accent-color: #e67e22;     
    --text-dark: #333;
    --text-light: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 10px;
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body { 
    font-family: 'Segoe UI', Arial, sans-serif; 
    background-color: var(--secondary-color);
    margin: 0; 
    padding: 0; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    color: var(--text-dark);
    line-height: 1.6;
}

/* =========================================
   2. HEADER Y NAVEGACIÓN (SISAG OPTIMIZADO)
   ========================================= */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background-color: #ffffff;
    border-bottom: 5px solid #2e7d32;
    height: 120px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.header-left {
    width: 350px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

header img.escudo {
    height: 90px;
    width: auto;
    margin-left: -10px;
}

.header-titles {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.header-titles h1 {
    font-size: 2.8rem;
    color: #2e7d32;
    margin: 0;
    font-weight: 900;
    letter-spacing: 5px;
    line-height: 1.1;
}

.header-titles p {
    font-size: 1rem;
    color: #333;
    margin: 2px 0 0 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

nav {
    width: 350px;
    display: flex;
    gap: 7px;
    justify-content: flex-end;
}

nav a {
    text-decoration: none;
    color: #2e7d32;
    background-color: #ffffff;
    border: 2px solid #2e7d32;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

nav a:hover {
    background-color: #2e7d32;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.2);
}

nav a.logout-link {
    color: #c62828;
    border-color: #c62828;
}

nav a.logout-link:hover {
    background-color: #c62828;
    color: #ffffff !important;
}

/* =========================================
   3. RESPONSIVE (MÓVIL)
   ========================================= */
@media (max-width: 950px) {
    header {
        flex-direction: column;
        padding: 20px;
        text-align: center;
        height: auto;
    }
    .header-left, nav {
        width: 100%;
        justify-content: center;
        margin-bottom: 15px;
    }
    .header-titles h1 { font-size: 1.5rem; letter-spacing: 3px; }
    .header-titles p { font-size: 0.9rem; }

    main { padding: 15px; }

    .carrusel-contenedor { padding: 20px 0; }
    .noticia-item { min-width: 260px; max-width: 340px; }

    .news-container { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }

    .form-container { padding: 20px; margin: 15px auto; }

    .perfil-header-flex { flex-direction: column; text-align: center; gap: 15px; }
    .info-texto, .info-texto h2 { text-align: center; }
    .foto-perfil-grande { width: 90px; height: 90px; }

    .admin-item-noticia { flex-direction: column; align-items: stretch; gap: 10px; text-align: center; }
}

@media (max-width: 480px) {
    .header-titles h1 { font-size: 1.15rem; letter-spacing: 1px; }
    .header-titles p { font-size: 0.75rem; }
    nav { flex-wrap: wrap; }
    nav a { padding: 10px 14px; font-size: 0.78rem; }

    .noticia-item { min-width: 100%; max-width: 100%; }
    .carrusel-track { gap: 15px; }

    .news-container { grid-template-columns: 1fr; }

    .form-container { padding: 15px; }
    h2 { font-size: 1.2rem; }
}

/* =========================================
   4. ESTRUCTURA PRINCIPAL (MAIN)
   ========================================= */
main {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 25px;
}

/* =========================================
   5. CARRUSEL DE IMÁGENES (NUEVO EFECTO)
   ========================================= */
.carrusel-contenedor {
    width: 100%;
    overflow: hidden;
    padding: 40px 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.carrusel-track {
    display: flex; /* Esto las pone en fila */
    align-items: center;
    gap: 20px;
    transition: transform 0.6s ease;
    will-change: transform;
}

/* Ajuste para las noticias en el carrusel */
.noticia-item {
    min-width: 300px;
    max-width: 400px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.5s ease;
    opacity: 0.5; /* Las que no están centradas se ven más claras */
    transform: scale(0.8);
}

/* Cuando la noticia está activa (en el centro) */
.noticia-item.active {
    opacity: 1;
    transform: scale(1.1); /* La noticia central se agranda */
    border: 2px solid #006400;
}

.noticia-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.noticia-item h3 {
    padding: 15px;
    color: #006400;
    text-align: center;
}

.noticia-item.active h3 {
    opacity: 1;
}

/* =========================================
   6. GRID DE ÚLTIMAS NOVEDADES
   ========================================= */
.news-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.card { 
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.card img { 
    width: 100%; 
    height: 200px; 
    object-fit: cover; 
}

.card-body { 
    padding: 20px; 
}

.card-title { 
    font-size: 1.2rem; 
    color: var(--primary-color); 
    margin: 0;
}

/* =========================================
   7. ADMIN Y FORMULARIOS
   ========================================= */
.form-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 8px;
}

input[type="text"], textarea, input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

.btn-submit {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    width: 100%;
    cursor: pointer;
    margin-top: 20px;
    transition: var(--transition);
}

.btn-submit:hover {
    background-color: #004d00;
}

.admin-item-noticia {
    background: white;
    padding: 15px;
    margin: 10px auto;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.btn-borrar {
    background-color: #d9534f;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* =========================================
   8. FOOTER
   ========================================= */
footer { 
    background: #e9ecef; 
    text-align: center; 
    padding: 20px; 
    margin-top: auto; 
    border-top: 1px solid #dee2e6;
}

/* =========================================
   9. PERFIL DE USUARIO
   ========================================= */
.user-info-box {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.perfil-header-flex {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    padding: 10px 0;
}

.info-texto {
    text-align: left;
}

.info-texto h2 {
    text-align: left; 
    margin: 0;
    color: #2e7d32;
    font-size: 1.8rem;
}

.foto-perfil-grande {
    width: 110px;  
    height: 110px;
    border-radius: 12px; 
    object-fit: cover;
    border: 3px solid #2e7d32;
    box-shadow: var(--shadow);
}