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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #a8e6cf 0%, #dcedc1 50%, #ffd3a5 100%);
    min-height: 100vh;
    color: #2c3e50;
    line-height: 1.6;
}

/* Container */
.storybook-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Header */
.story-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(45deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

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

/* Story Content */
.story-content {
    position: relative;
    min-height: 600px;
}

.story-segment {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

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

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

/* Story Image */
.story-image {
    text-align: center;
    margin-bottom: 25px;
}

.story-image img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

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

/* Story Text */
.story-text {
    margin-bottom: 25px;
}

.story-text h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #e74c3c;
    margin-bottom: 15px;
    text-align: center;
}

.story-text p {
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: justify;
    color: #2c3e50;
    line-height: 1.8;
}

.story-ending {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(45deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 15px;
    border: 3px solid #f39c12;
}

.story-ending p {
    text-align: center;
    font-weight: 700;
    font-size: 1.2rem;
}

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

.play-audio-btn {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-family: 'Nunito', sans-serif;
}

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

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Navigation */
.story-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(45deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    background: linear-gradient(45deg, #ff9a9e 0%, #fecfef 100%);
    color: #2c3e50;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    font-family: 'Nunito', sans-serif;
}

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

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.page-indicator {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

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

.auto-play-btn, .stop-auto-btn {
    background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-family: 'Nunito', sans-serif;
    margin: 0 10px;
}

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

.stop-auto-btn {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a24 100%);
}

/* Footer */
.story-footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(45deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 15px;
    color: #2c3e50;
}

.story-footer p {
    margin: 5px 0;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .storybook-container {
        margin: 10px;
        padding: 15px;
    }
    
    .story-title {
        font-size: 2rem;
    }
    
    .story-subtitle {
        font-size: 1rem;
    }
    
    .story-text h2 {
        font-size: 1.5rem;
    }
    
    .story-text p {
        font-size: 1rem;
        text-align: left;
    }
    
    .story-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .play-audio-btn, .auto-play-btn, .stop-auto-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .story-title {
        font-size: 1.8rem;
    }
    
    .story-text h2 {
        font-size: 1.3rem;
    }
    
    .story-text p {
        font-size: 0.95rem;
    }
    
    .play-audio-btn, .auto-play-btn, .stop-auto-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

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

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

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