/* =========================================================
   KNJIŽARA ZEUS V2 — CINEMATIC TRANSITIONS, AURORA & MOTION
   ========================================================= */

:root {
  --bg-primary: #f4f7fb;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.78);
  --text-primary: #0b1221;
  --text-secondary: #475569;
  --border-color: rgba(148, 163, 184, 0.22);
  --brand-blue: #0284c7;
  --brand-glow: rgba(2, 132, 199, 0.22);
  --card-shadow: 0 14px 36px -10px rgba(15, 23, 42, 0.08);
}

html.dark {
  --bg-primary: #040814;
  --bg-secondary: #0b1326;
  --bg-glass: rgba(11, 19, 38, 0.78);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: rgba(56, 189, 248, 0.16);
  --brand-blue: #38bdf8;
  --brand-glow: rgba(56, 189, 248, 0.25);
  --card-shadow: 0 20px 45px -12px rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  transition: background-color 0.45s cubic-bezier(0.22, 1, 0.36, 1), color 0.35s ease;
  overflow-x: hidden;
}

/* Ambient Background Mesh */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(56, 189, 248, 0.09), transparent 38%),
    radial-gradient(circle at 88% 72%, rgba(99, 102, 241, 0.08), transparent 42%),
    radial-gradient(circle at 50% 95%, rgba(244, 63, 94, 0.05), transparent 35%);
}

/* Cinematic Page Transition Curtain */
#page-curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(135deg, #0284c7 0%, #1e3a8a 55%, #0f172a 100%);
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.76, 0, 0.24, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

#page-curtain.cover {
  transform: translateY(0%);
}

#page-curtain.exit {
  transform: translateY(-100%);
}

/* Top Route Progress Bar */
#route-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #f43f5e);
  z-index: 10000;
  transition: width 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.9);
}

/* Glassmorphism Navigation & Cards */
.glass-nav {
  background: var(--bg-glass);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--border-color);
}

.glass-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
}

.glass-card:hover {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 24px 48px -12px var(--brand-glow);
}

/* View Switching Animations */
.page-view {
  display: none;
  opacity: 0;
}

.page-view.active {
  display: block;
  animation: viewEntrance 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes viewEntrance {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.985);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Scroll Reveal Elements */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Hero Floating 3D Animations */
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
}

@keyframes floatReverse {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(10px) rotate(-1.5deg); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}

.animate-float-slow {
  animation: floatSlow 5.5s ease-in-out infinite;
}

.animate-float-reverse {
  animation: floatReverse 4.8s ease-in-out infinite;
}

.animate-aurora {
  animation: pulseGlow 7s ease-in-out infinite;
}

/* Shimmer Button Effect */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}

.btn-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-22deg);
  transition: left 0.65s ease;
}

.btn-shimmer:hover::after {
  left: 140%;
}

/* Product Card Stagger & Hover Glow */
@keyframes cardPopIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.product-card-anim {
  animation: cardPopIn 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-style: preserve-3d;
}

/* Brand Marquee */
@keyframes marqueeScroll {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 36s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

/* Fly to Cart Animation */
@keyframes cartBounce {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.3) rotate(-8deg); }
  70% { transform: scale(0.92) rotate(5deg); }
}

.cart-bump {
  animation: cartBounce 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

.fly-dot {
  position: fixed;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: radial-gradient(circle, #38bdf8 0%, #0284c7 100%);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.95);
  pointer-events: none;
  z-index: 9998;
  transition: transform 0.68s cubic-bezier(0.2, 0.85, 0.3, 1), opacity 0.68s ease;
}

/* AI Typing Dots */
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0284c7;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-5px); opacity: 1; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.4); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(2, 132, 199, 0.7); }
