/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive, sans-serif;
    background: linear-gradient(135deg, #FFE5B4 0%, #FFCCCB 50%, #E6E6FA 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* Header */
.story-header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.story-header h1 {
    font-size: 2.5rem;
    color: #FF6B9D;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    font-weight: 400;
}

/* Main Story Area */
.story-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

/* Story Pages */
.story-page {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    max-width: 900px;
    width: 100%;
    animation: fadeIn 0.5s ease-in-out;
}

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

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

/* Story Content Layout */
.story-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 25px;
}

/* Illustration */
.illustration-container {
    text-align: center;
}

.story-illustration {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

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

/* Story Text */
.story-text {
    padding: 20px;
}

.story-text h2 {
    font-size: 1.8rem;
    color: #FF6B9D;
    margin-bottom: 15px;
    text-align: center;
}

.story-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
    text-align: justify;
}

.story-moral {
    margin-top: 20px;
    padding: 15px;
    background: #FFF8DC;
    border-radius: 10px;
    border-left: 4px solid #FFD700;
}

.story-moral p {
    text-align: center;
    font-style: italic;
}

/* Audio Controls */
.audio-controls {
    text-align: center;
    margin-top: 20px;
}

.play-audio-btn {
    background: linear-gradient(45deg, #FF6B9D, #4ECDC4);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: 'Comic Neue', cursive;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

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

.play-audio-btn.playing {
    background: linear-gradient(45deg, #4ECDC4, #45B7D1);
}

/* Navigation */
.story-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 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.nav-btn {
    background: linear-gradient(45deg, #4ECDC4, #45B7D1);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-family: 'Comic Neue', cursive;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.page-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    color: #666;
    background: #FFF8DC;
    padding: 10px 20px;
    border-radius: 15px;
}

.current-page {
    color: #FF6B9D;
    font-size: 1.4rem;
}

/* Auto-play Controls */
.auto-play-controls {
    text-align: center;
    margin-bottom: 20px;
}

.auto-play-btn,
.stop-auto-play-btn {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: 'Comic Neue', cursive;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 0 10px;
}

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

.stop-auto-play-btn {
    background: linear-gradient(45deg, #FF6B6B, #FF4757);
}

/* Footer */
.story-footer {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    color: #666;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .story-header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .story-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .story-text {
        padding: 10px;
    }
    
    .story-text h2 {
        font-size: 1.5rem;
    }
    
    .story-text p {
        font-size: 1rem;
    }
    
    .story-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .storybook-container {
        padding: 10px;
    }
    
    .story-page {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .story-header h1 {
        font-size: 1.8rem;
    }
    
    .story-text p {
        font-size: 0.95rem;
        text-align: left;
    }
    
    .play-audio-btn,
    .auto-play-btn,
    .stop-auto-play-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

/* 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);
    }
}

/* Accessibility */
.nav-btn:focus,
.play-audio-btn:focus,
.auto-play-btn:focus,
.stop-auto-play-btn:focus {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .story-navigation,
    .audio-controls,
    .auto-play-controls {
        display: none;
    }
    
    .story-page {
        display: block !important;
        page-break-after: always;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .story-page:last-child {
        page-break-after: auto;
    }
}