/* CSS Elegante y Premium - Gris Claro con Degradados y Acentos Vibrantes */

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

:root {
    /* Paleta de Acentos Alegres y Modernos (Adaptada a fondo claro) */
    --color-teal: #0284c7;       /* Turquesa profundo vibrante */
    --color-coral: #ef4444;      /* Coral cálido vivo */
    --color-amber: #f59e0b;      /* Ámbar enérgico */
    --color-mint: #10b981;       /* Menta orgánico */
    --color-violet: #8b5cf6;     /* Violeta creativo */
    
    /* Fondo Gris Claro con Degradados */
    --bg-main: #f1f5f9;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(255, 255, 255, 0.6);
    --text-main: #0f172a;        /* Gris pizarra muy oscuro */
    --text-muted: #475569;       /* Gris medio para textos secundarios */
    --text-light: #64748b;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    overflow-x: hidden;
    position: relative;
}

/* Animación sutil de oscilación con auroras suaves de colores de fondo */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(2, 132, 199, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(239, 68, 68, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 50% 10%, rgba(139, 92, 246, 0.04) 0%, transparent 45%);
    z-index: -1;
    animation: slowSway 20s infinite alternate ease-in-out;
}

/* Scrollbar moderno adaptado al fondo gris claro */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-teal);
}

.container {
    width: 100%;
    max-width: 780px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 0.25rem;
    animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Logotipo alegre con contraste sobre fondo claro */
h1.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 3.4rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    display: inline-flex;
    gap: 1.5px;
    filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.08));
}

h1.logo span {
    display: inline-block;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

h1.logo span:hover {
    transform: translateY(-8px) scale(1.12);
}

.g-blue { color: var(--color-teal); }
.g-red { color: var(--color-coral); }
.g-yellow { color: var(--color-amber); }
.g-green { color: var(--color-mint); }

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.4rem;
    letter-spacing: 0.3px;
}

/* Tarjeta Principal en Gris Claro Vidrioso con Degradado */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    padding: 2.2rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 
        0 20px 50px rgba(15, 23, 42, 0.08), 
        0 5px 15px rgba(15, 23, 42, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Detalle colorido y alegre en el borde superior de la tarjeta gris claro */
.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, 
        var(--color-teal) 0%, 
        var(--color-teal) 25%, 
        var(--color-coral) 25%, 
        var(--color-coral) 50%, 
        var(--color-amber) 50%, 
        var(--color-amber) 75%, 
        var(--color-mint) 75%, 
        var(--color-mint) 100%);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

textarea {
    width: 100%;
    min-height: 160px;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 1.2rem;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    transition: var(--transition-smooth);
    box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.02);
}

textarea:focus {
    border-color: var(--color-teal);
    background: #ffffff;
    box-shadow: 
        0 0 0 4px rgba(2, 132, 199, 0.15),
        inset 0 2px 4px rgba(15, 23, 42, 0.01);
}

/* Fila de controles */
.controls-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 580px) {
    .controls-row {
        grid-template-columns: 1fr;
    }
}

select {
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-smooth);
    width: 100%;
}

select:focus {
    border-color: var(--color-teal);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
    background: #ffffff;
}

option {
    background-color: #ffffff;
    color: var(--text-main);
}

/* Barra de Botones */
.buttons-bar {
    display: flex;
    gap: 1rem;
    margin-top: 0.25rem;
}

.btn {
    flex-grow: 1;
    border-radius: 16px;
    padding: 0.95rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-teal) 0%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-muted);
    border: 1.5px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.02);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.05);
    color: var(--color-coral);
    border-color: rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Panel de Visualización Karaoke --- */
.reader-panel {
    background: rgba(255, 255, 255, 0.5);
    border: 1.5px solid rgba(15, 23, 42, 0.06);
    border-radius: 20px;
    padding: 1.6rem;
    min-height: 120px;
    max-height: 250px;
    overflow-y: auto;
    display: none; /* Activo con JS */
    box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.04);
    animation: fadeIn 0.4s ease-out;
}

.reader-text {
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-muted);
    font-weight: 400;
    word-break: break-word;
}

/* Estilo de la Palabra Activa Alegre y Brillante */
.word-span {
    display: inline-block;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border-radius: 6px;
    padding: 0 4px;
    margin: 0 1px;
    color: var(--text-main);
}

.word-span:hover {
    background: rgba(2, 132, 199, 0.08);
    color: var(--color-teal);
}

.word-span.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--color-teal) 0%, var(--color-violet) 100%);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
    font-weight: 700;
    transform: translateY(-2px) scale(1.08);
    animation: pulseActive 1s infinite alternate;
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 1rem;
    font-weight: 600;
}

/* Animaciones */

@keyframes slowSway {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(1.5%, 1.5%) scale(1.02); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseActive {
    0% { box-shadow: 0 3px 8px rgba(2, 132, 199, 0.25); }
    100% { box-shadow: 0 5px 16px rgba(2, 132, 199, 0.45); }
}

/* --- Modal de Progreso para Generación de MP3 --- */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.progress-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    padding: 2.2rem;
    width: 90%;
    max-width: 460px;
    box-shadow: 
        0 20px 40px rgba(15, 23, 42, 0.12),
        0 5px 15px rgba(15, 23, 42, 0.06);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.progress-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(15, 23, 42, 0.06);
    border-radius: 5px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-teal) 0%, var(--color-violet) 100%);
    border-radius: 5px;
    transition: width 0.25s ease-out;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.btn-cancel {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-muted);
    border: 1.5px solid rgba(15, 23, 42, 0.05);
    border-radius: 12px;
    padding: 0.7rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
    display: block;
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--color-coral);
    border-color: rgba(239, 68, 68, 0.15);
}

