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

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

.subtitle {
    font-size: 1.2rem;
    color: #2E8B57;
    font-weight: bold;
}

/* 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: 900px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid #FFD700;
    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: center;
}

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

.story-illustration {
    width: 100%;
    max-width: 400px;
    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.05);
}

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

.story-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2C3E50;
    text-align: justify;
    background: rgba(255, 248, 220, 0.8);
    padding: 20px;
    border-radius: 15px;
    border-left: 5px solid #FFD700;
}

/* Controls */
.controls {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    align-items: center;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    justify-content: center;
}

.audio-btn {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

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

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

/* Navigation Controls */
.navigation-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.nav-btn {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

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

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

.page-indicator {
    background: rgba(52, 152, 219, 0.1);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #2980B9;
    border: 2px solid #3498DB;
}

/* Auto Controls */
.auto-controls {
    display: flex;
    justify-content: center;
}

.auto-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: bold;
    color: #2C3E50;
}

.auto-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .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;
    }
    
    .controls {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }
    
    .navigation-controls {
        order: -1;
    }
}

@media (max-width: 480px) {
    .storybook-container {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .story-page {
        padding: 20px;
    }
    
    .story-illustration {
        max-width: 250px;
    }
    
    .audio-btn, .nav-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .controls {
        padding: 15px;
    }
}

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

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

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

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .controls,
    .footer {
        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;
    }
}