/* Flip Book Carousel Styles */
.flip-book-container {
    perspective: 1200px;
    perspective-origin: center center;
}

.flip-book-scene {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

.flip-book {
    position: relative;
    width: 320px;
    height: 400px;
    transform-style: preserve-3d;
    transition: transform 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: bookFloat 8s ease-in-out infinite;
}

.flip-page {
    position: absolute;
    width: 320px;
    height: 400px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transform-origin: center center;
}

.flip-page-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
}

.flip-page-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
    opacity: 1;
}

.flip-page-content img.loading {
    opacity: 0.7;
    transform: scale(0.95);
}

.flip-page-content img.loaded {
    opacity: 1;
    transform: scale(1);
}

.flip-page.transitioning {
    pointer-events: none;
}

.flip-page.transitioning .flip-page-content img {
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flip-page:hover .flip-page-content img {
    transform: scale(1.05);
}

.flip-page:hover {
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
    transform: scale(1.02);
}

/* Flip Page Positions - Stacked like a book */
.flip-page-1 {
    transform: translateZ(0px);
    z-index: 6;
}

.flip-page-2 {
    transform: translateZ(-2px);
    z-index: 5;
}

.flip-page-3 {
    transform: translateZ(-4px);
    z-index: 4;
}

.flip-page-4 {
    transform: translateZ(-6px);
    z-index: 3;
}

.flip-page-5 {
    transform: translateZ(-8px);
    z-index: 2;
}

.flip-page-6 {
    transform: translateZ(-10px);
    z-index: 1;
}

/* Active Page Glow */
.flip-page.active {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.6), 0 12px 40px rgba(0, 0, 0, 0.3);
    animation: pageGlow 1.5s ease-out;
    transform: scale(1.05) translateZ(5px);
}

/* Enhanced Visual Feedback */
.flip-nav.active {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
    animation: navPulse 0.6s ease-out;
}

@keyframes navPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.2); }
}

/* Flip Animation Effects */
.flip-page.flipping {
    transform: rotateY(-180deg) translateZ(0px);
    animation: pageFlip 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.flip-page.flipping-in {
    transform: rotateY(0deg) translateZ(0px);
    animation: pageFlipIn 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes pageFlip {
    0% {
        transform: rotateY(0deg) translateZ(0px);
        z-index: 6;
    }
    50% {
        transform: rotateY(-90deg) translateZ(0px);
        z-index: 6;
    }
    100% {
        transform: rotateY(-180deg) translateZ(-10px);
        z-index: 1;
    }
}

@keyframes pageFlipIn {
    0% {
        transform: rotateY(180deg) translateZ(-10px);
        z-index: 1;
    }
    50% {
        transform: rotateY(90deg) translateZ(0px);
        z-index: 6;
    }
    100% {
        transform: rotateY(0deg) translateZ(0px);
        z-index: 6;
    }
}

/* Particle Effects */
.flip-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.8), transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.3);
    }
}

.flip-page.active .flip-page-content .absolute {
    opacity: 1 !important;
}

/* Navigation Styles */
.flip-nav {
    transition: all 0.3s ease;
}

.flip-nav:hover {
    transform: scale(1.2);
}

.flip-nav.active {
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

#flip-autoplay:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.flip-prev:hover,
.flip-next:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes bookFloat {
    0%, 100% { 
        transform: translateY(0px) rotateX(0deg) rotateY(0deg); 
    }
    25% { 
        transform: translateY(-8px) rotateX(2deg) rotateY(2deg); 
    }
    50% { 
        transform: translateY(0px) rotateX(0deg) rotateY(4deg); 
    }
    75% { 
        transform: translateY(-4px) rotateX(-2deg) rotateY(2deg); 
    }
}

@keyframes pageGlow {
    0% { 
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    }
    50% { 
        box-shadow: 0 0 50px rgba(139, 92, 246, 0.8), 0 12px 40px rgba(0, 0, 0, 0.3);
    }
    100% { 
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    }
}

/* Glassmorphism Background Transitions */
#carousel-bg {
    transition: all 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#carousel-bg.gradient-1 {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.2);
}

#carousel-bg.gradient-2 {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
}

#carousel-bg.gradient-3 {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.2);
}

#carousel-bg.gradient-4 {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
}

#carousel-bg.gradient-5 {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 8px 32px rgba(234, 179, 8, 0.2);
}

#carousel-bg.gradient-6 {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.3);
    box-shadow: 0 8px 32px rgba(236, 72, 153, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .flip-book {
        width: 240px;
        height: 300px;
    }
    
    .flip-page {
        width: 240px;
        height: 300px;
    }
}

/* Loading Animation */
.flip-book-loading {
    animation: bookRotate 2s linear infinite;
}

@keyframes bookRotate {
    from { transform: rotateX(0deg) rotateY(0deg); }
    to { transform: rotateX(360deg) rotateY(360deg); }
}

/* Transition Effects */
.flip-book-transitioning {
    pointer-events: none;
}

.flip-book-transitioning .flip-page {
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Home Page Styles */

/* Level Card Styles */
.level-card {
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.level-card:hover {
    transform: translateY(-5px);
    border-color: #AA6436;
    box-shadow: 0 15px 30px rgba(170, 100, 54, 0.2);
}

.level-card-placeholder {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

.level-card-placeholder .bg-gray-200 {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Level Badge */
.level-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #AA6436, #8B4513);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(170, 100, 54, 0.3);
}

/* Level Image */
.level-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.level-card:hover .level-image {
    transform: scale(1.05);
}

/* Level Content */
.level-content {
    padding: 16px;
}

.level-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1.4;
}

.level-description {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.level-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #9ca3af;
}

.level-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

.level-difficulty {
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.difficulty-easy {
    background: #dcfce7;
    color: #166534;
}

.difficulty-medium {
    background: #fef3c7;
    color: #92400e;
}

.difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
}

/* Level Tab Buttons */
.level-tab-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.level-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.level-tab-btn:hover::before {
    left: 100%;
}

/* Loading States */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #AA6436;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error States */
.error-state {
    text-align: center;
    padding: 48px 24px;
}

.error-icon {
    font-size: 48px;
    color: #ef4444;
    margin-bottom: 16px;
}

.error-message {
    font-size: 18px;
    color: #374151;
    margin-bottom: 8px;
}

.error-submessage {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

/* Responsive Design */
@media (max-width: 640px) {
    .level-card {
        margin-bottom: 16px;
    }
    
    .level-image {
        height: 160px;
    }
    
    .level-title {
        font-size: 14px;
    }
    
    .level-description {
        font-size: 13px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Grid Layout */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .levels-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .levels-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

