/* pictoheroes_app.py - static/css/style.css */
/* Version 1.7.1 (Ajuste de logos) */

body {
    font-family: 'Nunito', sans-serif;
    background-color: #fbf4eb; 
    color: #4a4a4a; 
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

header {
    background-color: #ede0d4; 
    color: #5c4d41;  
    padding: 15px 20px; 
    text-align: center;
    border-bottom: 3px solid #d4b28c; 
}

/* --- ESTILOS PARA LOGO PRINCIPAL (TAMAÑO MODIFICADO) --- */
.header-logo-container {
    margin: 0 auto; /* Quitar margen inferior de aquí */
}
.header-logo-main {
    height: auto; /* Dejar que la altura se ajuste a la proporción */
    width: 250px;  /* Fijar el ancho del logo */
    pointer-events: auto !important; 
    margin-bottom: -10px; /* Margen negativo para acercar el eslogan desde abajo */
}

header h1 {
    margin: 0 0 10px 0; 
    font-size: 2.6em; 
    color: #8c6d4f; 
    font-weight: bold;
    text-transform: uppercase;
}

/* NUEVO: Estilo para el eslogan debajo del logo */
.header-logo-container h4 {
    margin-top: 0; /* Eliminar margen superior del h4 */
    margin-bottom: 5px; /* Margen inferior MUY pequeño */
    font-size: 1.0em;
    font-weight: normal; 
    font-style: italic;
    color: #7a5c3f;
}

header h2 {
    margin-top: 5px; /* Margen superior MUY pequeño */
    margin-bottom: 2px;
    font-size: 1.3em; 
    color: #7a5c3f; 
    text-transform: uppercase;
}

header .association {
    margin: 2px 0 0 0; 
    font-size: 0.85em; 
    color: #7a5c3f; 
    text-transform: uppercase;
    font-style: italic; 
}

/* --- ESTILOS PARA SEGUNDO LOGO (ELIMINADOS) --- */


/* --- NAVEGACIÓN PRINCIPAL --- */
.main-nav {
    background-color: #d4b28c; 
    padding: 0;
    margin-top: 10px; /* Añadido un poco de margen superior para separar del header */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.main-nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center; 
}
.main-nav ul li a {
    display: block;
    color: #ffffff; 
    text-align: center;
    padding: 14px 20px; 
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
}
.main-nav ul li a:hover {
    background-color: #c5a076; 
}
.main-nav ul li a.active {
    background-color: #b58e60; 
}

main {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto; 
}

.breadcrumb {
    margin-bottom: 20px;
    font-size: 1em; 
    font-weight: bold;
    color: #7a5c3f; 
    text-transform: uppercase;
}

.breadcrumb a {
    color: #b58e60; 
    text-decoration: none;
    font-weight: bold;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.category-title, 
.page-section-title { 
    text-align: center;
    font-size: 1.9em; 
    color: #8c6d4f; 
    margin-top: 10px;
    margin-bottom: 25px;
    font-weight: bold;
    text-transform: uppercase;
}

.seo-intro {
    max-width: 920px;
    margin: 0 auto 30px auto;
    padding: 24px 28px;
    background-color: #fffaf5;
    border: 1px solid #ead9c6;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.seo-intro h1 {
    margin: 0 0 14px 0;
    color: #7a5c3f;
    font-size: clamp(1.7rem, 4.8vw, 2.2rem);
    line-height: 1.2;
    text-align: center;
    text-wrap: balance;
}

.seo-intro p {
    margin: 0 0 12px 0;
    font-size: clamp(1rem, 2.3vw, 1.05rem);
    color: #5c4d41;
}

.seo-intro p:last-child {
    margin-bottom: 0;
}

.pictogram-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: 10px 0;
}

.pictogram-item {
    background-color: #fffaf5; 
    border: 3px solid #fffaf5; 
    border-radius: 8px;
    padding: 10px; 
    text-align: center;
    text-decoration: none;
    color: #4a4a4a;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    width: 170px; 
    height: 170px; 
    box-sizing: border-box;
    cursor: default; 
    position: relative; 
}

.pictogram-item.clickable-picto, 
.pictogram-item.game-option, 
.pictogram-item.sequence-step-option,
.pictogram-item.game-item a, 
.pictogram-item.category-item a, 
.pictogram-item.routine-item a,
.pictogram-item.routine-sequence-item,
.pictogram-item.nav-link-item,
.pictogram-item.has-audio 
{ 
    cursor: pointer; 
}

.pictogram-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08); 
}

.pictogram-item img {
    width: 140px; 
    height: 140px; 
    object-fit: contain;
    border-radius: 4px;
}

.item-placeholder { 
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ede0d4; 
    color: #7a5c3f;
    font-weight: bold;
    text-align: center;
    border-radius: 4px;
    font-size: 0.9em;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;
    word-break: break-word;
}

.pictogram-item.selected-picto { 
    border-color: #007bff !important; 
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
}

.pictogram-item.selected-correct,
.sequence-target-slot .pictogram-item-image-wrapper.selected-correct { 
    border-color: #28a745 !important; 
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.7);
}

.pictogram-item.selected-incorrect,
.sequence-target-slot .pictogram-item-image-wrapper.selected-incorrect { 
    border-color: #dc3545 !important; 
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.7);
}

.audio-trigger-button {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.5); 
    border: none;
    border-radius: 50%; 
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 10; 
}

.audio-trigger-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.audio-trigger-button img {
    width: 20px; 
    height: 20px;
    filter: brightness(0) invert(1); 
}

.back-link, .game-button { 
    display: inline-block;
    padding: 10px 20px;
    background-color: #d4b28c; 
    color: white !important; 
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 1em; 
    margin: 5px;
    border: none;
    cursor: pointer;
    text-align: center;
}

.back-link:hover, .game-button:hover {
    background-color: #c5a076; 
}

.game-button img { 
    height: 1em;
    vertical-align: middle;
    margin-right: 5px;
    filter: brightness(0) invert(1); 
}

.game-button:disabled {
    background-color: #e0c9b1;
    cursor: not-allowed;
}

#instruction-area, .instruction-text {
    text-align: center;
    margin-bottom: 15px; 
    font-size: 1.15em; 
    color: #5c4d41;
}

#instruction-area p, .instruction-text {
    margin: 0 0 10px 0;
}

#feedback-area, #sequence-feedback-area {
    font-weight: bold;
    font-size: 1.1em;
    color: #5c4d41; 
    min-height: 1.5em; 
    text-align: center;
    margin-top: 15px;
}

.error-message,
.flash-messages-container .alert { 
    padding: 10px 15px;
    margin: 0 auto 15px auto; 
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center; 
    max-width: 700px; 
}
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-danger, .error-message { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }
.alert-warning { color: #856404; background-color: #fff3cd; border-color: #ffeeba; }

#game-sequence-area {
    margin-top: 20px;
    padding: 15px;
    background-color: #fffdfa; 
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.source-grid, .target-grid {
    border: 2px dashed #d4b28c;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 200px; 
    border-radius: 6px;
}

.sequence-step-option { 
    cursor: grab; 
    transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.2s ease;
}

.sequence-step-option:active {
    cursor: grabbing;
}

.sequence-step-option[style*="visibility: hidden"] { 
    opacity: 0.3;
    border-color: #e0e0e0 !important; 
    pointer-events: none; 
}

.pictogram-item-image-wrapper { 
    display: inline-block; 
    padding: 3px; 
    border: 3px solid transparent; 
    border-radius: 6px; 
    transition: border-color 0.3s ease;
}

.pictogram-item-image-wrapper.selected-correct {
    border-color: #28a745 !important;
}

.pictogram-item-image-wrapper.selected-incorrect {
    border-color: #dc3545 !important;
}

.sequence-target-slot { 
    border-style: dashed;
    border-color: #b58e60;
    background-color: #f8f1e9; 
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; 
    transition: background-color 0.3s ease, border-color 0.3s ease; 
    overflow: hidden; 
}

.sequence-target-slot:hover {
    background-color: #f3eadf; 
}

.sequence-target-slot img { 
    max-width: 100%; 
    max-height: 100%;
    display: block; 
}

.slot-number { 
    font-size: 2em;
    font-weight: bold;
    color: #d4b28c;
    opacity: 0.7;
    position: absolute; 
    z-index: 1; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.sequence-target-slot .pictogram-item-image-wrapper { 
    position: relative;
    z-index: 2;
}

hr.sequence-divider {
    border: 0;
    height: 2px;
    background-color: #d4b28c;
    margin: 30px 0;
}

#balloons-container {
    position: fixed; 
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%; 
    pointer-events: none; 
    overflow: hidden; 
    z-index: 9999; 
}

.balloon {
    width: 60px;  
    height: 75px; 
    border-radius: 50% / 40% 40% 60% 60%; 
    background-color: #FFC0CB; 
    position: absolute;
    bottom: -100px; 
    opacity: 0.8;
    animation: riseAndFade 4s ease-in forwards; 
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.07); 
}

.balloon::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: inherit; 
    border-radius: 50%;
    bottom: -4px; 
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.05);
}

@keyframes riseAndFade { 
    0% { transform: translateY(0) scale(0.8) rotate(0deg); opacity: 0.8; }
    20% { transform: translateY(-20vh) scale(1) rotate(-5deg); }
    40% { transform: translateY(-40vh) scale(1.1) rotate(5deg); }
    60% { transform: translateY(-60vh) scale(1) rotate(-3deg); }
    80% { transform: translateY(-80vh) scale(0.9) rotate(3deg); }
    100% { transform: translateY(-120vh) scale(0.7) rotate(0deg); opacity: 0; }
}

footer {
    text-align: center;
    padding: 20px;
    background-color: #ede0d4; 
    color: #7a5c3f;
    font-size: 0.9em;
    margin-top: 30px;
    border-top: 1px solid #d4b28c; 
}

footer p {
    margin: 5px 0; 
}

/* --- RESPONSIVE DESIGN --- */

@media (max-width: 768px) { 
    .header-logo-main {
        height: 150px; /* Reducir logo principal en tablets */
        width: 150px;
    } 
    header h1 { font-size: 1.8em; }
    header h2 { font-size: 1.0em; }
    header .association { font-size: 0.75em; }
    .main-nav ul li a { font-size: 0.9em; padding: 12px 10px; }
    .page-section-title, .category-title, .breadcrumb { font-size: 1.4em; margin-bottom: 15px; }
    .pictogram-grid { gap: 15px; }
    .source-grid, .target-grid { min-height: 150px; }
    .source-grid .pictogram-item, .target-grid .pictogram-item { width: 130px; height: 130px; }
    .source-grid .pictogram-item img, .target-grid .pictogram-item img, .source-grid .item-placeholder, .target-grid .item-placeholder { width: 100px; height: 100px; }
    .slot-number { font-size: 1.5em; }
    .balloon { width: 45px; height: 58px; }
    .balloon::after { width: 6px; height: 6px; bottom: -3px; }
}

@media (max-width: 600px) { 
    .header-logo-main {
        height: 120px; /* Reducir logo principal aún más en móviles */
        width: 120px;
    } 
    .main-nav ul { flex-direction: column; align-items: stretch; }
    .main-nav ul li a { border-bottom: 1px solid #c5a076; text-align: left; padding: 10px 16px; font-size: 0.82em; }
    .main-nav ul li:last-child a { border-bottom: none; }
    .seo-intro { padding: 18px 16px; margin-bottom: 22px; }
    .seo-intro h1 { font-size: 1.9rem; line-height: 1.12; margin-bottom: 12px; }
    .seo-intro p { font-size: 0.98rem; line-height: 1.55; }
    .pictogram-grid { gap: 10px; }
    .pictogram-item { flex-basis: calc(33.333% - 7px); max-width: calc(33.333% - 7px); height: auto; min-height: 100px; padding: 5px; }
    .pictogram-item img, .item-placeholder { width: 90%; max-width: 100px; height: auto; }
    .game-options-grid .pictogram-item { flex-basis: calc(50% - 5px); max-width: calc(50% - 5px); min-height: 130px; }
    .game-options-grid .pictogram-item img { max-width: 120px; }
    .source-grid .pictogram-item { flex-basis: calc(33.333% - 7px); max-width: calc(33.333% - 7px); }
    .source-grid.few-items .pictogram-item { flex-basis: calc(50% - 5px); max-width: calc(50% - 5px); }
    .target-grid .pictogram-item { flex-basis: calc(33.333% - 7px); max-width: calc(33.333% - 7px); }
    #instruction-area, .instruction-text { font-size: 1.1em; }
    .game-button, .back-link { font-size: 0.9em; padding: 8px 15px; }
}

@media (max-width: 420px) { 
    .header-logo-main {
        height: 100px;
        width: 100px;
    }
    header h1 { font-size: 1.6em; }
    header h2 { font-size: 0.9em; }
    header .association { font-size: 0.7em; } 
    .main-nav ul li a { font-size: 0.78em; padding: 9px 14px; }
    .seo-intro { padding: 16px 14px; border-radius: 10px; }
    .seo-intro h1 { font-size: 1.55rem; line-height: 1.1; text-align: left; }
    .seo-intro p { font-size: 0.94rem; line-height: 1.5; }
    .page-section-title, .category-title, .breadcrumb { font-size: 1.2em; }
    .pictogram-grid:not(.game-options-grid):not(.source-grid):not(.target-grid) .pictogram-item { flex-basis: calc(50% - 5px); max-width: calc(50% - 5px); min-height: 120px; }
    .pictogram-grid:not(.game-options-grid):not(.source-grid):not(.target-grid) .pictogram-item img, .pictogram-grid:not(.game-options-grid):not(.source-grid):not(.target-grid) .item-placeholder { max-width: 110px; }
    .game-options-grid .pictogram-item, .source-grid .pictogram-item, .target-grid .pictogram-item { flex-basis: calc(50% - 5px); max-width: calc(50% - 5px); min-height: 110px; }
    .game-options-grid .pictogram-item img, .source-grid .pictogram-item img, .target-grid .pictogram-item img, .source-grid .item-placeholder, .target-grid .item-placeholder { max-width: 100px; }
}
