/* ═══════════════════════════════════════════════════════
   SHOPIFY DZ — Animations & Transitions
   ═══════════════════════════════════════════════════════ */

/* ══════ ULTRA-FUTURISTIC PRELOADER ══════ */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    overflow: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

/* Background grid */
.pl-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.pl-grid {
    position: absolute;
    inset: -50%;
    background-image:
        linear-gradient(rgba(var(--accent-primary-rgb), 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--accent-primary-rgb), 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: plGridDrift 20s linear infinite;
    transform: perspective(500px) rotateX(60deg);
    transform-origin: center center;
}
@keyframes plGridDrift {
    0% { background-position: 0 0; }
    100% { background-position: 60px 60px; }
}

/* Floating particles */
.pl-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-primary);
    opacity: 0;
    animation: plParticle 4s ease-in-out infinite;
}
.pl-particle.p1 { left: 15%; top: 20%; animation-delay: 0s; }
.pl-particle.p2 { left: 80%; top: 30%; animation-delay: 0.6s; width: 3px; height: 3px; background: var(--accent-cyan); }
.pl-particle.p3 { left: 25%; top: 75%; animation-delay: 1.2s; width: 5px; height: 5px; }
.pl-particle.p4 { left: 70%; top: 80%; animation-delay: 1.8s; width: 3px; height: 3px; background: var(--accent-emerald); }
.pl-particle.p5 { left: 50%; top: 10%; animation-delay: 2.4s; background: var(--accent-cyan); }
.pl-particle.p6 { left: 90%; top: 55%; animation-delay: 3s; width: 6px; height: 6px; }
@keyframes plParticle {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0); }
    20% { opacity: 0.8; transform: translateY(-20px) scale(1); }
    80% { opacity: 0.3; transform: translateY(-60px) scale(0.5); }
}

/* Central glow */
.pl-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(var(--accent-primary-rgb), 0.12) 0%, transparent 70%);
    animation: plGlowPulse 3s ease-in-out infinite;
}
@keyframes plGlowPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

/* Inner container */
.preloader-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

/* Orbital system */
.pl-orbital {
    position: relative;
    width: 160px;
    height: 160px;
}

.pl-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%);
    background: var(--gradient-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: 0 0 40px rgba(var(--accent-primary-rgb), 0.4), 0 0 80px rgba(var(--accent-primary-rgb), 0.15);
    animation: plCorePulse 2s ease-in-out infinite;
}
@keyframes plCorePulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 40px rgba(var(--accent-primary-rgb), 0.4), 0 0 80px rgba(var(--accent-primary-rgb), 0.15); }
    50% { transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 0 60px rgba(var(--accent-primary-rgb), 0.5), 0 0 120px rgba(var(--accent-primary-rgb), 0.2); }
}

/* Orbital rings */
.pl-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1.5px solid transparent;
    border-radius: 50%;
}
.pl-ring.r1 {
    width: 100px;
    height: 100px;
    margin: -50px 0 0 -50px;
    border-top-color: var(--accent-primary);
    border-right-color: rgba(var(--accent-primary-rgb), 0.2);
    animation: plRingSpin 2s linear infinite;
}
.pl-ring.r2 {
    width: 130px;
    height: 130px;
    margin: -65px 0 0 -65px;
    border-top-color: var(--accent-cyan);
    border-left-color: rgba(var(--accent-cyan-rgb), 0.15);
    animation: plRingSpin 3s linear infinite reverse;
}
.pl-ring.r3 {
    width: 160px;
    height: 160px;
    margin: -80px 0 0 -80px;
    border-top-color: rgba(var(--accent-primary-rgb), 0.3);
    border-bottom-color: rgba(var(--accent-cyan-rgb), 0.1);
    animation: plRingSpin 4.5s linear infinite;
}
@keyframes plRingSpin {
    to { transform: rotate(360deg); }
}

/* Orbiting dots */
.pl-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
}
.pl-dot.d1 {
    background: var(--accent-primary);
    box-shadow: 0 0 12px var(--accent-primary);
    animation: plDotOrbit1 2s linear infinite;
}
.pl-dot.d2 {
    background: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-cyan);
    width: 6px;
    height: 6px;
    animation: plDotOrbit2 3s linear infinite;
}
.pl-dot.d3 {
    background: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
    width: 5px;
    height: 5px;
    animation: plDotOrbit3 4.5s linear infinite;
}
@keyframes plDotOrbit1 {
    0% { transform: rotate(0deg) translateX(50px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(50px) rotate(-360deg); }
}
@keyframes plDotOrbit2 {
    0% { transform: rotate(0deg) translateX(65px) rotate(0deg); }
    100% { transform: rotate(-360deg) translateX(65px) rotate(360deg); }
}
@keyframes plDotOrbit3 {
    0% { transform: rotate(0deg) translateX(80px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}

/* Brand text */
.pl-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pl-logo {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #f0f0ff 0%, var(--accent-primary) 50%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    animation: plLogoShine 3s ease-in-out infinite;
}
.pl-logo::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-primary) 50%, #f0f0ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    animation: plLogoGlitch 3s ease-in-out infinite;
}
@keyframes plLogoShine {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}
@keyframes plLogoGlitch {
    0%, 42%, 44%, 100% { opacity: 0; transform: none; }
    43% { opacity: 0.8; transform: translateX(2px) skewX(-2deg); }
}

.pl-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 12px;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: 6px;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.3);
    animation: plBadgePulse 2s ease-in-out infinite;
}
@keyframes plBadgePulse {
    0%, 100% { box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.3); }
    50% { box-shadow: 0 0 30px rgba(var(--accent-primary-rgb), 0.5); }
}

/* Progress bar */
.pl-progress-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 280px;
}
.pl-progress-track {
    flex: 1;
    height: 4px;
    background: rgba(var(--accent-primary-rgb), 0.08);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.pl-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
    border-radius: 4px;
    transition: width 0.3s ease;
}
.pl-progress-glow {
    position: absolute;
    top: -3px;
    right: 0;
    width: 30px;
    height: 10px;
    background: radial-gradient(circle, rgba(var(--accent-primary-rgb), 0.6) 0%, transparent 70%);
    filter: blur(3px);
    animation: plProgressGlow 1.5s ease-in-out infinite;
}
@keyframes plProgressGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.pl-progress-pct {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    min-width: 36px;
    text-align: right;
}

/* Status text */
.pl-status {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    animation: plStatusBlink 1.5s ease-in-out infinite;
}
@keyframes plStatusBlink {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ═══ LIGHT THEME preloader ═══ */
[data-theme="light"] .pl-logo {
    background: linear-gradient(135deg, #1a1a2e 0%, var(--accent-primary) 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    background-clip: text;
}
[data-theme="light"] .pl-logo::after {
    background: linear-gradient(135deg, #06b6d4 0%, var(--accent-primary) 50%, #1a1a2e 100%);
    -webkit-background-clip: text;
    background-clip: text;
}
[data-theme="light"] .pl-grid {
    background-image:
        linear-gradient(rgba(var(--accent-primary-rgb), 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--accent-primary-rgb), 0.06) 1px, transparent 1px);
}
[data-theme="light"] .pl-glow {
    background: radial-gradient(circle, rgba(var(--accent-primary-rgb), 0.08) 0%, transparent 70%);
}
[data-theme="light"] .pl-progress-track {
    background: rgba(0, 0, 0, 0.06);
}

/* ═══ RESPONSIVE preloader ═══ */
@media (max-width: 640px) {
    .pl-orbital { width: 120px; height: 120px; }
    .pl-core { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 12px; }
    .pl-ring.r1 { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
    .pl-ring.r2 { width: 98px; height: 98px; margin: -49px 0 0 -49px; }
    .pl-ring.r3 { width: 120px; height: 120px; margin: -60px 0 0 -60px; }
    @keyframes plDotOrbit1 { 0% { transform: rotate(0deg) translateX(38px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(38px) rotate(-360deg); } }
    @keyframes plDotOrbit2 { 0% { transform: rotate(0deg) translateX(49px) rotate(0deg); } 100% { transform: rotate(-360deg) translateX(49px) rotate(360deg); } }
    @keyframes plDotOrbit3 { 0% { transform: rotate(0deg) translateX(60px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(60px) rotate(-360deg); } }
    .pl-logo { font-size: 1.5rem; letter-spacing: 1px; }
    .pl-badge { font-size: 0.65rem; padding: 3px 8px; }
    .pl-progress-wrap { width: 220px; }
    .pl-glow { width: 280px; height: 280px; }
    .preloader-inner { gap: 24px; }
}
@media (max-width: 380px) {
    .pl-orbital { width: 100px; height: 100px; }
    .pl-core { width: 36px; height: 36px; font-size: 0.95rem; }
    .pl-ring.r1 { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
    .pl-ring.r2 { width: 82px; height: 82px; margin: -41px 0 0 -41px; }
    .pl-ring.r3 { width: 100px; height: 100px; margin: -50px 0 0 -50px; }
    .pl-logo { font-size: 1.25rem; }
    .pl-progress-wrap { width: 180px; }
    .pl-status { font-size: 0.7rem; }
}

/* ══════ ORB FLOAT ══════ */
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ══════ PAGE TRANSITIONS ══════ */
.page-enter {
    animation: pageEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.page-exit {
    animation: pageExit 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageEnter {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes pageExit {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-8px); }
}

/* ══════ CARD ANIMATIONS ══════ */
.card-enter {
    animation: cardEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

@keyframes cardEnter {
    0% { opacity: 0; transform: translateY(20px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Staggered children */
.stagger-children > * {
    opacity: 0;
    animation: cardEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }

/* ══════ HOVER EFFECTS ══════ */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-neon);
}

/* ══════ SHIMMER / LOADING ══════ */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.04) 50%,
        transparent 100%
    );
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ══════ PULSE ANIMATIONS ══════ */
.pulse-slow {
    animation: pulseSlow 3s ease-in-out infinite;
}

@keyframes pulseSlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.pulse-ring {
    position: relative;
}

.pulse-ring::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 2px solid var(--accent-primary);
    opacity: 0;
    animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.15); }
}

/* ══════ COUNTER ANIMATION ══════ */
.count-up {
    display: inline-block;
}

/* ══════ TYPING INDICATOR ══════ */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ══════ NEON LINE ANIMATION ══════ */
.neon-line {
    position: relative;
    overflow: hidden;
}

.neon-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    animation: neonSweep 3s ease-in-out infinite;
}

@keyframes neonSweep {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* ══════ FLOAT ANIMATION ══════ */
.float {
    animation: float 6s ease-in-out infinite;
}

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

/* ══════ GLOW EFFECT ══════ */
.glow-effect {
    position: relative;
}

.glow-effect::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.5), transparent, rgba(var(--accent-cyan-rgb), 0.5));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.glow-effect:hover::before {
    opacity: 1;
}

/* ══════ SCANNER LINE ══════ */
.scanner-line {
    position: relative;
    overflow: hidden;
}

.scanner-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    animation: scannerLine 3s ease-in-out infinite;
    opacity: 0.5;
}

@keyframes scannerLine {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}

/* ══════ MATRIX RAIN (decorative) ══════ */
.matrix-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.03;
}

/* ══════ NOTIFICATION SLIDE ══════ */
.notif-slide-in {
    animation: notifSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes notifSlide {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ══════ NUMBER TICK ══════ */
.number-tick {
    display: inline-block;
    animation: numberTick 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes numberTick {
    0% { transform: translateY(-10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ══════ SMOOTH SCROLL REVEAL ══════ */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ══════ LIGHT THEME ══════ */
[data-theme="light"] .shimmer::after {
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.03) 50%, transparent 100%);
}
