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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Container */
.storybook-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 100vh;
}

/* Header */
.story-header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    padding: 2rem;
    text-align: center;
    border-bottom: 3px solid #ff6b9d;
}

.story-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.story-subtitle {
    font-size: 1.2rem;
    color: #34495e;
    font-weight: 600;
}

/* Main Content */
.story-main {
    padding: 2rem;
    min-height: 600px;
}

/* Scene Styles */
.story-scene {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

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

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

.scene-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    min-height: 500px;
}

.scene-image {
    text-align: center;
}

.scene-image img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.scene-image img:hover {
    transform: scale(1.02);
}

.scene-text {
    padding: 1rem;
}

.scene-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
}

.scene-paragraph {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #34495e;
    margin-bottom: 2rem;
    text-align: justify;
}

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

.play-audio-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.play-audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

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

.play-audio-btn.playing {
    background: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4); }
    50% { box-shadow: 0 8px 25px rgba(255, 107, 157, 0.8); }
    100% { box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4); }
}

/* Navigation */
.story-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    background: #f8f9fa;
    border-top: 2px solid #e9ecef;
}

.nav-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

/* Scene Indicators */
.scene-indicators {
    display: flex;
    gap: 1rem;
}

.indicator {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #bdc3c7;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #667eea;
    transform: scale(1.3);
}

.indicator:hover {
    background: #95a5a6;
    transform: scale(1.1);
}

/* Auto-play Controls */
.auto-play-controls {
    text-align: center;
    padding: 1rem 2rem;
    background: #ecf0f1;
}

.auto-play-btn, .stop-auto-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.stop-auto-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.auto-play-btn:hover, .stop-auto-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
}

.stop-auto-btn:hover {
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

/* Footer */
.story-footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem;
}

.footer-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.footer-credits {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .storybook-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .story-title {
        font-size: 2rem;
    }
    
    .scene-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .scene-title {
        font-size: 1.5rem;
    }
    
    .scene-paragraph {
        font-size: 1rem;
        text-align: left;
    }
    
    .story-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-btn {
        min-width: 100px;
        font-size: 0.9rem;
        padding: 0.8rem 1.2rem;
    }
    
    .scene-indicators {
        order: -1;
    }
}

@media (max-width: 480px) {
    .story-header {
        padding: 1.5rem 1rem;
    }
    
    .story-main {
        padding: 1.5rem 1rem;
    }
    
    .story-title {
        font-size: 1.8rem;
    }
    
    .story-subtitle {
        font-size: 1rem;
    }
    
    .scene-title {
        font-size: 1.3rem;
    }
    
    .scene-paragraph {
        font-size: 0.95rem;
    }
    
    .play-audio-btn {
        padding: 0.8rem 1.5rem;
        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 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
.indicator:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .storybook-container {
        background: white;
        border: 2px solid black;
    }
    
    .story-header {
        background: #f0f0f0;
        border-bottom: 3px solid black;
    }
    
    .story-title, .scene-title {
        color: black;
    }
}