/* 3D Cube Carousel Styles */
.perspective-1200 {
    perspective: 1200px;
    perspective-origin: center center;
}

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

.cube {
    position: relative;
    width: 280px;
    height: 280px;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: cubeFloat 6s ease-in-out infinite;
}

.cube-transitioning {
    transition: transform 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: cubeScrollEffect 1.2s ease-out;
}

.cube-face {
    position: absolute;
    width: 280px;
    height: 280px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.cube-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cube-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;
}

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

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

.cube-face.transitioning {
    pointer-events: none;
}

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

.cube-face:hover .cube-content img {
    transform: scale(1.05);
}

.cube-face:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(245, 158, 11, 0.5);
}

/* Cube Face Positions */
.cube-front {
    transform: translateZ(140px);
    background: linear-gradient(135deg, #3b82f6, #06b6d4, #f59e0b);
}

.cube-back {
    transform: translateZ(-140px) rotateY(180deg);
    background: linear-gradient(135deg, #f59e0b, #06b6d4, #3b82f6);
}

.cube-right {
    transform: rotateY(90deg) translateZ(140px);
    background: linear-gradient(135deg, #f97316, #ef4444, #f59e0b);
}

.cube-left {
    transform: rotateY(-90deg) translateZ(140px);
    background: linear-gradient(135deg, #f59e0b, #f97316, #ef4444);
}

.cube-top {
    transform: rotateX(90deg) translateZ(140px);
    background: linear-gradient(135deg, #eab308, #f97316, #ef4444);
}

.cube-bottom {
    transform: rotateX(-90deg) translateZ(140px);
    background: linear-gradient(135deg, #a855f7, #ec4899, #ef4444);
}

/* Active Face Glow */
.cube-face.active {
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.6), 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(245, 158, 11, 0.8);
    animation: faceGlow 1.2s ease-out;
    transform: scale(1.05);
}

/* Enhanced Visual Feedback */
.cube-nav.active {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
    animation: navPulse 0.6s ease-out;
}

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

/* Particle Effects */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.8), transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 1.5s ease-out forwards;
}

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

.cube-face.active .cube-content .absolute {
    opacity: 1 !important;
}

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

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

.cube-nav.active {
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

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

/* Animations */
@keyframes cubeFloat {
    0%, 100% { 
        transform: translateY(0px) rotateX(0deg) rotateY(0deg); 
    }
    25% { 
        transform: translateY(-10px) rotateX(5deg) rotateY(5deg); 
    }
    50% { 
        transform: translateY(0px) rotateX(0deg) rotateY(10deg); 
    }
    75% { 
        transform: translateY(-5px) rotateX(-5deg) rotateY(5deg); 
    }
}

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

@keyframes cubeScrollEffect {
    0% { 
        transform: scale(1) rotateX(0deg) rotateY(0deg);
        filter: brightness(1);
    }
    20% { 
        transform: scale(1.15) rotateX(5deg) rotateY(5deg);
        filter: brightness(1.2);
    }
    50% { 
        transform: scale(1.1) rotateX(0deg) rotateY(0deg);
        filter: brightness(1.1);
    }
    80% { 
        transform: scale(1.05) rotateX(-2deg) rotateY(-2deg);
        filter: brightness(1.05);
    }
    100% { 
        transform: scale(1) rotateX(0deg) rotateY(0deg);
        filter: brightness(1);
    }
}

@keyframes faceGlow {
    0% { 
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    50% { 
        box-shadow: 0 0 40px rgba(245, 158, 11, 0.8), 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    100% { 
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cube {
        width: 200px;
        height: 200px;
    }
    
    .cube-face {
        width: 200px;
        height: 200px;
    }
    
    .cube-front { transform: translateZ(100px); }
    .cube-back { transform: translateZ(-100px) rotateY(180deg); }
    .cube-right { transform: rotateY(90deg) translateZ(100px); }
    .cube-left { transform: rotateY(-90deg) translateZ(100px); }
    .cube-top { transform: rotateX(90deg) translateZ(100px); }
    .cube-bottom { transform: rotateX(-90deg) translateZ(100px); }
}

/* Loading Animation */
.cube-loading {
    animation: cubeRotate 2s linear infinite;
}

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

.cube-transitioning .cube-face {
    transition: all 1.2s 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;
    }
}
