/* NIL Cache - Nillion-Inspired Design */

:root {
    /* Nillion Blue Palette */
    --nillion-deep-blue: #1e3a8a;
    --nillion-royal-blue: #2563eb;
    --nillion-bright-blue: #3b82f6;
    --nillion-light-blue: #60a5fa;
    --nillion-periwinkle: #a5b4fc;
    --nillion-white: #ffffff;
    --nillion-navy: #172554;
    
    /* Gradients */
    --nillion-gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
    --nillion-gradient-secondary: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
    --nillion-gradient-cloud: linear-gradient(135deg, #3b82f6 0%, #60a5fa 30%, #a5b4fc 70%, rgba(255,255,255,0.3) 100%);
    
    /* Legacy Variables (mapped to new palette) */
    --primary-color: var(--nillion-bright-blue);
    --secondary-color: var(--nillion-royal-blue);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: var(--nillion-deep-blue);
    --darker-bg: var(--nillion-navy);
    --text-light: var(--nillion-white);
    --border-color: rgba(255, 255, 255, 0.2);
}

body {
    background: var(--nillion-gradient-primary);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-light);
    position: relative;
}

/* Add cloud-like overlay effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--nillion-gradient-cloud);
    opacity: 0.1;
    z-index: -1;
    pointer-events: none;
}

/* Navigation - Nillion Style */
.navbar {
    background: rgba(30, 58, 138, 0.9) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.3);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.navbar-dark .navbar-brand,
.navbar-dark .navbar-nav .nav-link {
    color: var(--nillion-white) !important;
    transition: all 0.3s ease;
}

.navbar-dark .navbar-brand:hover {
    color: var(--nillion-light-blue) !important;
}

/* Hero Section - Nillion Style */
.hero-section {
    padding: 4rem 0;
    position: relative;
}

.hero-section .display-1 {
    font-size: 6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--nillion-white) 0%, var(--nillion-light-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: float 3s ease-in-out infinite;
    text-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.hero-section .lead {
    color: var(--nillion-periwinkle);
    font-size: 1.3rem;
    font-weight: 400;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Cache Container - Nillion Style */
.cache-container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

/* 3D Physics Scene - Nillion Style */
#threejs-container {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgba(30, 58, 138, 0.4);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(30, 58, 138, 0.4), 
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

#threejs-container:hover {
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

#threejs-container canvas {
    border-radius: 13px;
}

#physics3D .btn {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#dropCrateBtn:hover {
    animation: none;
    transform: scale(1.1) !important;
}

/* Cache Animation */
.cache-wheel-container {
    position: relative;
    width: 600px;
    height: 150px;
    margin: 2rem auto;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgba(30, 58, 138, 0.4);
    backdrop-filter: blur(15px);
    /* Ensure container is always visible */
    min-height: 150px;
    display: flex;
    align-items: center;
    box-shadow: 0 20px 40px rgba(30, 58, 138, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    
    /* GPU acceleration for container */
    transform: translateZ(0);
    backface-visibility: hidden;
    
    /* Optimize animation performance */
    contain: layout style paint;
    isolation: isolate;
}

.cache-wheel {
    display: flex;
    height: 100%;
    will-change: transform;
    transition: none; /* Controlled via JavaScript */
    
    /* GPU acceleration for smooth scrolling */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    
    /* Prevent layout recalculations during animation */
    contain: layout style paint;
}

.cache-item {
    flex: 0 0 120px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 2px solid var(--border-color);
    padding: 1rem;
    font-weight: bold;
    
    /* Optimize rendering for smooth scrolling */
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    
    /* Prevent text rendering issues during animation */
    text-rendering: optimizeSpeed;
    font-smooth: never;
    -webkit-font-smoothing: subpixel-antialiased;
    
    /* Reduce layout complexity */
    contain: layout style;
}

.cache-item:last-child {
    border-right: none;
}

/* Cache items with Nillion blue gradients */
.cache-item.prize-20 { 
    background: linear-gradient(135deg, var(--nillion-periwinkle), var(--nillion-light-blue)); 
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.cache-item.prize-50 { 
    background: linear-gradient(135deg, var(--nillion-light-blue), var(--nillion-bright-blue)); 
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.cache-item.prize-100 { 
    background: linear-gradient(135deg, var(--nillion-bright-blue), var(--nillion-royal-blue)); 
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.cache-item.prize-500 { 
    background: linear-gradient(135deg, var(--nillion-royal-blue), var(--nillion-deep-blue)); 
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}
.cache-item.prize-1000 { 
    background: linear-gradient(135deg, var(--nillion-deep-blue), var(--nillion-navy)); 
    border: 2px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    animation: goldGlow 2s ease-in-out infinite alternate;
}

@keyframes goldGlow {
    0% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.5); }
    100% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}

.wheel-indicator {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid var(--nillion-white);
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Prize Reveal */
.prize-reveal {
    padding: 2rem;
}

.prize-amount {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700, #ffed4e, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
    animation: prizeGlow 2s ease-in-out infinite alternate;
}

@keyframes prizeGlow {
    0% { filter: brightness(1) drop-shadow(0 0 10px rgba(255, 215, 0, 0.3)); }
    100% { filter: brightness(1.2) drop-shadow(0 0 20px rgba(255, 215, 0, 0.6)); }
}

/* Success Animation */
.success-animation {
    animation: bounceIn 1s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateZ(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateZ(0);
    }
    70% {
        transform: scale(0.9) translateZ(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
}

/* Smooth scrolling performance optimizations */
.cache-wheel * {
    /* Force GPU rendering for all child elements during animation */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Disable conflicting transitions during wheel animation */
.cache-wheel.animating * {
    transition: none !important;
}

/* Ensure smooth animation without interference */
.cache-wheel.animating {
    animation-fill-mode: forwards !important;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.prize-display {
    margin: 1rem 0;
}

/* Cards - Nillion Geometric Style */
.card {
    background: rgba(30, 58, 138, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 40px rgba(30, 58, 138, 0.3), 
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Add geometric overlay to cards */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--nillion-gradient-secondary);
    opacity: 0.1;
    z-index: -1;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 30px 60px rgba(30, 58, 138, 0.4), 
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.card-header {
    background: var(--nillion-gradient-secondary);
    border: none;
    border-radius: 15px 15px 0 0 !important;
    backdrop-filter: blur(10px);
    color: var(--nillion-white);
}

.card-body {
    position: relative;
    z-index: 1;
    color: var(--nillion-white);
}

.bg-dark.card {
    background: rgba(30, 58, 138, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Buttons - Nillion Style */
.btn {
    border-radius: 25px;
    font-weight: 600;
    padding: 12px 30px;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-primary {
    background: var(--nillion-gradient-secondary);
    color: var(--nillion-white);
}

.btn-primary:hover {
    background: var(--nillion-gradient-primary);
    color: var(--nillion-white);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: var(--nillion-white);
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
}

/* Tables */
.table-dark {
    background-color: var(--dark-bg);
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(255,255,255,0.05);
}

/* Form Controls - Nillion Style */
.form-control {
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(30, 58, 138, 0.4);
    backdrop-filter: blur(10px);
    color: var(--nillion-white);
    padding: 12px 20px;
    transition: all 0.3s ease;
}

.form-control::placeholder {
    color: var(--nillion-periwinkle);
}

/* Specific styling for transparent form inputs */
.form-control[style*="rgba(30, 58, 138, 0.4)"]::placeholder {
    color: rgba(165, 180, 252, 0.7);
}

.form-control[style*="rgba(30, 58, 138, 0.4)"]:focus {
    background: rgba(30, 58, 138, 0.6) !important;
    border-color: var(--nillion-light-blue) !important;
    color: var(--nillion-white) !important;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.25) !important;
    outline: none !important;
}

.form-control:focus {
    background: rgba(30, 58, 138, 0.6);
    border-color: var(--nillion-light-blue);
    color: var(--nillion-white);
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.25);
    outline: none;
}

.form-label {
    color: var(--nillion-white);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Badges */
.badge {
    border-radius: 20px;
    padding: 0.5em 1em;
}

/* Alerts - Nillion Style */
.alert {
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(30, 58, 138, 0.3);
}

.alert-info {
    background: rgba(59, 130, 246, 0.8);
    color: var(--nillion-white);
    border-color: var(--nillion-light-blue);
}

.alert-success {
    background: rgba(16, 185, 129, 0.8);
    color: var(--nillion-white);
    border-color: var(--success-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.8);
    color: var(--nillion-white);
    border-color: var(--warning-color);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.8);
    color: var(--nillion-white);
    border-color: var(--danger-color);
}
}

.alert-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    color: white;
}

/* Footer */
footer {
    background: var(--darker-bg) !important;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .cache-wheel-container {
        width: 100%;
        max-width: 400px;
        height: 120px;
        min-height: 120px;
    }
    
    .cache-item {
        flex: 0 0 80px;
        font-size: 0.8rem;
    }
    
    .prize-amount {
        font-size: 2.5rem;
    }
    
    .hero-section .display-1 {
        font-size: 4rem;
    }
}

/* Loading States */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}
