/* =================================================================== */
/* ==================== ESTILOS GLOBALES Y VARIABLES ================= */
/* =================================================================== */

:root {
    /* Colores Principales */
    --primary-color: #f7931e;
    --secondary-color: #030009;
    --dark-blue: #003a6a;
    --primary-orange: #f0ad4e;
    --primary-blue: #0056b3;

    /* Colores de Texto */
    --text-color-dark: #333;
    --text-color-light: #888;
    --text-color-white: #ffffff;
    
    /* Fondos y Bordes */
    --section-bg: #f7f8fa;
    --border-color: #e9e9e9;

    /* Otros */
    --border-radius: 8px;
    --box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-color-dark);
    background-color: var(--section-bg);
    margin: 0;
    padding: 0;
}

main {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4 {
    color: var(--text-color-dark);
    line-height: 1.2;
}

h1 { font-size: 3em; }
h2 { font-size: 2.2em; }
h3 { font-size: 1.6em; }
h4 { font-size: 1.3em; }

p {
    margin-bottom: 1em;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    text-align: center;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-color-white);
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background-color: #e0801c;
    border-color: #e0801c;
}

.btn-donate {
    background-color: var(--primary-color);
    color: var(--text-color-white);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
}

.btn-donate:hover {
    background-color: #e0801c;
}

#loading-state {
    text-align: center;
    font-size: 1.2rem;
    padding: 4rem;
    color: #555;
    grid-column: 1 / -1; /* Ocupa todo el ancho del grid */
}

/* ==================== HEADER STYLES ==================== */
.main-header {
    background-color: var(--secondary-color);
    color: var(--text-color-white);
    padding: 10px 0;
    position: relative; /* Para el posicionamiento del menú móvil */
    z-index: 1000;
}

.header-top {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 5px 20px;
}

.social-icons a {
    color: var(--text-color-white);
    margin-left: 15px;
    font-size: 1.1em;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
}

.main-nav .logo img {
    height: 60px;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-links li {
    margin-left: 25px;
}

.nav-links a {
    color: var(--text-color-white);
    font-weight: bold;
    font-size: 1em;
    padding: 5px 0;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-actions {
    margin-left: 20px;
    display: flex;
    align-items: center;
}

/* --- ESTILOS PARA EL MENÚ DESPLEGABLE DE PROYECTOS --- */
.nav-links li.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 1rem;
    min-width: 300px;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: block;
    color: var(--text-color-dark);
    padding: 12px 16px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dropdown-menu a:hover {
    background-color: #f1f1f1;
}

.dropdown-item-title {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 4px;
}

.dropdown-item-desc {
    font-size: 0.85rem;
    color: #666;
}
.dropdown-placeholder {
    padding: 12px 16px;
    color: #888;
}

/* --- ESTILOS PARA MENÚ RESPONSIVE (HAMBURGUESA) --- */
.hamburger-icon {
    display: none; /* Oculto en escritorio */
    font-size: 1.8rem;
    color: var(--text-color-white);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 15px;
}

.mobile-nav-menu {
    display: none; /* Oculto por defecto */
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.mobile-nav-menu.show {
    display: flex;
}

.mobile-nav-menu li {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav-menu li a {
    display: block;
    padding: 1rem;
    text-decoration: none;
    /* MÓVIL: Cambio de color a negro para las opciones del menú */
    color: #000000;
}
.mobile-nav-menu li a.btn {
    color: var(--text-color-white); /* El botón Donar mantiene su estilo original */
    background-color: var(--primary-color);
    margin: 1rem;
}


/* ==================== ESTILOS DE SECCIONES ==================== */
.news-banner {
    background-image: linear-gradient(rgba(45, 25, 0, 0.7), rgba(45, 25, 0, 0.7)), url('../Img/concepto-de-control-de-calidad-estandar-m-2.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5rem 2rem;
    text-align: center;
    color: white;
}

.news-banner h2 {
    font-family: 'Kalam', cursive;
    font-size: clamp(2.5rem, 5vw, 4rem);
    text-transform: uppercase;
    margin: 0;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
    color: white;
}

.blog-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-content: start;
}

.post-card {
    background-color: white;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-color-dark);
    transition: box-shadow 0.3s ease;
}

.post-card:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.post-card.wide-card {
    grid-column: span 2;
}

.post-card img {
    width: 100%;
    height: 200px; /* Altura fija para consistencia */
    object-fit: cover; /* Asegura que la imagen cubra el area sin distorsionarse */
    display: block;
}

.post-card-content {
    padding: 1rem;
}

.post-card-content h3 {
    font-size: 1.1rem;
    color: var(--primary-blue);
    margin: 0 0 0.5rem 0;
}

.post-card-content .date {
    font-size: 0.8rem;
    color: var(--text-color-light);
}

.sidebar .widget {
    margin-bottom: 2rem;
}

.widget .widget-title {
    background-color: var(--primary-orange);
    color: var(--text-color-dark);
    padding: 0.8rem 1rem;
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 0;
}

.popular-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: white;
    border: 1px solid var(--border-color);
    border-top: none;
}

.popular-posts-list li {
    border-bottom: 1px solid var(--border-color);
}

.popular-posts-list li:last-child {
    border-bottom: none;
}

.popular-posts-list a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: var(--text-color-dark);
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.popular-posts-list a:hover {
    background-color: #f7f7f7;
}

.popular-posts-list img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.popular-posts-list .date {
    font-size: 0.8em;
    color: var(--text-color-light);
    display: block;
    margin-top: 4px;
}

/* ==================== FOOTER STYLES ==================== */
.main-footer {
    background-color: var(--secondary-color);
    color: var(--text-color-white);
    padding: 50px 0;
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-col h4 {
    color: var(--text-color-white);
    font-size: 1.1em;
    margin-bottom: 20px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: #ffffff;
    font-size: 0.95em;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-col ul li a:hover {
    color: var(--primary-color);
}

.footer-logo-col img {
    height: 80px;
    margin-bottom: 15px;
}

.footer-logo-col p {
    font-size: 0.9em;
    color: #ccc;
}

.newsletter-form {
    display: flex;
    margin-top: 15px;
}

.newsletter-form input[type="email"] {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 5px 0 0 5px;
    font-size: 0.9em;
    background-color: #fff;
    color: #333;
}

.newsletter-form button {
    background-color: var(--primary-color);
    color: var(--text-color-white);
    border: none;
    padding: 10px 20px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.newsletter-form button:hover {
    background-color: #e0801c;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 992px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .footer-columns {
        text-align: center;
    }

    .footer-col ul li a {
        justify-content: center;
    }

    .newsletter-form {
        flex-direction: column;
        align-items: center;
    }
    .newsletter-form input, .newsletter-form button {
        border-radius: 5px;
        margin-bottom: 10px;
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    /* MÓVIL: Ocultar la barra superior con iconos de redes sociales */
    .header-top {
        display: none;
    }

    /* Ocultamos el menú de escritorio y el botón de donar */
    .nav-links {
        display: none;
    }
    .nav-actions .desktop-only-donate {
        display: none;
    }
    /* Mostramos el ícono de hamburguesa */
    .hamburger-icon {
        display: block;
    }

    .main-content {
        grid-template-columns: 1fr;
    }
    .post-card.wide-card {
        grid-column: auto;
    }
}