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

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #FFE4B5 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;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    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: 2.5rem;
    color: #E74C3C;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* Main Story Area */
.story-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

/* Story Pages */
.story-page {
    display: none;
    width: 100%;
    max-width: 1000px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 3px solid #FFD700;
}

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

@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;
    padding: 30px;
    align-items: center;
}

/* Illustration */
.illustration-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

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

/* Story Text */
.story-text {
    padding: 20px;
}

.page-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #E74C3C;
    margin-bottom: 20px;
    text-align: center;
}

.text-content {
    margin-bottom: 25px;
}

.text-content p {
    margin-bottom: 15px;
    font-size: 1.1rem;
    padding: 10px;
    border-radius: 10px;
}

.narrator-text {
    background: linear-gradient(135deg, #F0F8FF, #E6F3FF);
    border-left: 4px solid #4169E1;
    font-style: italic;
}

.character-text {
    font-weight: 600;
    padding: 12px 15px;
    border-radius: 15px;
    margin: 10px 0;
    position: relative;
}

.character-text.rosie {
    background: linear-gradient(135deg, #FFE4E1, #FFF0F5);
    border-left: 4px solid #FF69B4;
    color: #C71585;
}

.character-text.mother-rabbit {
    background: linear-gradient(135deg, #F0FFF0, #F5FFFA);
    border-left: 4px solid #32CD32;
    color: #228B22;
}

.character-text.wolfgang {
    background: linear-gradient(135deg, #F5F5DC, #FFF8DC);
    border-left: 4px solid #8B4513;
    color: #654321;
}

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

.audio-btn {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

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

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

.audio-btn.playing {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3); }
    50% { box-shadow: 0 8px 25px rgba(78, 205, 196, 0.6); }
    100% { box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3); }
}

.audio-progress {
    width: 100%;
    height: 6px;
    background: #E0E0E0;
    border-radius: 3px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #FF6B6B, #4ECDC4);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

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

.nav-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.page-indicator {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2C3E50;
    background: linear-gradient(135deg, #FFE4B5, #FFEFD5);
    padding: 10px 20px;
    border-radius: 15px;
    border: 2px solid #DEB887;
}

.current-page {
    color: #E74C3C;
    font-weight: 700;
}

/* Global Audio Controls */
.global-audio-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.control-btn {
    background: linear-gradient(135deg, #A8E6CF, #7FCDCD);
    color: #2C3E50;
    border: none;
    padding: 10px 18px;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(168, 230, 207, 0.3);
}

.control-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(168, 230, 207, 0.4);
}

/* Footer */
.story-footer {
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 15px;
    color: #7B68EE;
    font-weight: 600;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .story-title {
        font-size: 2rem;
    }
    
    .page-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    
    .story-illustration {
        max-width: 300px;
    }
    
    .story-navigation {
        padding: 15px 20px;
    }
    
    .nav-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .global-audio-controls {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .storybook-container {
        padding: 10px;
    }
    
    .story-title {
        font-size: 1.5rem;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .text-content p {
        font-size: 1rem;
    }
    
    .story-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .page-indicator {
        order: -1;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #FF6B6B;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .story-navigation,
    .global-audio-controls,
    .audio-controls {
        display: none;
    }
    
    .story-page {
        display: block !important;
        page-break-after: always;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .story-page:last-child {
        page-break-after: avoid;
    }
}