/* ============================================================
   DESIGN SYSTEM & GLOBAL BASE - CASTELLO (PAN AFRICA)
   Autumn Harvest & Dark Luxury Gold Palette
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,700&family=Lato:wght@300;400;700;900&display=swap');

:root {
  /* Color Palette - Autumn Harvest Luxury */
  --color-crimson: #6F1D1B;
  --color-crimson-light: #8E2522;
  --color-crimson-glow: rgba(111, 29, 27, 0.45);
  
  --color-gold: #BB9457;
  --color-gold-bright: #E2B764;
  --color-gold-light: #FFE6A7;
  --color-gold-glow: rgba(187, 148, 87, 0.35);
  
  --color-dark-brown: #432818;
  --color-amber: #99582A;
  --color-cream: #FFE6A7;
  
  /* Background & Surfaces */
  --color-bg: #140b08;
  --color-bg-alt: #1a0e0a;
  --color-surface: #22120d;
  --color-surface-hover: #2d1811;
  --color-surface-card: rgba(36, 19, 14, 0.82);
  --color-border: #432818;
  --color-border-gold: rgba(187, 148, 87, 0.28);
  
  /* Typography */
  --color-text: #FFE6A7;
  --color-text-muted: #BB9457;
  --color-text-dim: #a67c52;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Glassmorphism & Elevations */
  --glass-bg: rgba(26, 14, 10, 0.78);
  --glass-border: rgba(187, 148, 87, 0.22);
  --glass-blur: blur(14px) saturate(180%);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 20px rgba(187, 148, 87, 0.12);
  --shadow-gold: 0 0 24px rgba(187, 148, 87, 0.3);
  
  /* Geometry & Motion */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  --transition-fast: 0.15s ease;
  --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Z-Indices */
  --z-base: 1;
  --z-navbar: 100;
  --z-sidebar: 150;
  --z-bottom-bar: 180;
  --z-overlay: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-pwa-banner: 500;
  --z-cursor: 9999;
  
  /* Mobile Safe Areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   RESETS & GLOBAL SETUP
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--color-bg);
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  touch-action: manipulation;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--color-dark-brown);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-bg);
}

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

/* Accessible focus styling */
:focus-visible {
  outline: 2px solid var(--color-gold-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-gold-light);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: clamp(1.4rem, 3vw, 2rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.4rem); }

p { margin-bottom: 1rem; }

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-gold-light);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: all var(--transition);
  touch-action: manipulation;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Skip link for screen readers */
.skip-link {
  position: absolute;
  top: -60px;
  left: 1rem;
  background: var(--color-gold);
  color: var(--color-bg);
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  z-index: 10000;
  border-radius: var(--radius-sm);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* ============================================================
   BUTTONS & ACTIONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem 2.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-crimson) 0%, #521514 100%);
  color: var(--color-cream);
  border: 1px solid rgba(255, 230, 167, 0.25);
  box-shadow: 0 4px 16px var(--color-crimson-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-crimson-light) 0%, var(--color-crimson) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(111, 29, 27, 0.5), 0 0 12px rgba(187, 148, 87, 0.2);
  color: #FFFFFF;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background: rgba(26, 14, 10, 0.6);
  color: var(--color-gold-light);
  border: 1.5px solid var(--color-gold);
  backdrop-filter: var(--glass-blur);
}

.btn-outline:hover {
  background: var(--color-gold);
  color: #140b08;
  border-color: var(--color-gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(187, 148, 87, 0.35);
}

.btn-outline:active {
  transform: translateY(0);
}

/* ============================================================
   SECTIONS & REVEALS
   ============================================================ */

.section {
  padding: 5.5rem 0;
  position: relative;
}

.section-title {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
  font-size: clamp(2rem, 4vw, 3rem);
  background: linear-gradient(135deg, #FFE6A7 0%, #BB9457 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-title::after {
  content: '';
  display: block;
  width: 90px;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  margin: 0.8rem auto 0;
  border-radius: var(--radius-pill);
}

/* Page transitions */
body {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

body.page-exit {
  opacity: 0;
  transform: translateY(-8px);
}

body.page-enter {
  opacity: 0;
  transform: translateY(8px);
}

/* Scroll reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.reveal-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* Ripple animation on tap */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 230, 167, 0.4) 0%, rgba(187, 148, 87, 0) 70%);
  transform: scale(0);
  animation: rippleEffect 0.55s ease-out;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(2.8);
    opacity: 0;
  }
}

/* Cursor glow (Desktop) */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(187, 148, 87, 0.32) 0%, rgba(187, 148, 87, 0) 70%);
  pointer-events: none;
  z-index: var(--z-cursor);
  mix-blend-mode: screen;
  will-change: transform;
}

@media (max-width: 1024px), (hover: none) {
  .cursor-glow {
    display: none !important;
  }
}

/* ============================================================
   FLYING CART ITEM & BADGE BOUNCE
   ============================================================ */

.flying-cart-dot {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-bounce-anim {
  animation: badgeBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes badgeBounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.38); }
  100% { transform: scale(1); }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: var(--z-toast);
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(34, 18, 13, 0.94);
  border: 1px solid var(--color-border-gold);
  color: var(--color-cream);
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(40px) scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  font-size: 0.92rem;
  font-weight: 600;
}

.toast-item.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--color-gold);
  color: #140b08;
  font-weight: bold;
}

.toast-success .toast-icon { background: #4caf50; color: #fff; }
.toast-error .toast-icon { background: var(--color-crimson-light); color: #fff; }
.toast-warning .toast-icon { background: #f59e0b; color: #140b08; }

/* ============================================================
   NETWORK STATUS PILL (ONLINE/OFFLINE)
   ============================================================ */

.network-status-pill {
  position: fixed;
  bottom: calc(1.5rem + var(--safe-bottom));
  left: 1.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  z-index: var(--z-toast);
  box-shadow: var(--shadow-md);
  backdrop-filter: var(--glass-blur);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.network-status-pill.show {
  opacity: 1;
  transform: translateY(0);
}

.network-status-pill.online {
  background: rgba(34, 197, 94, 0.92);
  color: #FFFFFF;
}

.network-status-pill.offline {
  background: rgba(239, 68, 68, 0.92);
  color: #FFFFFF;
}

/* ============================================================
   PWA INSTALL BANNER
   ============================================================ */

.pwa-install-banner {
  position: fixed;
  bottom: calc(1rem + var(--safe-bottom));
  left: 1rem;
  right: 1rem;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(34, 18, 13, 0.96);
  border: 1.5px solid var(--color-gold);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.2rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 24px rgba(187, 148, 87, 0.25);
  backdrop-filter: var(--glass-blur);
  z-index: var(--z-pwa-banner);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  transition: opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pwa-install-banner.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.pwa-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
}

.pwa-banner-text strong {
  font-size: 0.95rem;
  color: var(--color-gold-light);
  font-family: var(--font-display);
}

.pwa-banner-text span {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-btn-install {
  background: linear-gradient(135deg, var(--color-crimson) 0%, #8E2522 100%);
  color: #fff;
  border: 1px solid var(--color-gold);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--color-crimson-glow);
}

.pwa-btn-install:hover {
  transform: scale(1.04);
}

.pwa-btn-close {
  color: var(--color-text-muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.pwa-btn-close:hover {
  color: #fff;
}

/* ============================================================
   RESPONSIVE BASE ADJUSTMENTS
   ============================================================ */

@media (max-width: 768px) {
  .section {
    padding: 3.5rem 0;
  }
  
  .btn {
    padding: 0.8rem 1.8rem;
    font-size: 0.88rem;
  }
  
  .toast-container {
    top: 1rem;
    left: 1rem;
    right: 1rem;
  }
}
