/* 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 */
.story-header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.subtitle {
    font-size: 1.2rem;
    color: #34495E;
    font-weight: bold;
}

/* Story Pages */
.story-main {
    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: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.story-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: 500px;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

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

/* Story Text */
.story-text {
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.story-text h2 {
    font-size: 1.8rem;
    color: #E74C3C;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

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

.the-end {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #9B59B6;
    margin-top: 20px;
}

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

.audio-btn {
    background: linear-gradient(45deg, #3498DB, #2980B9);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: inherit;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
}

.audio-btn:hover {
    background: linear-gradient(45deg, #2980B9, #3498DB);
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(52, 152, 219, 0.4);
}

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

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

.nav-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #2C3E50;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

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

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

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

/* Footer */
.story-footer {
    text-align: center;
    padding: 20px;
    background: linear-gradient(45deg, #F39C12, #E67E22);
    border-radius: 15px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.story-footer p {
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .storybook-container {
        margin: 10px;
        padding: 15px;
    }
    
    .story-header h1 {
        font-size: 2rem;
    }
    
    .story-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .story-text {
        padding: 15px;
    }
    
    .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) {
    .story-header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .story-text h2 {
        font-size: 1.3rem;
    }
    
    .story-text p {
        font-size: 0.9rem;
    }
}

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

/* 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: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Interactive Elements */
.story-illustration {
    cursor: pointer;
}

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

.audio-btn.playing::after {
    content: " 🔊";
}

/* Accessibility */
.nav-btn:focus,
.audio-btn:focus {
    outline: 3px solid #F39C12;
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition: all 0.3s ease;
}

/* Special effects for magical elements */
.story-header {
    position: relative;
    overflow: hidden;
}

.story-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}