/* =========================================
   VARIABLES Y CONFIGURACIÓN BASE
   ========================================= */
:root { 
    --primary: #2ecc71; 
    --primary-dark: #27ae60;
    --dark: #2c3e50; 
    --light: #f9f9f9; 
    --text: #555; 
    --white: #ffffff;
    --gray-light: #f3f4f6;
    --border: #eeeeee;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 30px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
}

body { 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    margin: 0; 
    color: var(--text); 
    background: var(--light); 
    line-height: 1.6; 
}

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

a { text-decoration: none; color: inherit; transition: 0.3s; }

/* =========================================
   PUBLICIDAD
   ========================================= */
.ad-container {
    display: block;
    margin: 15px auto;
    text-align: center;
    background: transparent;
    border: none;
    overflow: hidden;
}

.ad-container::before,
.ad-container::after {
    content: none;
}

/* Espacios específicos para evitar saltos de diseño (CLS) */
#ad-slot-top { min-height: 90px; margin-top: 10px; }
#ad-slot-subnav { min-height: 100px; margin-bottom: 10px; }
#ad-slot-recipe { min-height: 80px; margin: 30px 0; }

/* =========================================
   HEADER Y NAVEGACIÓN
   ========================================= */
header { 
    background: var(--white); 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
}

.nav-container {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px 0;
}

.logo { 
    font-size: 1.6rem; 
    font-weight: 800; 
    color: var(--primary); 
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Selector de Idiomas */
.lang-switcher {
    display: flex;
    gap: 8px;
    background: var(--gray-light);
    padding: 4px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
}

.lang-switcher a {
    color: #777;
    padding: 4px 8px;
    border-radius: 4px;
}

.lang-switcher a.active {
    color: var(--white);
    background: var(--primary);
}

/* Buscador */
.search-form { display: flex; gap: 4px; }
.search-form input { 
    padding: 8px 12px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    font-size: 14px; 
    width: 200px;
    transition: 0.3s;
}
.search-form input:focus { outline: none; border-color: var(--primary); width: 250px; }
.search-form button { 
    padding: 8px 12px; 
    background: var(--primary); 
    color: white; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
}
.search-form button:hover { background: var(--primary-dark); }

/* Menú de Categorías */
.cat-nav { 
    background: #fff; 
    border-top: 1px solid #f0f0f0; 
    border-bottom: 1px solid #f0f0f0; 
}

.cat-list { 
    display: flex; 
    gap: 25px; 
    overflow-x: auto; 
    padding: 14px 0; 
    list-style: none; 
    margin: 0; 
}
.cat-list::-webkit-scrollbar { display: none; }

.cat-list a { 
    color: #666; 
    font-size: 14px; 
    font-weight: 600; 
    white-space: nowrap; 
}
.cat-list a:hover { color: var(--primary); }
.cat-list .all-link { color: var(--primary); font-weight: 700; border-right: 2px solid #eee; padding-right: 15px; }

/* =========================================
   GRID Y TARJETAS
   ========================================= */
.main-header { padding: 30px 0 10px; }
.section-title { 
    color: var(--dark); 
    border-left: 5px solid var(--primary); 
    padding-left: 15px; 
    margin: 0;
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
    gap: 2rem; 
    padding: 20px 0 50px; 
}

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

.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); }
.card img { width: 100%; height: 220px; object-fit: cover; }
.card-body { padding: 1.5rem; flex-grow: 1; }
.card-body h2 { font-size: 1.3rem; margin: 0 0 12px; color: var(--dark); line-height: 1.3; }

.resumen-preview { 
    color: #666; 
    font-size: 0.95rem; 
    line-height: 1.6; 
}

/* =========================================
   PÁGINA DE RECETA
   ========================================= */
.recipe-container { 
    max-width: 850px; 
    margin: 40px auto; 
    background: var(--white); 
    border-radius: 24px; 
    overflow: hidden; 
    box-shadow: var(--shadow-hover); 
}

.recipe-img { width: 100%; height: 500px; object-fit: cover; }
.recipe-content { padding: 50px; }
.recipe-meta { 
    display: flex; 
    gap: 25px; 
    margin-bottom: 30px; 
    color: #777; 
    font-size: 0.95rem; 
    border-bottom: 1px solid var(--border); 
    padding-bottom: 25px; 
    flex-wrap: wrap;
}
.recipe-meta b { color: var(--dark); }

.badge-container { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; }
.badge { padding: 6px 14px; border-radius: 30px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.badge-cat { background: #e8f5e9; color: #2e7d32; }
.badge-tag { background: var(--gray-light); color: #4b5563; border: 1px solid #e5e7eb; }

.resumen-box { 
    font-style: italic; 
    border-left: 4px solid var(--primary); 
    padding-left: 20px; 
    margin-bottom: 40px; 
    color: #444; 
}

.ingredients-box { 
    background: #fdfdfd; 
    padding: 30px; 
    border-radius: 18px; 
    margin: 40px 0; 
    border: 1px solid #eee;
    border-top: 5px solid var(--primary); 
}
.ingredients-list { list-style: none; padding: 0; margin-top: 15px; }
.ingredients-list li { 
    padding: 12px 0; 
    border-bottom: 1px solid #f3f3f3; 
    display: flex; 
    align-items: center; 
}
.ingredients-list li:last-child { border: none; }
.ingredients-list li::before { 
    content: "✔"; 
    color: var(--primary); 
    margin-right: 15px; 
    font-weight: 900; 
}

/* Estilo para el contenido Markdown renderizado */
.instructions { font-size: 1.15rem; line-height: 1.9; color: #333; }
.instructions h2 { 
    color: var(--dark); 
    margin-top: 45px; 
    margin-bottom: 20px; 
    font-size: 1.8rem;
    display: flex;
    align-items: center;
}
.instructions h3 { color: var(--primary); margin-top: 35px; font-size: 1.4rem; }
.instructions ul, .instructions ol { margin: 25px 0; padding-left: 25px; }
.instructions li { margin-bottom: 12px; }
.instructions blockquote { 
    background: #f0fdf4; 
    border-left: 5px solid var(--primary); 
    padding: 20px 30px; 
    font-style: italic; 
    margin: 30px 0; 
    border-radius: 0 12px 12px 0;
}

/* Navegación */
.nav-wrapper { 
    margin-top: 60px; 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    border-top: 1px solid #eee;
    padding-top: 40px;
}

.nav-card { 
    display: flex; 
    align-items: center; 
    background: var(--white); 
    padding: 15px; 
    border-radius: 16px; 
    border: 1px solid var(--border); 
}
.nav-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow); }
.nav-card img { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; }
.nav-info { padding: 0 15px; }
.nav-label { font-size: 10px; text-transform: uppercase; color: #aaa; font-weight: 800; letter-spacing: 1px; }
.nav-title { font-weight: 700; font-size: 14px; display: block; margin-top: 4px; color: var(--dark); }
.nav-right { text-align: right; flex-direction: row-reverse; }

/* =========================================
   ESTADOS VACÍOS Y PIE DE PÁGINA
   ========================================= */
.empty-box, .empty-box-alt { 
    padding: 60px 20px; 
    text-align: center; 
    background: var(--white); 
    border-radius: 16px; 
    box-shadow: var(--shadow); 
    grid-column: 1 / -1;
}
.empty-box-alt { background: #f3f4f6; box-shadow: none; margin-top: 30px; }
.empty-box p { font-size: 1.2rem; color: #666; margin-bottom: 20px; }
.empty-box a { color: var(--primary); font-weight: 700; text-decoration: underline; }

footer { 
    margin-top: 80px; 
    padding: 40px 0; 
    border-top: 1px solid #eee;
    text-align: center; 
}

.seo-accordion { margin-top: 30px; background: #f1f1f1; border-radius: 12px; overflow: hidden; text-align: left; }
.seo-accordion summary { padding: 18px; cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
.seo-accordion pre { padding: 20px; background: #1a202c; color: #4ade80; font-size: 0.85rem; overflow-x: auto; margin: 0; }

/* =========================================
   ADMINISTRACIÓN
   ========================================= */
.admin-container { max-width: 850px; background: var(--white); padding: 40px; margin: 50px auto; border-radius: 16px; box-shadow: var(--shadow-hover); }
.admin-form label { font-weight: 700; color: #374151; display: block; margin-top: 20px; }
.admin-form input, .admin-form textarea, .admin-form select { 
    width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #d1d5db; border-radius: 8px; font-family: inherit;
}
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 15px; }
.btn-publish { 
    background: var(--primary); color: white; padding: 18px; border: none; width: 100%; 
    cursor: pointer; font-size: 1.1rem; border-radius: 8px; font-weight: 800; margin-top: 30px;
}

/* =========================================
   Paginador
   ========================================= */
/* Paginación */
.pagination {
    margin: 40px 0;
    text-align: center;
}
.pagination-wrapper {
    display: inline-flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}
.page-link {
    display: inline-block;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--dark);
    font-weight: 500;
    transition: 0.3s;
}
.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    cursor: default;
}
/* =========================================
   Paginador
   ========================================= */
.pagination {
    margin: 40px 0;
    text-align: center;
}
.pagination-wrapper {
    display: inline-flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}
.page-link {
    display: inline-block;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--dark);
    font-weight: 500;
    transition: 0.3s;
}
.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    cursor: default;
}

@media (max-width: 600px) {
    .page-link {
        padding: 6px 10px;
        font-size: 14px;
    }
}

/* =========================================
   ESTILOS DE CONTENEDORES DE ANUNCIOS (PRODUCCIÓN)
   ========================================= */

/* Reset completo + estilo limpio para producción */
.ad-container {
    display: block !important;
    overflow: hidden;
    position: relative;
    min-height: 90px;
    margin: 20px 0;
    width: 100%;
    text-align: center;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

/* Sin texto visual de prueba */
.ad-container small {
    display: none !important;
}

.ad-container::before,
.ad-container::after {
    content: none;
}

/* Colapsar si Google AdSense dice que no hay anuncio (unfilled) */
ins.adsbygoogle[data-ad-status="unfilled"],
.ad-container:has(ins[data-ad-status="unfilled"]) {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
}

/* Clase de seguridad para forzar el colapso si el anuncio falla */
.ad-container.ad-hidden {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Excepción: anuncios dentro de cuadrícula */
.grid .ad-container {
    grid-column: span 1 !important;
    min-height: 90px !important;
    margin: 0;
}
/* =========================================
   MEDIA QUERIES (FULL RESPONSIVE)
   ========================================= */
@media (max-width: 850px) {
    .nav-container { flex-direction: column; gap: 15px; padding-bottom: 20px; }
    .header-right { width: 100%; justify-content: space-between; flex-direction: column-reverse; gap: 15px; }
    .search-form { width: 100%; }
    .search-form input { flex-grow: 1; }
    .recipe-img { height: 300px; }
    .recipe-content { padding: 30px 20px; }
}

@media (max-width: 600px) {
    .grid { grid-template-columns: 1fr; }
    .nav-wrapper { grid-template-columns: 1fr; }
    .recipe-meta { gap: 12px; font-size: 0.85rem; }
    .instructions h2 { font-size: 1.5rem; }
    #ad-slot-top { min-height: 60px; }
}

/* Ocultar anuncios según dispositivo 
@media (max-width: 600px) {
    .ad-desktop {
        display: none;
    }
}
@media (min-width: 601px) {
    .ad-mobile {
        display: none;
    }
}
*/