/* Mei Mei and the Magic Dragon - Interactive Storybook Styles */

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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #e8f5e8 0%, #b8e6b8 50%, #90d690 100%);
    min-height: 100vh;
    color: #2d5016;
    overflow-x: hidden;
}

.storybook-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.title {
    font-size: 2.5rem;
    color: #2d5016;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    background: linear-gradient(45deg, #2d5016, #4a7c59);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    font-style: italic;
}

/* Story Page */
.story-page {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    flex-grow: 1;
    display: none;
    animation: fadeIn 0.6s ease-in-out;
}

.story-page.active {
    display: block;
}

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

.page-number {
    font-size: 1rem;
    color: #888;
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
}

.story-illustration {
    width: 100%;
    max-width: 500px;
    height: 350px;
    object-fit: cover;
    border-radius: 15px;
    margin: 0 auto 25px auto;
    display: block;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.story-illustration:hover {
    transform: scale(1.02);
}

.story-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2d5016;
    text-align: justify;
    margin-bottom: 25px;
    text-indent: 2em;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(184, 230, 184, 0.3);
    border-radius: 15px;
}

.play-button {
    background: linear-gradient(45deg, #4a7c59, #2d5016);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.play-button:active {
    transform: translateY(0);
}

.play-button.playing {
    background: linear-gradient(45deg, #d4a574, #b8860b);
}

.audio-icon {
    font-size: 1.2rem;
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.nav-button {
    background: linear-gradient(45deg, #4a7c59, #2d5016);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.nav-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.page-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    transition: all 0.3s ease;
    cursor: pointer;
}

.page-dot.active {
    background: linear-gradient(45deg, #4a7c59, #2d5016);
    transform: scale(1.3);
}

.page-dot:hover {
    transform: scale(1.2);
}

/* Auto-advance toggle */
.auto-advance {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #666;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 25px;
    background: #ddd;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: #4a7c59;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(25px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .storybook-container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .story-page {
        padding: 20px;
    }
    
    .story-illustration {
        height: 250px;
    }
    
    .story-text {
        font-size: 1rem;
        text-align: left;
    }
    
    .navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
    }
    
    .story-illustration {
        height: 200px;
    }
    
    .audio-controls {
        flex-direction: column;
        gap: 10px;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Magical effects */
.magic-sparkle {
    position: fixed;
    pointer-events: none;
    font-size: 20px;
    color: #ffd700;
    animation: sparkle 2s ease-out forwards;
    z-index: 1000;
}

@keyframes sparkle {
    0% {
        opacity: 1;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(360deg);
    }
}