/* ========================================
   Veinte Cuentos Cortos - Estilos
   ======================================== */

:root {
    --color-primary: #8b5cf6;
    --color-primary-dark: #7c3aed;
    --color-secondary: #f59e0b;
    --color-bg-dark: #0f0a1a;
    --color-bg-card: rgba(15, 10, 26, 0.85);
    --color-text: #f8fafc;
    --color-text-muted: #94a3b8;
    --color-accent: #c084fc;
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.3);
}

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: var(--color-bg-dark);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Image */
.page-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
}

.page-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(15, 10, 26, 0.92) 0%,
        rgba(15, 10, 26, 0.8) 50%,
        rgba(15, 10, 26, 0.92) 100%
    );
    z-index: -1;
}

/* Floating Particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-accent);
    border-radius: 50%;
    opacity: 0;
    animation: float-up 8s infinite;
}

@keyframes float-up {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-10vh) scale(1);
    }
}

/* Main Content */
.main-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Card Container */
.cuento-card {
    background: var(--color-bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1.5rem;
    padding: 3rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-glow);
    animation: fadeInUp 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

.cuento-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        rgba(139, 92, 246, 0.05) 0%,
        transparent 50%
    );
    animation: rotate-glow 15s linear infinite;
}

@keyframes rotate-glow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* Book Title */
.libro-titulo {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Cuento Title */
.cuento-titulo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.cuento-numero {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--color-accent);
    background: rgba(139, 92, 246, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.cuento-descripcion {
    color: var(--color-text-muted);
    text-align: center;
    font-style: italic;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(139, 92, 246, 0.4),
        transparent
    );
    margin: 1.5rem 0;
}

/* Audio Player */
.audio-player {
    position: relative;
    z-index: 1;
}

.player-container {
    background: rgba(15, 10, 26, 0.6);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid rgba(139, 92, 246, 0.1);
}

/* Play Button */
.play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(139, 92, 246, 0.6);
}

.play-btn:active {
    transform: scale(0.95);
}

.play-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
    margin-left: 2px;
}

.play-btn.playing svg {
    margin-left: 0;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-bar:hover .progress-fill::after {
    opacity: 1;
}

/* Time Display */
.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    font-family: 'Courier New', monospace;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
}

.volume-icon {
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.volume-icon:hover {
    color: var(--color-text);
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Waveform Animation */
.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 30px;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.waveform.active {
    opacity: 1;
}

.wave-bar {
    width: 3px;
    background: var(--color-accent);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; height: 10px; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 15px; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; height: 25px; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; height: 12px; }
.wave-bar:nth-child(6) { animation-delay: 0.5s; height: 22px; }
.wave-bar:nth-child(7) { animation-delay: 0.6s; height: 18px; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* Footer */
.footer-text {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    position: relative;
    z-index: 1;
}

.footer-text a {
    color: var(--color-accent);
    text-decoration: none;
}

/* Error State */
.error-container {
    text-align: center;
    padding: 3rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.error-message {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.btn-volver {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.btn-volver:hover {
    background: var(--color-primary-dark);
}

/* Responsive */
@media (max-width: 576px) {
    .cuento-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
        border-radius: 1rem;
    }

    .cuento-titulo {
        font-size: 1.4rem;
    }

    .play-btn {
        width: 56px;
        height: 56px;
    }
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
