/* 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%, #F0E68C 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 */
.storybook-header {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 3px solid #FFD700;
}

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

.subtitle {
    font-size: 1.2rem;
    color: #27AE60;
    font-weight: bold;
}

/* Main Story Area */
.story-main {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 3px solid #3498DB;
    margin-bottom: 20px;
}

/* Story Pages */
.story-page {
    display: none;
    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); }
}

.page-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 30px;
}

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

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

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

/* Text Content */
.text-container h2 {
    font-size: 2rem;
    color: #8E44AD;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.story-text {
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: justify;
    background: rgba(255, 248, 220, 0.8);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #F39C12;
}

.story-end {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    border-radius: 15px;
    border: 3px solid #FF6347;
}

.story-end h3 {
    font-size: 1.8rem;
    color: #8B4513;
    margin-bottom: 15px;
}

.moral {
    font-size: 1.1rem;
    color: #2C3E50;
    font-weight: bold;
    font-style: italic;
}

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

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

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

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

.audio-btn.playing {
    background: linear-gradient(45deg, #27AE60, #2ECC71);
    animation: pulse 1.5s 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;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #9B59B6;
    margin-bottom: 20px;
}

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

.nav-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #2980B9, #1F618D);
    transform: translateY(-2px);
}

.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;
    border: 2px solid #E67E22;
}

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

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

@media (max-width: 480px) {
    .storybook-container {
        padding: 10px;
    }
    
    .storybook-header {
        padding: 20px;
    }
    
    .story-main {
        padding: 20px;
    }
    
    .storybook-header h1 {
        font-size: 1.5rem;
    }
    
    .story-text {
        font-size: 0.9rem;
        padding: 10px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .story-navigation,
    .audio-controls,
    .storybook-footer {
        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,
.audio-btn:focus {
    outline: 3px solid #F39C12;
    outline-offset: 2px;
}