/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL.CSS - Shared Base Styles Across All Pages
   Extracted from inline <style> blocks to eliminate duplication
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Reset ───────────────────────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── CSS Variables (Design Tokens) ───────────────────────────────────────── */
:root {
  --primary-black: #000000;
  --primary-gold: #d4af37;
  --accent-gold: #d4af37;
  --bg-dark: #000000;
  --bg-card: #0a0a0a;
  --bg-hover: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --border-subtle: rgba(212, 175, 55, 0.15);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --success-green: #4caf50;
  --warning-orange: #ff9800;
  --danger-red: #f44336;
  
  /* Legacy mappings */
  --white: #ffffff;
  --cta-sell: #E53935;
  --cta-sell-hover: #C62828;
  --cta-shadow-sell: 0 10px 25px rgba(229, 57, 53, 0.35);
}

/* ── Base Styles ─────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  background: var(--bg-dark);
  min-height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%) fixed;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100vw;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Ensure all main containers have matching background */
.main,
.main-content,
main {
  background: var(--bg-dark);
  min-height: 100vh;
}

/* ── Container ───────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  overflow: visible;
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
}

/* ── Header/Navigation ───────────────────────────────────────────────────── */
.header {
  background: #000000;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 1rem 0;
  /* Safe-area support for notched devices */
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-left {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-right {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: flex-end;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--primary-gold);
  font-size: 1.5rem;
  font-weight: 900;
}

.logo img {
  max-height: 50px;
  width: auto;
  object-fit: contain;
}

/* HIDE ALL NAV LINKS - USE BURGER MENU ONLY */
.nav-link {
  display: none !important;
}

@media (max-width: 768px) {
  .header {
    padding: 0.5rem 0;
  }
  
  .nav {
    padding: 0 0.75rem;
    gap: 0.3rem;
  }
  
  .nav-right {
    gap: 0.3rem;
  }
  
  .logo img {
    max-height: 32px;
  }
  
  /* Optimize button sizes for mobile nav */
  .btn-gold {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
  }
  
  /* Basket button - maintain 44×44pt minimum on mobile */
  .cart-toggle,
  .btn-basket {
    min-width: 96px; /* Slightly smaller but still readable */
    min-height: 44px; /* iOS requirement - don't reduce */
    padding: 0 14px;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    gap: 6px;
  }
  
  /* Badge stays readable on mobile */
  .cart-count,
  .btn-basket__badge {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    padding: 0 5px;
    top: -4px;
    right: -4px;
  }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.5rem;
  background: var(--primary-gold);
  color: var(--primary-black);
  border: 2px solid var(--primary-gold);
  border-radius: 25px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-gold:hover {
  background: transparent;
  color: var(--primary-gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 215, 0, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  border-color: var(--primary-gold);
  color: var(--primary-gold);
}

/* ═══ Cart/Basket Button - Mobile-First AA Accessible ═══ */
.cart-toggle,
.btn-basket {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  min-height: 44px; /* iOS minimum tap target 44×44pt */
  padding: 0 16px;
  background: linear-gradient(135deg, #ffd700, #ffa500);
  color: #000;
  border: 2px solid #ffd700;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.cart-toggle:hover,
.btn-basket:hover {
  background: linear-gradient(135deg, #ffed4e, #ffb700);
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
  border-color: #ffed4e;
}

.cart-toggle:disabled,
.btn-basket:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Cart Count Badge - High Contrast AA Compliant */
.cart-count,
.btn-basket__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #ff4444; /* Red for high contrast against gold/black */
  color: #ffffff; /* White text for 4.5:1 contrast */
  border: 2px solid var(--bg-dark); /* Dark border prevents bleed */
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Add-to-cart feedback animation */
.cart-count.pulse,
.btn-basket__badge.pulse {
  animation: badge-pulse 0.3s ease-out;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Loading state */
.cart-toggle.loading::after,
.btn-basket.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error state */
.cart-toggle.error,
.btn-basket.error {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.btn-danger {
  background: var(--danger-red);
  color: white;
}

.btn-danger:hover {
  background: #d32f2f;
  transform: translateY(-2px);
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-gold);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-pending {
  background: rgba(255, 152, 0, 0.2);
  color: var(--warning-orange);
}

.badge-delivered {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success-green);
}

.badge-completed {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success-green);
}

.badge-cancelled {
  background: rgba(244, 67, 54, 0.2);
  color: var(--danger-red);
}

/* ── Loading/Spinner ─────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  border: 3px solid var(--border-subtle);
  border-top: 3px solid var(--primary-gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Utility Classes ─────────────────────────────────────────────────────── */
.text-center {
  text-align: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* ── Helper Button (Bottom-Right of Mobile Menu) ───────────────────────── */
.mobile-menu .help-btn-fixed {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  right: 20px;
  padding: 0.75rem 1.25rem;
  color: #ffd700;
  background: transparent;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-family: inherit;
}

.mobile-menu .help-btn-fixed:active {
  background-color: rgba(255, 215, 0, 0.1);
  transform: scale(0.98);
}

/* Help Modal */
.help-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.help-modal.active {
  display: flex;
}

.help-modal-content {
  background: var(--bg-card);
  border: 2px solid var(--primary-gold);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.help-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.help-modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-gold);
  margin: 0;
}

.help-modal-close {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 32px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.help-modal-close:hover {
  background: rgba(255, 215, 0, 0.1);
  color: var(--primary-gold);
}

.help-modal-body {
  color: var(--text-primary);
  line-height: 1.8;
}

.help-modal-body h3 {
  color: var(--primary-gold);
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.help-modal-body h3:first-child {
  margin-top: 0;
}

.help-modal-body ul {
  margin: 0.5rem 0 1rem 1.5rem;
}

.help-modal-body li {
  margin-bottom: 0.5rem;
}

.help-modal-body strong {
  color: var(--primary-gold);
}

@media (max-width: 768px) {
  .help-modal-content {
    padding: 1.5rem;
  }
  
  .help-modal-title {
    font-size: 1.5rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL MODAL LOCK - Prevent Background Scrolling
   Applied when ANY modal/popup is open across the entire site
   ═══════════════════════════════════════════════════════════════════════════ */

body.modal-open,
body.dev-notice-locked,
/* body.cart-open - removed to prevent scroll jump */
body.menu-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  touch-action: none !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: none !important;
}

/* Allow scrolling ONLY within modal content */
.modal-content,
.dev-notice-panel,
.cart-overlay-content,
.mobile-menu-content {
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
}

/* Prevent background interaction through overlay */
.overlay,
.modal-overlay,
.dev-notice-overlay,
.cart-overlay,
.mobile-menu-overlay {
  touch-action: none !important;
  overscroll-behavior: contain !important;
}
