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

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #FFE5B4 0%, #FFCCCB 50%, #E6E6FA 100%);
    min-height: 100vh;
    color: #2C3E50;
    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;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

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

/* Main Story Area */
.story-main {
    flex: 1;
    margin-bottom: 30px;
}

/* Story Segments */
.story-segment {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid #F39C12;
    animation: fadeIn 0.5s ease-in-out;
}

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

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

.story-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

/* Story Images */
.story-image {
    text-align: center;
}

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

.story-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

/* Story Text */
.story-text h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: #E74C3C;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

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

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

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: 'Comic Neue', cursive;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.prev-btn {
    background: linear-gradient(135deg, #3498DB, #2980B9);
    color: white;
}

.next-btn {
    background: linear-gradient(135deg, #27AE60, #229954);
    color: white;
}

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

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

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

.page-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2C3E50;
}

.current-page {
    background: #E74C3C;
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    min-width: 40px;
    text-align: center;
}

/* Audio Controls */
.audio-controls {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.audio-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 20px;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.play-btn {
    background: linear-gradient(135deg, #9B59B6, #8E44AD);
    color: white;
}

.auto-play-btn {
    background: linear-gradient(135deg, #F39C12, #E67E22);
    color: white;
}

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

.audio-btn.playing {
    background: linear-gradient(135deg, #E74C3C, #C0392B);
}

.audio-btn.auto-on {
    background: linear-gradient(135deg, #27AE60, #229954);
}

.audio-progress {
    flex: 1;
    height: 8px;
    background: #ECF0F1;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #3498DB, #2980B9);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Footer */
.story-footer {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.footer-text {
    font-size: 1.1rem;
    color: #2C3E50;
    margin-bottom: 5px;
}

.footer-subtitle {
    font-size: 0.9rem;
    color: #7F8C8D;
}

/* Responsive Design */
@media (max-width: 768px) {
    .storybook-container {
        padding: 15px;
    }
    
    .story-title {
        font-size: 2.2rem;
    }
    
    .story-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .story-text h2 {
        font-size: 1.6rem;
        text-align: center;
    }
    
    .story-text p {
        font-size: 1rem;
    }
    
    .story-navigation {
        padding: 15px 20px;
    }
    
    .nav-btn {
        padding: 10px 16px;
        font-size: 1rem;
    }
    
    .nav-text {
        display: none;
    }
    
    .audio-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .audio-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .story-title {
        font-size: 1.8rem;
    }
    
    .story-subtitle {
        font-size: 1rem;
    }
    
    .story-segment {
        padding: 20px;
    }
    
    .story-text h2 {
        font-size: 1.4rem;
    }
    
    .story-text p {
        font-size: 0.95rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .story-navigation,
    .audio-controls {
        display: none;
    }
    
    .story-segment {
        display: block !important;
        page-break-after: always;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .story-segment: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,
.audio-btn:focus {
    outline: 3px solid #3498DB;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .story-segment {
        border: 3px solid #000;
    }
    
    .nav-btn,
    .audio-btn {
        border: 2px solid #000;
    }
}