/* ====================================
   BIMCELB - Advanced Animation System
   ==================================== */

/* Root Variables */
:root {
    --primary-blue: #1e40af;
    --primary-light: #3b82f6;
    --primary-green: #10b981;
    --primary-accent: #f59e0b;
    --primary-red: #dc2626;
    --gradient-primary: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --gradient-hero: linear-gradient(135deg, #0c235e 0%, #1e40af 50%, #3b82f6 100%);
    --shadow-smooth: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 60px rgba(30, 64, 175, 0.2);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 10px;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}

/* Loading Screen - Premium Design */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    padding: 0.75rem;
    overflow: hidden;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.1);
    pointer-events: none;
}

/* Loading Container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    position: relative;
    z-index: 10;
    width: 85%;
    max-width: 240px;
}

/* Logo Animation Container */
.loading-logo {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    animation: logoFloat 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;
}

.loading-logo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmerSweep 2s infinite;
}

.loading-logo::after {
    content: '';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    filter: blur(6px);
    animation: shadowPulse 3s ease-in-out infinite;
}

.loading-logo img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    z-index: 1;
    animation: logoFlip3D 3s ease-in-out infinite;
    transform-style: preserve-3d;
    backface-visibility: visible;
}

/* Loading Text */
.loading-text {
    color: white;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    animation: textPulse 2s ease-in-out infinite;
    text-align: center;
}

/* Progress Bar Container */
.loading-progress {
    width: 100%;
    max-width: 140px;
    height: 2.5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Tablet & Desktop */
@media (min-width: 640px) {
    .loading-screen {
        padding: 1rem;
    }
    
    .loading-container {
        gap: 1.25rem;
        max-width: 300px;
        padding: 1.25rem;
    }
    
    .loading-logo {
        width: 70px;
        height: 70px;
        border-radius: 14px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .loading-logo::after {
        bottom: -23px;
        width: 55px;
        height: 11px;
        filter: blur(9px);
    }
    
    .loading-logo img {
        width: 40px;
        height: 40px;
    }
    
    .loading-text {
        font-size: 0.9375rem;
    }
    
    .loading-progress {
        max-width: 180px;
        height: 3.5px;
    }
}

@media (min-width: 768px) {
    .loading-container {
        gap: 1.75rem;
        max-width: 350px;
        padding: 1.5rem;
    }
    
    .loading-logo {
        width: 90px;
        height: 90px;
        border-radius: 18px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    }
    
    .loading-logo::after {
        bottom: -28px;
        width: 70px;
        height: 14px;
        filter: blur(11px);
    }
    
    .loading-logo img {
        width: 50px;
        height: 50px;
    }
    
    .loading-text {
        font-size: 1.0625rem;
    }
    
    .loading-progress {
        max-width: 220px;
        height: 4.5px;
    }
}

/* Large Desktop */
@media (min-width: 1024px) {
    .loading-container {
        gap: 2rem;
        max-width: 380px;
        padding: 1.75rem;
    }
    
    .loading-logo {
        width: 100px;
        height: 100px;
        border-radius: 20px;
    }
    
    .loading-logo::after {
        bottom: -30px;
        width: 78px;
        height: 15px;
        filter: blur(12px);
    }
    
    .loading-logo img {
        width: 55px;
        height: 55px;
    }
    
    .loading-text {
        font-size: 1.125rem;
    }
    
    .loading-progress {
        max-width: 240px;
        height: 5px;
    }
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 10px;
    animation: progressGrow 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Particles Background */
.loading-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    top: 0;
    left: 0;
}

.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.6;
    animation: particleFloat 15s linear infinite;
}

/* Mobile: 6 particles */
.particle:nth-child(1) { width: 3px; height: 3px; left: 15%; animation-delay: 0s; }
.particle:nth-child(2) { width: 4px; height: 4px; left: 30%; animation-delay: 2s; }
.particle:nth-child(3) { width: 3px; height: 3px; left: 50%; animation-delay: 4s; }
.particle:nth-child(4) { width: 4px; height: 4px; left: 70%; animation-delay: 1s; }
.particle:nth-child(5) { width: 3px; height: 3px; left: 85%; animation-delay: 3s; }
.particle:nth-child(6) { width: 4px; height: 4px; left: 40%; animation-delay: 5s; }
.particle:nth-child(7),
.particle:nth-child(8),
.particle:nth-child(9),
.particle:nth-child(10) { display: none; }

/* Tablet & Desktop: All 10 particles */
@media (min-width: 640px) {
    .particle:nth-child(1) { width: 4px; height: 4px; left: 10%; }
    .particle:nth-child(2) { width: 6px; height: 6px; left: 20%; }
    .particle:nth-child(3) { width: 3px; height: 3px; left: 30%; }
    .particle:nth-child(4) { width: 5px; height: 5px; left: 40%; }
    .particle:nth-child(5) { width: 4px; height: 4px; left: 50%; }
    .particle:nth-child(6) { width: 6px; height: 6px; left: 60%; }
    .particle:nth-child(7) { display: block; width: 3px; height: 3px; left: 70%; animation-delay: 2.5s; }
    .particle:nth-child(8) { display: block; width: 5px; height: 5px; left: 80%; animation-delay: 4.5s; }
    .particle:nth-child(9) { display: block; width: 4px; height: 4px; left: 90%; animation-delay: 1.5s; }
    .particle:nth-child(10) { display: block; width: 5px; height: 5px; left: 15%; animation-delay: 3.5s; }
}

/* Keyframe Animations */
@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

@keyframes logoFlip3D {
    0% { 
        transform: rotateY(0deg) rotateX(0deg) scale(1);
        filter: brightness(1);
    }
    25% { 
        transform: rotateY(180deg) rotateX(10deg) scale(1.15);
        filter: brightness(1.2);
    }
    50% { 
        transform: rotateY(360deg) rotateX(0deg) scale(1);
        filter: brightness(1);
    }
    75% { 
        transform: rotateY(540deg) rotateX(-10deg) scale(1.15);
        filter: brightness(1.2);
    }
    100% { 
        transform: rotateY(720deg) rotateX(0deg) scale(1);
        filter: brightness(1);
    }
}

@keyframes shadowPulse {
    0%, 100% { 
        transform: translateX(-50%) scale(1);
        opacity: 0.3;
    }
    50% { 
        transform: translateX(-50%) scale(1.3);
        opacity: 0.5;
    }
}

@keyframes shimmerSweep {
    0% { transform: translateX(-100%) translateY(-100%); }
    100% { transform: translateX(100%) translateY(100%); }
}

@keyframes textPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes progressGrow {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

@keyframes particleFloat {
    0% { 
        transform: translateY(100vh) translateX(0); 
        opacity: 0;
    }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { 
        transform: translateY(-100vh) translateX(100px); 
        opacity: 0;
    }
}

/* Old simple loader for fallback */
.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Navbar Scroll Effect */
.navbar-scrolled {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.navbar-scrolled .flex {
    height: 4rem !important; /* 64px instead of 80px */
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-scrolled img {
    height: 2rem !important; /* 32px instead of 40px */
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-scrolled .font-bold.text-2xl {
    font-size: 1.25rem !important; /* xl instead of 2xl */
    transition: font-size 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth sticky element positioning */
.sticky {
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Pulse Animation */
@keyframes pulse-scale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse-animation {
    animation: pulse-scale 2s ease-in-out infinite;
}

/* Gradient Animation */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient {
    background: linear-gradient(270deg, #1e40af, #3b82f6, #10b981, #f59e0b);
    background-size: 800% 800%;
    animation: gradient-shift 15s ease infinite;
}

/* Slide In Animations */
.slide-in-left {
    opacity: 0;
    transform: translateX(-100px);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(100px);
}

.slide-in-up {
    opacity: 0;
    transform: translateY(100px);
}

.slide-in-down {
    opacity: 0;
    transform: translateY(-100px);
}

/* Scale Fade In */
.scale-fade-in {
    opacity: 0;
    transform: scale(0.8);
}

/* Rotate In */
.rotate-in {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
}

/* Hover Effects */
.hover-lift {
    transition: var(--transition-smooth);
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.hover-grow {
    transition: var(--transition-smooth);
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: var(--transition-smooth);
    position: relative;
}

.hover-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: -1;
    filter: blur(10px);
}

.hover-glow:hover::before {
    opacity: 0.7;
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:hover::after {
    width: 300px;
    height: 300px;
}

/* Card Flip Animation */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* Parallax Layers */
.parallax-layer {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Magnetic Hover Effect */
.magnetic {
    transition: var(--transition-smooth);
}

/* Text Reveal Animation */
.text-reveal {
    overflow: hidden;
    display: inline-block;
}

.text-reveal span {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Counter Animation */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Typewriter Effect */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: currentColor;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

/* Stagger Animation Delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Mobile Optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Particle Background */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    animation: particle-float 20s infinite ease-in-out;
}

@keyframes particle-float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translate(100px, -1000px) scale(0);
        opacity: 0;
    }
}

/* Blob Animation */
@keyframes blob-morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

.blob {
    animation: blob-morph 8s ease-in-out infinite;
}

/* Wave Animation */
@keyframes wave {
    0% {
        transform: translateX(0) translateZ(0) scaleY(1);
    }
    50% {
        transform: translateX(-25%) translateZ(0) scaleY(0.55);
    }
    100% {
        transform: translateX(-50%) translateZ(0) scaleY(1);
    }
}

.wave {
    animation: wave 10s linear infinite;
}

/* Glitch Effect */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.glitch:hover {
    animation: glitch 0.3s ease-in-out;
}

/* Neon Glow */
.neon-glow {
    text-shadow: 
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 30px currentColor,
        0 0 40px currentColor;
    animation: neon-flicker 3s ease-in-out infinite;
}

@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Bounce In */
@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
