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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #FFB6C1 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.2);
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Header */
.storybook-header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4, #45B7D1);
    border-radius: 15px;
    margin-bottom: 30px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.storybook-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

.story-page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

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

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

/* Story Image */
.story-image {
    position: relative;
    text-align: center;
    margin-bottom: 30px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.story-image img {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 15px;
    transition: transform 0.3s ease;
}

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

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 20px;
    text-align: center;
}

.image-overlay h3 {
    font-size: 1.3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Story Text */
.story-text {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #FF6B6B;
}

.story-text h2 {
    color: #2C3E50;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.story-text p {
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: justify;
    color: #34495E;
}

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

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

.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, #27AE60, #2ECC71);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* Navigation */
.story-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    background: linear-gradient(45deg, #3498DB, #2980B9);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

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

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

.page-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2C3E50;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 15px;
}

/* Footer */
.storybook-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    border-radius: 15px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.storybook-footer p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .storybook-container {
        margin: 10px;
        padding: 15px;
    }
    
    .storybook-header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .story-text {
        padding: 20px;
    }
    
    .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;
    }
}

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

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

/* 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,
.nav-btn:focus {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .storybook-container {
        border: 2px solid #000;
    }
    
    .story-text {
        border: 1px solid #000;
    }
}