/* static/css/custom.css (VERSIÓN FINAL CON TODO INTEGRADO) */

:root {
    --primary-color: #0d2c54;
    --background-color: #111a21;
    --card-background: #18232c;
    --input-background: #2a3b47;
    --text-color: #e1e1e1;
    --heading-color: #ffffff;
    --border-color: #3a4a58;
    --link-color: #5dade2;
    --button-primary-bg: #2a7ae2;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --error-color: #f44336;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 60px;
}
main { 
    flex-grow: 1;    
    width: 100%;
}
.container { 
    width: 90%; 
    max-width: 1100px; 
    margin: 0 auto;
}
h1, h2, h3, h4, h5, h6 { color: var(--heading-color); }
a { color: var(--link-color); text-decoration: none; }
hr { border: none; border-top: 1px solid var(--border-color); margin: 2rem 0; }

/* --- HEADER Y NAVEGACIÓN --- */
.main-header { 
    background-color: var(--primary-color);
    padding: 10px 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001;
}
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo-container {display: flex; align-items: center; text-decoration: none; }
.logo-container img { height: 40px; margin-right: 10px; }
.logo-container h1 { font-size: 1rem; color: white; line-height: 1.2; margin: 0; }
.main-nav { display: none; }
.user-container { display: none; }
.menu-toggle { display: block; background: none; border: none; font-size: 24px; color: white; cursor: pointer; }

/* --- MENÚ MÓVIL --- */
.mobile-nav {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    padding: 0 5%;
    box-sizing: border-box;
}
.mobile-nav.is-active { display: block; }
.mobile-nav ul { list-style: none; padding: 0; margin: 0; }
.mobile-nav ul a { display: block; padding: 12px 0; color: white; font-weight: bold; border-bottom: 1px solid var(--border-color); }
.mobile-nav .user-actions { padding: 1rem 0; }
.mobile-nav .user-actions .button { display: block; text-align: center; margin-bottom: 10px; }

/* --- FORMULARIOS Y PANELES (ESTILOS RESTAURADOS) --- */
.content-wrapper { max-width: 800px; margin: 2.5rem auto; padding: 2.5rem; background-color: var(--card-background); border: 1px solid var(--border-color); border-radius: 8px; }
.content-wrapper h2 { margin-top: 0; }
.form-field { margin-bottom: 1.5rem; }
.form-field label { display: block; font-weight: bold; margin-bottom: 0.5rem; }
.content-wrapper input[type="text"], .content-wrapper input[type="email"], .content-wrapper input[type="password"], .content-wrapper input[type="date"], .content-wrapper input[type="file"], .content-wrapper select {
    width: 100%; padding: 12px; background-color: var(--input-background); border: 1px solid var(--border-color); border-radius: 5px; color: var(--text-color); font-size: 1rem; box-sizing: border-box;
}
.content-wrapper fieldset { border: 1px solid var(--border-color); padding: 1.5rem; border-radius: 8px; margin-bottom: 2rem; }
.content-wrapper legend { font-weight: bold; font-size: 1.2rem; padding: 0 10px; color: var(--heading-color); }
.radio-option { margin-bottom: 0.5rem; }
.checkbox-label, .radio-label { display: inline-block; font-weight: normal; }

/* --- TARJETAS DE EVENTOS (ESTILOS RESTAURADOS) --- */
.home-title { text-align: center; margin: 2.5rem 0; }
.event-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.event-card { background-color: var(--card-background); border: 1px solid var(--border-color); border-radius: 8px; padding: 20px; transition: transform 0.2s; display: flex; flex-direction: column; }
.event-card:hover { transform: translateY(-5px); }
.event-card header strong { font-size: 1.1rem; }
.event-card p { flex-grow: 1; }
.event-card footer { margin-top: auto; }

/* --- BOTONES (TU VERSIÓN) --- */
.button { display: inline-block; padding: 10px 20px; border: none; border-radius: 5px; font-weight: bold; text-align: center; cursor: pointer; font-size: 0.9rem; text-decoration: none; }
.button-primary { background-color: var(--link-color); color: var(--heading-color); }
.button-secondary { background-color: var(--link-color); color: var(--heading-color); }
.button-outline { border: 1px solid var(--link-color); color: var(--link-color); background: transparent; }
.content-wrapper button { width: 100%; }

/* REGLA GRID */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem; /* <-- ESTA ES LA LÍNEA MÁGICA */
}

/* --- FOOTER --- */
.main-footer { background-color: var(--primary-color); color: #ccc; padding: 1.5rem 1rem; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 1fr; text-align: center; gap: 20px; }
.footer-grid h4 { color: white; margin: 0 0 10px 0; }
.footer-grid p { margin: 0; }
.main-footer a { color: white; }
.footer-bottom { text-align: center; margin-top: 1.5rem; border-top: 1px solid #335; padding-top: 1.5rem; font-size: 0.8rem; }

/* --- MEDIA QUERIES PARA ESCRITORIO --- */
@media (min-width: 992px) {
    body { padding-top: 65px; }
    .menu-toggle, .mobile-nav { display: none !important; }
    .main-nav, .user-container { display: flex; }
    .main-nav ul { list-style: none; margin: 0; display: flex; gap: 30px; }
    .event-grid { grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; text-align: left; }

    /* Estilos del menú de usuario en escritorio */
    .user-container .user-menu details { position: relative; }
    .user-container .user-menu summary { list-style: none; cursor: pointer; font-weight: bold; color: var(--primary-color); background-color: white; padding: 8px 15px; border-radius: 5px; }
    .user-container .user-menu summary::-webkit-details-marker { display: none; }
    .user-container .user-menu ul { position: absolute; top: 120%; right: 0; background-color: white; border: 1px solid #ddd; border-radius: 5px; padding: 5px 0; list-style: none; width: 220px; z-index: 1001; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
    .user-container .user-menu ul li a, .user-container .user-menu ul li button { display: block; width: 100%; padding: 8px 15px; color: #333; text-decoration: none; font-size: 0.9rem; text-align: left; background: none; border: none; cursor: pointer; }
    .user-container .user-menu ul li a:hover, .user-container .user-menu ul li button:hover { background-color: #f0f0f0; }
}

/* --- ESTILOS PARA EL MÓDULO DE NOTICIAS --- */
.news-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.news-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden; /* Para que la imagen respete los bordes redondeados */
    display: flex;
    flex-direction: column;
}
.news-card img {
    width: 100%;
    height: 200px; /* Altura fija para la imagen de previsualización */
    object-fit: cover; /* Asegura que la imagen cubra el espacio sin deformarse */
}
.news-card .card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.news-card h3 {
    margin-top: 0;
}
.news-card .read-more {
    margin-top: auto; /* Empuja el enlace "Leer más" al final */
    font-weight: bold;
}

/* Estilos para la vista de detalle */
.full-news .main-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin: 1rem 0;
}
.full-news .news-content {
    margin-top: 1.5rem;
    line-height: 1.8;
}

@media (min-width: 768px) {
    .news-card {
        flex-direction: row; /* En escritorio, imagen a la izquierda, texto a la derecha */
    }
    .news-card img {
        width: 250px;
        height: auto;
    }
}

/* Al final de custom.css */
.feed-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .feed-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}