/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins';
}

/* Definir la fuente Poppins */
@font-face {
    font-family: 'Poppins';
    src: url('https://foro3d.com/articulo/poppins/Poppins-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

/* Estilos generales */
body {
    font-family: 'Poppins', sans-serif;
    font-weight: 200;
    background-color: rgb(57, 57, 57);
    color: #fff;
    line-height: 1.6;
    margin: 0;
    width: 100%;
    overflow-x: hidden;
}

/* Padding solo para escritorio */
@media (min-width: 769px) {
    body {
        padding: 0 30px;
    }
}

/* Para móvil sigue sin padding */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
}
strong {
    color: #32CD32;
}

.contenedor-principal {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* ------------------------- */
/* HEADER OPTIMIZADO */
/* ------------------------- */

#main-header {
    width: 100%;
    background-color: #2a2a2a;
    margin-bottom: 1px;
    border-radius: 0 0 10px 10px;
}

/* Contenedor de imagen superior RESPONSIVE */
.header-top-container {
    width: 100%;
    position: relative;
    background-color: #2a2a2a;
}

/* Contenedor de imagen superior - SIN ESPACIOS */
.header-top {
    width: 100%;
    display: block;
    line-height: 0; /* Elimina espacio fantasma */
    font-size: 0; /* Elimina espacio fantasma */
    background-color: #2a2a2a;
}

/* Imagen de cabecera - ajuste perfecto */
.header-image {
    width: 100%;
    height: auto;
    max-height: 121px;
    display: block;
    object-fit: cover;
    object-position: top center;
}

/* Banner LCI - pegado a la imagen de cabecera */
#imagen-cabecera {
    width: 100%;
    background-color: #2a2a2a;
    padding: 0; /* Eliminamos padding superior/inferior */
    text-align: center;
    line-height: 0; /* Elimina espacio fantasma */
}


#imagen-cabecera img {
    max-width: 800px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Barra de navegación - pegado al banner */
nav.main-nav {
    width: 100%;
    background: linear-gradient(180deg, #3d3d3d, #1e1e1e);
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.nav-menu {
    display: flex;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Buscador */
.search-container {
    flex: 1;
    min-width: 200px;
    max-width: 600px;
    margin-left: 20px;
    display: flex;
}

.search-container form {
    display: flex;
    width: 100%;
}

.textbox {
    flex: 1;
    padding: 8px;
    border-radius: 5px 0 0 5px;
    border: none;
    background-color: #444;
    color: #32CD32;
    font-weight: bold;
}

button[type="submit"] {
    padding: 8px 12px;
    background-color: #666;
    border: none;
    border-radius: 0 5px 5px 0;
    color: white;
    cursor: pointer;
}

button[type="submit"]:hover {
    background-color: #888;
}

/* ------------------------- */
/* MAIN CONTENT */
/* ------------------------- */

main {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: 0.3s;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 15px;
    width: 100%;
    margin: 0 auto;
}

.card {
    background-color: #474747;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.card img {
    width: calc(100% - 30px);
    height: 200px;
    object-fit: cover;
    display: block;
    margin: 15px auto;
    border-radius: 4px;
}

.card-content {
    padding: 0 15px 15px 15px;
    flex-grow: 1;
}

.card-title {
    font-size: 1.3em;
    margin: 0 0 10px;
    color: #FF8C00;
}

.card-description {
    font-size: 1.0em;
    color: #FFF;
}

.card-date {
    font-size: 0.9em;
    color: #FFD700;
}


/* ------------------------- */
/* FOOTER */
/* ------------------------- */

footer {
    background: url('repetitivos/footer-3d.webp') repeat-x center;
    background-size: cover;
    margin: 40px 0 0;
    padding: 0;
    text-align: center;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    height: 121px;
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #2c2f30;
}

footer p {
    margin: 0;
    font-size: 14px;
    color: #fff;
}

footer .footer-info {
    font-size: 12px;
    margin-top: 10px;
    color: #ccc;
}

/* ------------------------- */
/* COMPONENTES ADICIONALES */
/* ------------------------- */

.rss-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 165, 0, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, background 0.3s;
}

.rss-fixed:hover {
    transform: scale(1.1);
    background: rgba(255, 165, 0, 0.3);
}

/* ------------------------- */
/* MEDIA QUERY PARA MÓVIL (768px) - SOLUCIÓN FINAL */
/* ------------------------- */

@media (max-width: 768px) {
    /* Reset completo de espacios */
    body {
        padding: 0; /* ← CERO padding en móvil */
    }
    
    #main-header {
        line-height: 0;
        font-size: 0;
        min-height: 0 !important;
        background-color: #2a2a2a;
    }

    .contenedor-principal {
        padding: 0 10px; /* ← Mínimo padding en móvil */
    }

    .grid {
        padding: 15px 10px; /* ← Padding reducido en móvil */
        grid-template-columns: 1fr; /* ← Una columna en móvil */
        gap: 15px;
    }

    .card {
        margin: 0;
        width: 100%;
    }

    .card img {
        width: calc(100% - 20px); /* ← Menos margen en móvil */
        margin: 10px auto;
    }

    /* Contenedor de imagen */
    .header-top-container {
        min-height: 0;
        height: auto;
        overflow: visible;
    }

    /* Imagen de cabecera */
    .header-top {
        min-height: 0;
        height: auto;
        padding: 0;
        margin: 0;
    }

    .header-image {
        max-height: 80px;
        height: auto;
        object-fit: contain;
    }

    /* Banner LCI */
    #imagen-cabecera {
        padding: 0;
        margin: 0;
    }

    /* Barra de navegación - elimina espacio inferior */
    nav.main-nav {
        margin-bottom: 0;
        padding-bottom: 0;
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }

    /* Buscador - ajuste final */
    .search-container {
        margin-bottom: 0;
        margin-left: 0;
        width: 100%;
    }

    .nav-menu {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .textbox {
        width: calc(100% - 80px);
    }
    
    #imagen-cabecera img {
        width: 100%;
        max-width: 100%;
    }
}

/* ------------------------- */
/* MEDIA QUERY EXTRA PEQUEÑO (480px) */
/* ------------------------- */

@media (max-width: 480px) {
    .contenedor-principal {
        padding: 0 5px; /* ← Mínimo padding en móviles muy pequeños */
    }
    
    .grid {
        padding: 10px 5px;
        gap: 10px;
    }
    
    .card img {
        width: calc(100% - 10px);
        margin: 5px auto;
    }

    .card-content {
        padding: 0 10px 10px 10px;
    }

    .card-title {
        font-size: 1.1em;
    }

    .card-description {
        font-size: 0.9em;
    }
}

/* ------------------------- */
/* ESTILOS PARA ENLACES (CORREGIDOS) */
/* ------------------------- */

/* Enlaces generales */
a {
    color: #FF8C00;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #FF8C00;
    text-decoration: underline;
}

/* Enlaces en la barra de navegación */
.nav-menu li a {
    color: #FF8C00;
    text-decoration: none;
    padding: 8px 16px;
    background: linear-gradient(180deg, #4c4c4c, #2a2a2a);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.nav-menu li a:hover {
    color: #FF8C00;
    text-decoration: underline;
    background: linear-gradient(180deg, #5c5c5c, #3a3a3a);
}

/* Enlaces en el footer */
footer a {
    color: #FF8C00;
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #FF8C00;
    text-decoration: underline;
}

/* Enlaces en las tarjetas */
.card-title a {
    color: #FF8C00;
    text-decoration: none;
    transition: color 0.2s ease;
}

.card-title a:hover {
    color: #FF8C00;
    text-decoration: underline;
}

/* Enlace RSS */
.rss-fixed a {
    color: #FF8C00;
    text-decoration: none;
    transition: color 0.2s ease;
}

.rss-fixed a:hover {
    color: #FF8C00;
}

/* ------------------------- */
/* ESTILOS DE TIPOGRAFÍA Y ESPACIADO (CORREGIDOS) */
/* ------------------------- */

/* Estilos generales para todos los encabezados */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins';
    color: #FF8C00;
    margin: 40px 0 20px 0;
    line-height: 1.3;
}

/* Estilo específico para h1 dentro de elementos de seccionamiento */
article h1, aside h1, nav h1, section h1 {
    font-size: 2em;
}

/* Espaciado para párrafos */
p {
    margin: 20px 0;
    line-height: 1.6;
}

/* Espaciado adicional para elementos que siguen párrafos */
p + p {
    margin-top: 20px;
}

p + h2, p + h3, p + h4 {
    margin-top: 40px;
}

/* Espaciado en artículos */
article {
    margin: 40px 0;
}

article p:first-child {
    margin-top: 0;
}

article p:last-child {
    margin-bottom: 0;
}

/* Espaciado en tarjetas */
.card-content p {
    margin: 15px 0;
}

.card-content p:first-child {
    margin-top: 0;
}

.card-content p:last-child {
    margin-bottom: 0;
}

/* ------------------------- */
/* ESTILOS PARA IMÁGENES EN POSTS */
/* ------------------------- */

/* Contenedor de imágenes centradas */
div[style*="text-align: center;"] {
    margin: 20px auto;
    max-width: 1200px;
    padding: 0 15px;
}

/* Imágenes dentro del contenedor */
div[style*="text-align: center;"] img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Ajuste para pantallas pequeñas */
@media (max-width: 768px) {
    div[style*="text-align: center;"] {
        padding: 0 10px;
    }
    
    div[style*="text-align: center;"] img {
        border-radius: 8px;
    }
}

/* ------------------------- */
/* ESTILO ORIGINAL DEL BOTÓN VERDE */
/* ------------------------- */

button.responder {
    padding: 12px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 200px;
    max-width: 300px;
    text-align: center;
    border: none;
    cursor: pointer;
    font-family: 'Poppins';
    display: inline-block;
    
    /* Color original del botón responder (verde) */
    background: linear-gradient(180deg, #2ecc71, #1e8449);
    color: white;
    
    /* Efectos adicionales */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

button.responder:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button.responder:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Versión móvil */
@media (max-width: 768px) {
    button.responder {
        max-width: 100%;
        width: 100%;
        padding: 10px 20px;
    }
}