/*
Theme Name: DiaBalance Diet
Theme URI: https://dietequilibrio.es/
Author: Estudio MindFlash
Author URI: https://mindflash.studio/
Description: Ultra-light custom theme for a diabetes diet portal with DiaBalance promotion. Mobile-first, SEO-ready, schema, ES/EN ready.
Version: 1.0.1
Text Domain: diabalance-theme
License: GPL-2.0-or-later
*/

/* ==========================================================================
   1. General & Variables
   ========================================================================== */

:root {
    --primary: #4CAF50; /* green */
    --accent: #2196F3;  /* blue */
    --text: #222;
    --muted: #6a6f7a;
    --bg: #fff;
    --border-color: #eee;
    --light-green-bg: #e8f5e9;
    --dark-green-text: #2e7d32;
    --accent-green-border: #a5d6a7;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.wrap {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5em;
    padding-right: 1.5em;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.page-header {
    margin-bottom: 2em;
    border-bottom: 2px solid var(--accent-green-border);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
}


/* ==========================================================================
   2. Header & Navigation
   ========================================================================== */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
    padding: 1em 1.5em;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}

.site-branding .custom-logo {
    max-height: 60px;
    width: auto;
}

.main-navigation ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-navigation li {
    margin-left: 1.5em;
}

.main-navigation a {
    text-decoration: none;
    font-weight: bold;
    color: var(--primary);
}

.main-navigation a:hover {
    text-decoration: underline;
}

.header-search .search-form {
    display: flex;
}

.header-search .search-field {
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    padding: 8px;
    min-width: 150px;
}

.header-search .search-submit {
    background-color: var(--primary);
    border: 1px solid var(--primary);
    color: #fff;
    padding: 8px 12px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}


/* ==========================================================================
   3. Cards (for Archives)
   ========================================================================== */

.recetas-grid,
.planes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5em;
}

.receta-card,
.plan-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg);
    overflow: hidden;
    transition: box-shadow 0.3s ease-in-out;
}

.receta-card:hover,
.plan-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.receta-card .card-link,
.plan-card .card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.receta-card .card-thumbnail img,
.plan-card .card-thumbnail img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.receta-card .card-content,
.plan-card .card-content {
    padding: 1em;
    flex-grow: 1;
}

.receta-card .card-title,
.plan-card .card-title {
    margin-top: 0;
    margin-bottom: 0.5em;
    font-size: 1.2em;
}

.receta-card .card-meta {
    font-size: 0.9em;
    color: var(--primary);
    margin-bottom: 0.75em;
}

.receta-card .card-excerpt {
    font-size: 0.9em;
    color: var(--muted);
}

.plan-card .card-meta-plan {
    font-size: 0.9em;
    color: var(--muted);
    background-color: #f9f9f9;
    padding: 0.75em;
    border-radius: 4px;
    margin-bottom: 0.75em;
}

/* ==========================================================================
   4. Single Post Templates (Recipe, Plan, Article)
   ========================================================================== */

.receta-single,
.plan-single,
.post,
.page {
    max-width: 800px;
    margin: 2em auto;
    padding: 2em;
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.plan-single {
    background: var(--bg);
}

.entry-content, .entry-summary {
    line-height: 1.7;
}
.entry-content a {
    font-weight: bold;
}
.entry-content h2, .entry-content h3 {
    border-bottom: 2px solid var(--accent-green-border);
    padding-bottom: 0.5em;
}

/* ... styles for single recipe and plan ... */


/* ==========================================================================
   5. Call to Action (CTA) & Buttons
   ========================================================================== */

/* ... styles for CTA ... */

/* ==========================================================================
   6. Homepage (front-page.php)
   ========================================================================== */

/* ... styles for homepage ... */


/* ==========================================================================
   7. Blog & Sidebar
   ========================================================================== */

.content-area.with-sidebar {
    flex-grow: 1;
    max-width: 100%;
}

.post-excerpt {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5em;
    margin-bottom: 1.5em;
}
.post-excerpt:last-child {
    border-bottom: none;
}

#secondary.widget-area .widget {
    border: 1px solid var(--border-color);
    padding: 1.5em;
    border-radius: 8px;
    margin-bottom: 1.5em;
    background: #f9f9f9;
}

#secondary.widget-area .widget-title {
    font-size: 1.2em;
    margin-top: 0;
    border-bottom: 2px solid var(--accent-green-border);
    padding-bottom: 0.5em;
}

/* ==========================================================================
   8. Footer
   ========================================================================== */

.site-footer {
    background-color: #f9f9f9;
    padding-top: 3em;
    border-top: 1px solid var(--border-color);
    color: var(--muted);
    font-size: 0.9em;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2em;
    margin-bottom: 2em;
}
/* ... other footer styles ... */


/* ==========================================================================
   9. Mobile Responsiveness (Адаптивность)
   ========================================================================== */

@media (min-width: 900px) {
    .wrap.has-sidebar { /* Применяем только на страницах с сайдбаром */
        display: flex;
        gap: 2em;
    }
    .with-sidebar {
        flex-basis: 70%; /* Основной контент ~70% */
    }
    #secondary.widget-area {
        flex-basis: 30%; /* Сайдбар ~30% */
    }
}

@media (max-width: 768px) {
    .site-header {
        flex-direction: column; /* Шапка: лого, меню, поиск - встают друг под друга */
    }

    .main-navigation li {
        margin-left: 0;
        margin-right: 1em; /* Меняем отступ для мобильных */
    }
    
    .home-hero h1 {
        font-size: 2em;
    }

    .receta-meta-grid {
        grid-template-columns: 1fr; /* В рецепте блоки с инфо встают друг под другом */
    }
}