@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap');

body {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    background: #f8f9fa;
    min-height: 100%;
    overflow-y: auto;
}

html {
    height: 100%;
    background: #f8f9fa;
}

/* --- Header Styles --- */
.timeline-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px; 
    background: #ffffff;
    color: #333a45;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease-in-out;
}

.timeline-header.header-hidden {
    transform: translateY(-100%);
}

.logo-container {
    flex-basis: 150px; 
    flex-shrink: 0;   
}
.logo-container.logo-right {
    text-align: right; 
}

.logo-container img {
    max-width: 100%;
    height: auto;
    display: inline-block; 
    max-height: 40px; /* Tamaño base por defecto */
}

/* --- AJUSTE INDEPENDIENTE DE LOGOS --- */


.logo-container.logo-left img {
    max-height: 130px; 
}


.logo-container.logo-right img {
    max-height: 200px; 
}

/* -------------------------------------- */

.header-content {
    text-align: center;
    flex-grow: 1; 
    margin: 0 20px; 
    min-width: 0;
}

.timeline-header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: none;
    font-family: 'Poppins', sans-serif;
    font-weight: 700; 
}

.age-group-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px; 
    flex-wrap: wrap;
}

.age-btn { 
    background: #c6c2c2; 
    border: 2px solid #c6c2c2; 
    color: #ffffff; 
    padding: 12px 20px; 
    border-radius: 25px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    font-weight: 500; 
    font-size: 0.9rem; 
    backdrop-filter: none; 
}

.age-btn:hover { 
    background: #b1c8ea; 
    border-color: #b1c8ea; 
    color: #333a45; 
    transform: translateY(-2px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
}
.age-btn.active { 
    background: #a0a5c9; 
    color: #ffffff; 
    border-color: #a0a5c9; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-weight: bold; 
}

/*Intro Tarjeta Amarilla*/
.intro-section {
    display: flex;
    gap: 40px;
    align-items: center;
    background: #fcd796;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 40px;
    margin: 160px auto 40px auto; 
    max-width: 900px;
    width: 90%;
}

.intro-section .intro-text { 
    flex: 1; 
    color: #333; 
    line-height: 1.6; 
}
.intro-section .intro-text h2 { 
    margin-top: 0; 
    color: black; 
    font-size: 1.8rem; 
    font-weight: 700;
    display: inline-block;
    padding-bottom: 0px;
}

.intro-section .intro-image { 
    flex: 1; 
    max-width: 40%; 
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* --- LÓGICA SWAP DE IMÁGENES --- */
.img-swap-container {
    position: relative;
    width: 100%;
    line-height: 0;
    cursor: pointer;
    background: transparent !important;
}

.img-base {
    width: 100%;
    height: auto;
    display: block;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: opacity 0.3s ease;
}

.img-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 0;          
    transition: opacity 0.3s ease;
}

.img-swap-container:hover .img-hover {
    opacity: 1;
}


/* --- Timeline Structure --- */
.timeline-container {
    padding: 40px 20px;
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline-wrapper {
    position: relative;
    padding: 20px 0;
}

.timeline-line {
    position: absolute;
    width: 4px;
    background: #d9534f;
    top: 20px;
    bottom: 20px;
    left: 20px;
    border-radius: 2px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.timeline-events {
    position: relative;
}

.timeline-event {
    position: relative;
    padding-left: 60px;
    margin-bottom: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.timeline-event:last-child { margin-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: 20px;
    top: 0;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 4px solid #3c5a99; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 2;
}
.timeline-event:nth-child(n) .timeline-dot { border-color: #cd2031; } 
.timeline-event:hover .timeline-dot { transform: translateX(-50%) scale(1.3); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }

.timeline-year {
    font-weight: 700; 
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.95);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

/* --- Cards --- */
.timeline-card {
    position: relative;
    width: auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.5s ease, padding 0.4s ease, margin-top 0.4s ease;
    z-index: 10;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.timeline-event.active .timeline-card {
    opacity: 1;
    visibility: visible;
    max-height: 1000px;
    z-index: 10;
    margin-top: 15px;
    padding-top: 0;
    padding-bottom: 0;
}

.card-header { padding: 20px; border-radius: 15px 15px 0 0; color: white; text-align: center; position: relative; background: #cd2031; }

.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 5px; }
.card-subtitle { font-size: 0.9rem; opacity: 0.9; font-weight: 400; }
.card-content { padding: 20px; }
.card-description { color: #666; line-height: 1.5; margin-bottom: 15px; }
.card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.stat-item { text-align: center; padding: 10px; background: #f8f9fa; border-radius: 8px; position: relative; overflow: hidden; cursor: pointer; transition: all 0.3s ease; }
.stat-item:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.stat-number { font-size: 1.2rem; font-weight: 700; color: #333; position: relative; z-index: 2; }
.stat-label { font-size: 0.8rem; color: #666; margin-top: 2px; position: relative; z-index: 2; }

.stat-item .stat-number {
    color: transparent; 
    transition: color 0.1s ease;
    min-height: 1.4em; 
    position: relative; 
}

.stat-item .stat-number::before {
    content: '\f183'; 
    font-family: "Font Awesome 6 Free"; 
    font-weight: 900; 
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 1.4rem; color: #d9534f; opacity: 1; 
    transition: opacity 0.3s ease;
}

.stat-item.has-icon .stat-number::before { display: none; }

.custom-stat-icon {
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 1.4rem; color: #d9534f; opacity: 1; 
    transition: opacity 0.3s ease;
}

.stat-item.is-revealed .stat-number { color: #333; }
.stat-item.is-revealed .stat-number::before { opacity: 0; }
.stat-item.is-revealed .custom-stat-icon { opacity: 0; }

.stat-item.stat-static .stat-number { color: #333 !important; }
.stat-item.stat-static .stat-number::before { display: none; }
.stat-item.stat-static:hover { transform: none; cursor: default; }

.stat-progress { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    height: 4px; 
    background: linear-gradient(90deg, #d9534f, #e57373); 
    transition: width 1s ease; 
    border-radius: 0 0 8px 8px; 
}

.card-illustration { margin: 20px 0; text-align: center; }
.card-illustration img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card-illustration img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* --- Charts and Graphs --- */
.interactive-chart { margin: 15px 0; padding: 15px; background: #f8f9fa; border-radius: 8px; position: relative; }
.chart-title { font-size: 0.9rem; font-weight: 700; color: #333; margin-bottom: 10px; text-align: center; }
.chart-bars { display: flex; align-items: end; justify-content: space-between; height: 120px; gap: 10px; }
.chart-bar { 
    flex: 1; 
    border-radius: 5px 5px 0 0; 
    transition: all 0.5s ease; 
    cursor: pointer; 
    position: relative; 
    min-height: 10px; 
    background: #ccc; 
}
.chart-bar:hover { opacity: 0.8; transform: scaleY(1.02); }
.chart-bar::after { content: attr(data-value); position: absolute; top: -25px; left: 50%; transform: translateX(-50%); font-size: 0.8rem; color: #333; font-weight: bold; opacity: 1; }
.chart-labels { display: flex; justify-content: space-between; margin-top: 10px; }
.chart-label { font-size: 0.75rem; color: #666; text-align: center; flex: 1; font-weight: 500;}

.pie-chart-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    align-items: center;
    padding: 10px;
}
.pie-chart {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    color: #555;
}
.legend-item { display: flex; align-items: center; }
.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 10px;
    flex-shrink: 0;
}

.doctor-quote-container {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-top: 15px;
    background: #e3f2fd;
    padding: 15px;
    border-radius: 15px;
}
.emoji-avatar { font-size: 3rem; line-height: 1; }
.quote-bubble {
    position: relative;
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    font-style: italic;
    color: #555;
    font-size: 0.95rem;
}
.quote-bubble::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 15px;
    border-width: 10px 10px 10px 0;
    border-style: solid;
    border-color: transparent white transparent transparent;
}

.info-table-container {
    overflow-x: auto;
    margin-top: 10px;
}
.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: center;
    background: white;
}
.info-table th {
    padding: 10px;
    border-bottom: 2px solid #ddd;
    font-size: 1.2rem; 
    background: #f8f9fa;
    vertical-align: top;
}
.info-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    color: #555;
}
.info-table tr:last-child td {
    border-bottom: none;
}
.info-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: #333;
    min-width: 120px;
}
.highlight-cell {
    background-color: #fff9c4; 
    font-weight: bold;
    color: #333;
}

.comparison-bar-container {
    margin: 15px 0;
}
.comp-bar-group {
    margin-bottom: 10px;
}
.comp-bar-label {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}
.comp-bar-track {
    background: #e9ecef;
    border-radius: 10px;
    height: 12px;
    width: 100%;
    overflow: hidden;
}
.comp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 1s ease;
}

@keyframes siren-anim {
    0% { transform: scale(1) rotate(0deg); }
    10%, 20% { transform: scale(0.9) rotate(-3deg); }
    30%, 50%, 70%, 90% { transform: scale(1.1) rotate(3deg); }
    40%, 60%, 80% { transform: scale(1.1) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.alert-card {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.alert-icon {
    font-size: 2.5rem;
    display: inline-block;
    animation: siren-anim 1.5s infinite;
}
.alert-text {
    font-size: 1rem;
    font-weight: 500;
}

.interactive-1in4 {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
}
.interactive-1in4:hover {
    background: #bbdefb;
}
.interactive-1in4 h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #1565c0;
}
.faces-container {
    font-size: 2.5rem;
    display: flex;
    justify-content: center;
    gap: 10px;
}
.face {
    opacity: 0.5;
    transition: all 0.3s;
}
.interactive-1in4.active .face {
    opacity: 1;
}
.interactive-1in4.active .face.special {
    transform: scale(1.3);
}

.close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; opacity: 0.8; transition: opacity 0.2s; }
.close-btn:hover { opacity: 1; }

.timeline-controls { text-align: center; margin-top: 40px; padding-bottom: 40px; }
.control-btn { 
    background: #3c5a99; 
    border: 2px solid #3c5a99; 
    color: white; 
    padding: 12px 24px; 
    border-radius: 25px; 
    margin: 0 10px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    font-weight: 500; 
}
.control-btn:hover { 
    background: white; 
    color: #3c5a99; 
    transform: translateY(-2px); 
}

/*BEER CHART  */
.grafica-cerveza {
    font-size: 3.5rem; 
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    gap: 5px;
}
.cerveza-parcial-container {
    position: relative;
    width: 1.25em; 
    height: 1.3em;
    display: inline-block;
}
.cerveza-fondo {
    opacity: 0.2; 
    position: absolute;
    left: 0;
    top: 0;
    filter: grayscale(100%);
}
.cerveza-relleno {
    position: absolute;
    left: 0;
    bottom: 0; 
    width: 100%;  
    height: 68%;
    overflow: hidden;
    white-space: nowrap;
    border-top: 2px solid #d9534f; 
    box-sizing: border-box; 
    display: flex;
    align-items: flex-end; 
}

/* EMOJI ANIMATION */
.emoji-grid-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin: 20px 0;
}
.emoji-unit {
    font-size: 2.5rem;
    filter: grayscale(100%);
    opacity: 0.3;
    transition: all 0.3s ease;
}
.emoji-unit.active {
    filter: grayscale(0%);
    opacity: 1;
    animation: handWave 2s infinite ease-in-out;
    cursor: pointer;
    transform-origin: bottom center;
}

@keyframes handWave {
    0% { transform: translateY(0) rotate(0deg); }
    15% { transform: translateY(-8px) rotate(15deg); }
    30% { transform: translateY(0) rotate(0deg); }
    45% { transform: translateY(-8px) rotate(-15deg); }
    60% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@media (max-width: 768px) {
    .logo-container { display: none; }
    .header-content { margin: 0; width: 100%; }
    .timeline-header { padding: 15px; justify-content: center; }
    .timeline-header h1 { font-size: 1.4rem; }
    .age-group-buttons { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; justify-content: flex-start; }
    .age-btn { padding: 8px 12px; font-size: 0.8rem; flex: 0 0 auto; }
    .intro-section { flex-direction: column; width: 95%; padding: 30px; margin-top: 0; margin-left: auto; margin-right: auto; margin-bottom: 40px; }
    .intro-section .intro-text h2 { font-size: 1.5rem; }
    .intro-section .intro-image { max-width: 100%; }
    .timeline-container { padding: 20px 10px; }
    .timeline-wrapper { padding-left: 0; }
    .timeline-line { left: 10px; }
    .timeline-event { padding-left: 40px; }
    .timeline-dot { left: 10px; }
    .chart-label { font-size: 0.6rem; }
}

/* FOOTER */
.footer {
    background-color: #f5f5f5; 
    padding: 3rem 1.5rem;
    margin-top: 50px;
    text-align: center;
}

.footer-container {
    max-width: 960px;
    margin: 0 auto;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.social-btn {
    background: transparent;
    border: none;
    color: #7a7a7a;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.social-btn:hover {
    color: #363636; 
    background-color: rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.footer-copyright {
    font-size: 0.75rem;
    color: #b5b5b5; 
}

.footer-copyright a {
    color: #4a4a4a; 
    text-decoration: none;
    font-weight: 500;
}

.footer-copyright a:hover {
    text-decoration: underline;
    color: #333;
}