/* ============================================================================
 * SECCIONES-DESCUBRE.CSS
 * ============================================================================
 * Estilos específicos para los contenidos ricos (HTML) de la sección "Descubre".
 * Este archivo es consumido por el Frontend y por el Editor TinyMCE.
 * * ÍNDICE:
 * 1. Estilos Base WYSIWYG (Texto, encabezados, listas)
 * 2. Formato Revista / Magazine (Rostros del Sabor)
 * 3. Formato Timeline (Historia)
 * 4. Formato Guía de Alérgenos
 * 5. Utilidades de Imágenes
 * 
 * MEJORAS v4.2:
 * - Solución de solapamiento en .hist-card mediante Flex-Wrap.
 * - Inclusión de la lista completa de alérgenos y sus colores estandarizados.
 * - Normalización de imágenes para ignorar anchos fijos de editores visuales.
 * ============================================================================
 */

/* ---------------------------------------------------------
   1. ESTILOS BASE WYSIWYG
   --------------------------------------------------------- */
.wysiwyg-content {
    line-height: 1.8;
    color: var(--color-text-dim, #cbd5e1);
    font-size: 1.05rem;
    font-family: 'Inter', sans-serif;
}

.wysiwyg-content h2 {
    color: var(--color-text-main, #f8fafc);
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-family: 'Poppins', sans-serif;
    border-bottom: 1px solid var(--color-border-dim, rgba(255,255,255,0.1));
    padding-bottom: 10px;
    clear: both;
}

.wysiwyg-content h3 {
    color: var(--color-accent, #d6a354);
    font-size: 1.4rem;
    margin-top: 1.5rem;
    font-family: 'Poppins', sans-serif;
    clear: both;
}

.wysiwyg-content p {
    margin-bottom: 1.2rem;
}

.wysiwyg-content ul, 
.wysiwyg-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.wysiwyg-content li {
    margin-bottom: 0.5rem;
}

.wysiwyg-content blockquote {
    border-left: 4px solid var(--color-accent, #d6a354);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0 8px 8px 0;
}

/* ---------------------------------------------------------
   2. FORMATO REVISTA / MAGAZINE (Grid de Perfiles)
   --------------------------------------------------------- */
.human-wrapper {
    padding-bottom: 3rem;
}

.human-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem auto;
}

.human-intro h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    color: var(--color-accent, #d6a354);
    margin-bottom: 1rem;
}

/* Grid Responsive de 3 Columnas */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* Tarjeta de Perfil */
.profile-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border-dim, rgba(255,255,255,0.1));
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.profile-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--color-accent, #d6a354);
}

.profile-img-container {
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-bottom: 4px solid var(--color-accent, #d6a354);
    background-color: #000;
}

.profile-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.profile-card:hover .profile-img-container img {
    transform: scale(1.05);
}

.profile-body {
    padding: 1.5rem;
    text-align: center;
    flex-grow: 1;
}

.profile-role {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--color-text-dim, #cbd5e1);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.profile-name {
    font-family: 'Poppins', serif;
    font-size: 1.4rem;
    color: #fff;
    margin: 0 0 1rem 0;
}

.profile-quote {
    font-style: italic;
    color: var(--color-accent, #d6a354);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: block;
}

.profile-desc {
    font-size: 0.9rem;
    color: var(--color-text-dim, #cbd5e1);
    line-height: 1.6;
    margin: 0;
}

/* ---------------------------------------------------------
   3. FORMATO TIMELINE (Historia) - FIX RESPONSIVE
   --------------------------------------------------------- */
.lit-wrapper {
    padding-bottom: 3rem;
    clear: both;
}

.lit-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(212, 160, 23, 0.3);
    position: relative;
}

.lit-header::after {
    content: "\f5ad"; /* Icono FontAwesome (Scroll) */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg-section, #1e253a);
    padding: 0 15px;
    color: #d4a017;
    font-size: 1.2rem;
}

.lit-subtitle {
    display: block;
    color: #d4a017;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.lit-title {
    font-family: 'Poppins', serif;
    font-size: 2.2rem !important;
    color: var(--color-text-main, #f8fafc) !important;
    margin: 0 !important;
    line-height: 1.2;
}

/* Contenedor de la línea de tiempo */
.timeline {
    position: relative;
    margin: 3rem 0 3rem 1rem;
    padding-left: 2.5rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

/* Item individual */
.timeline-item {
    position: relative;
    margin-bottom: 4rem;
}

/* Marcador circular en la línea */
.timeline-marker {
    position: absolute;
    left: -3.4rem; 
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg-section, #1e253a);
    border: 2px solid var(--color-accent, #d6a354);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent, #d6a354);
    z-index: 2;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    font-size: 1.1rem;
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--color-accent, #d6a354);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: block;
}

.timeline-title {
    font-size: 1.5rem !important;
    color: var(--color-text-main, #f8fafc) !important;
    margin-bottom: 0.8rem !important;
    font-family: 'Poppins', sans-serif;
    line-height: 1.2;
}

.timeline-content {
    color: var(--color-text-dim, #cbd5e1);
    font-size: 1rem;
    line-height: 1.7;
}

/* Letra Capital */
.drop-cap::first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    font-weight: bold;
    margin-right: 0.5rem;
    color: #d4a017;
    font-family: serif;
}

/* TARJETA INTERNA DEL TIMELINE: Corregida para no solaparse en móviles */
.hist-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.2rem;
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap; /* CRÍTICO: Permite el salto de línea en pantallas pequeñas */
}

.hist-card > div {
    flex: 1 1 250px; /* Base flexible mínima antes de saltar */
}

/* Fuerza a la imagen a ser fluida, ignorando anchos fijos del editor (ej. 300px) */
.hist-card img {
    border-radius: 4px;
    width: 100% !important; 
    height: auto !important;
    max-width: 100%;
    object-fit: cover;
    display: block;
}

.hist-card h5 {
    margin: 0 0 0.5rem 0 !important;
    color: #f8fafc !important;
    font-size: 1.1rem !important;
}

.hist-card p {
    margin: 0 !important;
    font-size: 0.9rem;
    color: #94a3b8;
}

/* Bloque de Cita */
.quote-box {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(212, 160, 23, 0.05) 100%);
    border-left: 4px solid #d4a017;
    padding: 2rem;
    margin: 3rem 0;
    border-radius: 0 12px 12px 0;
    position: relative;
}

.quote-icon {
    position: absolute;
    top: -15px;
    left: 20px;
    font-size: 2rem;
    color: #d4a017;
    background: var(--color-bg-section, #1e253a);
    padding: 0 10px;
}

.quote-text {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.25rem;
    color: #e2e8f0;
    line-height: 1.6;
    margin-bottom: 1rem !important;
}

.quote-author {
    display: block;
    font-size: 0.9rem;
    color: #d4a017;
    font-weight: bold;
    text-align: right;
    border-top: 1px solid rgba(212, 160, 23, 0.2);
    padding-top: 0.5rem;
}

/* ---------------------------------------------------------
   4. FORMATO GUÍA DE ALÉRGENOS (LISTA COMPLETA)
   --------------------------------------------------------- */
.allergen-guide-wrapper {
    padding: 1rem 0;
    clear: both;
}

/* Grid de alérgenos */
.allergen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.allergen-card {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border-dim, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 1.25rem;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.allergen-card:hover {
    transform: translateY(-5px);
    background-color: rgba(255, 255, 255, 0.06);
}

.allergen-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.8rem;
}

.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff !important;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* CODIFICACIÓN DE COLORES ESTÁNDAR POR ALÉRGENO */
.gluten      { background-color: #d4a017; }
.crustaceos  { background-color: #ff6f00; }
.huevos      { background-color: #fbc02d; color: #333 !important; }
.pescado     { background-color: #1976d2; }
.cacahuetes  { background-color: #795548; }
.soja        { background-color: #33691e; }
.lacteos     { background-color: #bbdefb; color: #0d47a1 !important; }
.frutos      { background-color: #8d6e63; }
.apio        { background-color: #cddc39; color: #333 !important; }
.mostaza     { background-color: #ffeb3b; color: #333 !important; }
.sesamo      { background-color: #d7ccc8; color: #333 !important; }
.sulfitos    { background-color: #7e57c2; }
.altramuces  { background-color: #fff9c4; color: #333 !important; }
.moluscos    { background-color: #ec407a; }

.allergen-title {
    margin: 0 !important;
    font-size: 1.1rem !important;
    color: var(--color-text-main, #f8fafc) !important;
    font-weight: 600;
}

.allergen-desc {
    color: var(--color-text-dim, #cbd5e1);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 0.8rem;
}

.risk-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.85rem;
}

.risk-list li {
    margin-bottom: 0.4rem;
    color: #cbd5e1;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.risk-list i.warning { color: #ffcc00; }
.risk-list i.success { color: #4caf50; }
.risk-list i.danger { color: #ef4444; }

/* Caja de advertencia final */
.warning-box {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.1), transparent);
    border-left: 4px solid #ef4444;
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    margin-top: 2rem;
}

.warning-title {
    color: #ef4444 !important;
    margin-bottom: 1rem !important;
    font-size: 1.2rem !important;
    font-weight: bold;
}

.warning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.w-item h5 {
    color: var(--color-text-main, #f8fafc) !important;
    font-size: 1rem !important;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.w-item p {
    color: var(--color-text-dim, #cbd5e1);
    font-size: 0.9rem;
    margin: 0;
}

/* ---------------------------------------------------------
   5. UTILIDADES DE IMÁGENES (Compatibilidad SunEditor/TinyMCE)
   --------------------------------------------------------- */
.se-component, .mce-float-left, .mce-float-right {
    margin-bottom: 1rem;
    max-width: 100%;
}

.__se__float-left, .alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.__se__float-right, .alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.__se__float-center, .aligncenter {
    display: block;
    margin: 0 auto 1.5rem auto;
}

.se-image-container img, .wysiwyg-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* ---------------------------------------------------------
   6. MEDIA QUERIES (AJUSTES RESPONSIVOS FINALES)
   --------------------------------------------------------- */
@media (max-width: 768px) {
    .timeline {
        margin-left: 0.5rem;
        padding-left: 1.5rem;
    }

    .timeline-marker {
        left: -2.4rem;
        width: 32px;
        height: 32px;
    }

    /* La tarjeta de historia se apila verticalmente en móviles */
    .hist-card {
        flex-direction: column;
        text-align: center;
    }

    .hist-card > div {
        flex: 0 0 100%;
        width: 100%;
    }
    
    .lit-title {
        font-size: 1.8rem !important;
    }
}

@media (max-width: 480px) {
    .profiles-grid {
        grid-template-columns: 1fr;
    }
    
    .wysiwyg-content {
        font-size: 1rem;
    }
}