/* Animaciones para la cabecera */
.header-animated {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    width: 100%;
}

.animated-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.animated-icon {
    position: absolute;
    font-size: 20px;
    opacity: 0;
    color: var(--primary-color);
    animation: float-icon 8s linear infinite;
    z-index: 0;
    /* Aumentada la transparencia para que no interfiera con el título */
    opacity: 0;
}

@keyframes float-icon {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.7);
    }
    20% {
        /* Reducida la opacidad máxima de 0.6 a 0.3 */
        opacity: 0.3;
        transform: translateY(0) scale(1);
    }
    80% {
        /* Reducida la opacidad máxima de 0.6 a 0.3 */
        opacity: 0.3;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.7);
    }
}

header h1 {
    position: relative;
    z-index: 1;
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 0;
}

header h1 .subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
    font-weight: normal;
    margin-top: -3px;
}

/* Sección de bienvenida */
#welcome-section {
    animation: fadeIn 0.5s ease-out;
    margin-top: 1.5rem;
}

.welcome-content {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.welcome-content h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome-content p {
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.welcome-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.feature-item i {
    font-size: 1.8rem;
    color: var(--primary-color);
    background-color: rgba(var(--primary-color-rgb), 0.1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s;
}

.feature-item:hover i {
    transform: scale(1.1);
    background-color: rgba(var(--primary-color-rgb), 0.2);
}

.welcome-instructions {
    margin: 2rem 0;
    padding: 1rem;
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border-radius: 8px;
}

.welcome-searchbox {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 8px 15px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.welcome-searchbox:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.welcome-searchbox:active {
    transform: scale(0.98);
}

.welcome-searchbox i {
    margin-right: 8px;
    opacity: 0.7;
}

.sample-search {
    font-style: italic;
    opacity: 0.8;
}

/* Ajuste para dispositivos móviles */
@media (max-width: 600px) {
    .welcome-content {
        padding: 1.5rem;
    }
    
    .welcome-features {
        gap: 1rem;
    }
    
    .feature-item i {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .header-logo {
        width: 46px;
    }
}

/* Modificaciones al CSS base para soportar variables RGB */
:root {
    /* El acento lo fija js/accent.js en :root; estos valores son el de serie. */
    --primary-color-rgb: var(--accent-rgb-light, 45, 113, 134);
    --primary-color-dark-rgb: var(--accent-rgb-dark, 98, 189, 214);
}

body.dark-theme {
    --primary-color-rgb: var(--accent-rgb-dark, 98, 189, 214); /* Actualiza para tema oscuro */
}

/* Estilos para el botón de instalación */
#install-button {
    position: relative;
}

#install-button::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #4CAF50;
    border-radius: 50%;
    display: none;
}

#install-button.show-indicator::after {
    display: block;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}



/* Reemplazar animación de iconos por ecualizador */
.header-animated {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    width: 100%;
}

/* Contenedor del ecualizador */
.equalizer-container {
    position: absolute;
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    /* La barra mas alta mide 30px (animations.js): esa es la altura de la franja. */
    height: 30px;
    z-index: 0;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
}

/* Barras del ecualizador */
.equalizer-bar {
    background-color: rgba(var(--primary-color-rgb), 0.3);
    width: 4px;
    border-radius: 2px;
    height: 15px;
    margin: 0 1px;
    animation: equalize var(--eq-duration, 1s) infinite ease-in-out;
}

/* Animación para las barras del ecualizador */
@keyframes equalize {
    0% {
        height: 5px;
    }
    50% {
        height: var(--eq-height, 20px);
    }
    100% {
        height: 5px;
    }
}

/* Eliminar la clase animated-icons y animated-icon que ya no usaremos */
.animated-icons {
    display: none;
}

/* Mejorar la visibilidad del título */
header h1 {
    position: relative;
    z-index: 1;
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 0;
}

header h1 .subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
    font-weight: normal;
    margin-top: -3px;
}

/* =====================================================================
   Base de datos y ficha ampliada
   Va al final de animations.css porque es la ultima hoja: desde aqui se
   pueden ajustar .welcome-features y .feature-item sin pelear por peso.
   ===================================================================== */

/* El titulo es el enlace al inicio, como en cualquier web. */
header h1[data-menu], .header-logo { cursor: pointer; }

/* Cabecera en una fila: texto a la izquierda, logo a la derecha. Asi el logo
   esta siempre a la vista y el bloque central se queda para el contenido. */
header { text-align: left; }

.header-animated {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 34px;
}

header h1 {
    align-items: flex-start;
    text-align: left;
}

.header-logo {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 56px;
    height: auto;
}

/* --- Menu de hamburguesa y buscador ---------------------------------- */
/* El menu es un icono plano a la izquierda; la lupa vive dentro del cuadro de
   busqueda. Asi solo hay una forma con fondo y el menu no parece parte de ella. */
#search-section { position: relative; flex-wrap: nowrap; align-items: center; }

/* Un <input> arrastra su ancho minimo (size=20) y con tres elementos en la fila
   desbordaba a lo ancho: con min-width 0 se encoge y ocupa lo que sobra. */
#search-input { min-width: 0; padding-right: 3rem; }

.search-menu-button {
    flex: 0 0 auto;
    padding: 0.6rem 0.5rem;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--text-color);
    font-size: 1.35rem;
    line-height: 1;
    opacity: 0.85;
    cursor: pointer;
    transition: color 0.2s, opacity 0.2s, transform 0.1s;
}

.search-menu-button:hover { color: var(--primary-color); opacity: 1; }
.search-menu-button:active { transform: scale(0.9); }

/* El boton de buscar sale del flujo y se apoya sobre el borde derecho del input. */
#search-button {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    padding: 0.5rem 0.75rem;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--text-color);
    font-size: 1.05rem;
    opacity: 0.7;
    transition: color 0.2s, opacity 0.2s;
}

#search-button:hover { color: var(--primary-color); opacity: 1; filter: none; }
#search-button:active { transform: translateY(-50%) scale(0.9); }

.main-menu {
    position: absolute;
    top: calc(100% - 0.3rem);
    left: 0.5rem;
    z-index: 20;
    min-width: 210px;
    display: flex;
    flex-direction: column;
    padding: 6px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    text-align: left;
}

.main-menu.hidden { display: none; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: none;
    border: 0;
    border-radius: 8px;
    color: var(--text-color);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover { background-color: rgba(var(--primary-color-rgb), 0.15); }
.menu-item i { width: 20px; color: var(--primary-color); text-align: center; }

/* --- Accesos directos de la pantalla de inicio (ahora cuatro) --------- */
.welcome-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.feature-item {
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.feature-item span { font-size: 0.8rem; line-height: 1.15; }

.feature-item i {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
}

.feature-item.accent i {
    background-color: rgba(var(--primary-color-rgb), 0.18);
    border: 1px solid rgba(var(--primary-color-rgb), 0.45);
}

/* --- Base de datos: categorias, iniciales y listados ------------------ */
.catalog-heading { margin-bottom: 1.25rem; }
.catalog-heading h2 { font-size: 1.5rem; color: var(--primary-color); }
.catalog-heading p { margin-top: 0.25rem; font-size: 0.9rem; opacity: 0.75; }

.catalog-group {
    display: grid;
    gap: 8px;
    margin-bottom: 1.5rem;
}

/* Sin icono: el peso lo llevan la tipografia y la barra de color. */
.catalog-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 16px 18px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--primary-color);
    border-radius: 10px;
    color: var(--text-color);
    font: inherit;
    font-size: 1.05rem;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s;
}

.catalog-row:hover { transform: translateX(3px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); }
.catalog-row:active { transform: scale(0.985); }
.catalog-row i { color: var(--primary-color); font-size: 0.9rem; opacity: 0.7; }

.letters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
}

.letter-button {
    padding: 14px 0;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-color);
    font: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.letter-button:hover { background-color: var(--primary-color); color: var(--button-text); }
.letter-button:active { transform: scale(0.94); }
.letter-button.wide { grid-column: span 2; font-size: 0.9rem; }

#catalog-list .item-year { opacity: 0.7; font-size: 0.9em; margin-left: 0.3rem; }

/* --- Ficha ampliada --------------------------------------------------- */
.ficha-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ficha-type { opacity: 0.8; }
.ficha-photo { margin-bottom: 1rem; }
.ficha-top .ficha-photo { margin-bottom: 0; }

.ficha-photo img {
    display: block;
    max-width: 150px;
    max-height: 210px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.info-table {
    display: grid;
    gap: 6px;
}

.info-row {
    display: grid;
    grid-template-columns: minmax(110px, 30%) 1fr;
    gap: 10px;
    padding: 8px 10px;
    background-color: rgba(var(--primary-color-rgb), 0.07);
    border-radius: 6px;
}

.info-label {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.info-value { word-break: break-word; }

.note-block {
    padding: 12px 14px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    line-height: 1.5;
}

.video-item a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* --- Configuracion: color de acento --- */
.accent-current {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background-color: var(--card-bg);
}

.accent-chip {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(var(--primary-color-rgb), 0.45);
    flex-shrink: 0;
}

.accent-current-text p { margin: 0; font-size: 0.9rem; opacity: 0.8; }
.accent-current-text .accent-hex { font-weight: bold; opacity: 1; color: var(--primary-color); }

.accent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 0.6rem;
    margin-top: 1rem;
}

.accent-swatch {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    transition: transform 0.15s ease, border-color 0.2s;
}

.accent-swatch i { opacity: 0; }
.accent-swatch.selected { border-color: var(--text-color); }
.accent-swatch.selected i { opacity: 1; }
.accent-swatch:hover { transform: scale(1.08); }
.accent-swatch:active { transform: scale(0.94); }

.accent-rainbow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
    background: linear-gradient(90deg, #e23e3e, #f07818, #d9a406, #10b981,
                                       #14b8a6, #3b82f6, #4f46e5, #8b5cf6, #c026d3, #ec4899);
}

.accent-rainbow input[type="color"] {
    width: 46px;
    height: 34px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    background: none;
    cursor: pointer;
}

@media (max-width: 600px) {
    #search-section { gap: 0.25rem; padding: 0 0.35rem; }
    .search-menu-button { padding: 0.6rem 0.4rem; }
    #search-input { padding: 0.8rem; padding-right: 2.75rem; }
    #search-button { right: 0.35rem; padding: 0.5rem 0.65rem; }
    .welcome-features { gap: 0.5rem; }
    .feature-item i { width: 46px; height: 46px; font-size: 1.3rem; }
    .feature-item span { font-size: 0.72rem; }
    .info-row { grid-template-columns: 1fr; gap: 2px; }
    .ficha-photo img { max-width: 120px; max-height: 170px; }
}
