/* Custom variables for premium look */
:root {
  --ui-bg-page: #f8fafc;
  --ui-bg-elevated: #ffffff;
  --ui-bg-soft: #f1f5f9;
  --ui-bg-muted: #e2e8f0;
  --ui-border: rgba(0, 0, 0, 0.05);
  --ui-border-strong: rgba(0, 0, 0, 0.12);
  --ui-accent: #2563eb;
  --ui-accent-hover: #1d4ed8;
  --ui-accent-soft: rgba(37, 99, 235, 0.08);
}

.dark {
  --ui-bg-page: #060913;
  --ui-bg-elevated: rgba(15, 23, 42, 0.75);
  --ui-bg-soft: #1e293b;
  --ui-bg-muted: #111c30;
  --ui-bg-overlay: rgba(15, 23, 42, 0.85);
  --ui-bg-overlay-strong: rgba(15, 23, 42, 0.95);
  --ui-text-primary: #f8fafc;
  --ui-text-secondary: #cbd5e1;
  --ui-text-muted: #64748b;
  --ui-text-on-accent: #ffffff;
  --ui-border: rgba(255, 255, 255, 0.06);
  --ui-border-strong: rgba(255, 255, 255, 0.15);
  --ui-accent: #6366f1;
  --ui-accent-hover: #4f46e5;
  --ui-accent-soft: rgba(99, 102, 241, 0.15);
}

/* Base Body Styles */
body {
  background-attachment: fixed !important;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.04) 0%, transparent 45%) !important;
}

.dark body {
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 45%) !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--ui-border-strong);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ui-accent);
}

/* Product Card Grid Item Polish */
.grid > div {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border: 1px solid var(--ui-border) !important;
  background-color: var(--ui-bg-elevated) !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  backdrop-filter: blur(12px) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.02) !important;
}

.grid > div:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06) !important;
  border-color: var(--ui-accent) !important;
}

.dark .grid > div {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
}

.dark .grid > div:hover {
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4), 0 0 20px var(--ui-accent-soft) !important;
}

/* Product Card Image */
.grid > div img {
  transition: transform 0.4s ease !important;
  border-radius: 12px 12px 0 0 !important;
}
.grid > div:hover img {
  transform: scale(1.03) !important;
}

/* Category Sidebar Item Polish */
[class*="space-y-1"] > a,
[class*="space-y-1"] > button,
[class*="space-y-1"] > div {
  transition: all 0.25s ease !important;
  border-radius: 10px !important;
}

[class*="space-y-1"] > a:hover,
[class*="space-y-1"] > button:hover,
[class*="space-y-1"] > div:hover:not([class*="bg-primary"]):not([class*="bg-blue"]):not([class*="bg-["]) {
  transform: translateX(3px) !important;
  color: var(--ui-accent) !important;
  background-color: var(--ui-accent-soft) !important;
  border-color: var(--ui-border-strong) !important;
}

/* Search input polish */
input[type="text"], input[type="search"] {
  border-radius: 10px !important;
  transition: all 0.2s ease !important;
  border: 1px solid var(--ui-border) !important;
  background-color: var(--ui-bg-elevated) !important;
}
input[type="text"]:focus, input[type="search"]:focus {
  border-color: var(--ui-accent) !important;
  box-shadow: 0 0 10px var(--ui-accent-soft) !important;
  outline: none !important;
}

/* Active category and primary button styling. Keep this scoped to controls. */
aside button[class*="bg-blue-600"],
aside button[class*="bg-primary"],
aside button[class*="bg-blue-500"] {
  background: linear-gradient(135deg, var(--ui-accent), var(--ui-accent-hover)) !important;
  border: none !important;
  box-shadow: 0 4px 14px var(--ui-accent-soft) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15) !important;
}

/* Buttons Polish */
button[class*="bg-primary"], 
button[class*="bg-blue"] {
  background: linear-gradient(135deg, var(--ui-accent), var(--ui-accent-hover)) !important;
  border: none !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 12px var(--ui-accent-soft) !important;
  border-radius: 10px !important;
}

button[class*="bg-primary"]:hover,
button[class*="bg-blue"]:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px var(--ui-accent-soft), 0 0 8px var(--ui-accent) !important;
}

/* The active product navigation item should read as navigation, not a CTA. */
a[aria-current="page"][href="/products"] {
  color: #111827 !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 2px solid #111827 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.dark a[aria-current="page"][href="/products"] {
  color: #f8fafc !important;
  border-bottom-color: #f8fafc !important;
}

/* Compact storefront announcement replaces the oversized products hero. */
[data-codex-products-hero] {
  margin: 28px 0 30px !important;
  text-align: left !important;
}

[data-codex-storefront-notice] {
  border-top: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  background: rgba(255, 255, 255, 0.84);
  padding: 18px 20px;
  color: #111827;
}

.codex-address-alert {
  display: block;
  margin: -18px -20px 18px;
  border-bottom: 1px solid #fecaca;
  background: #fff1f2;
  padding: 15px 20px;
}

.codex-address-copy strong {
  display: block;
  color: #991b1b;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
}

.codex-address-copy p {
  margin: 5px 0 0;
  color: #7f1d1d;
  font-size: 14px;
  line-height: 1.6;
}

.codex-address-copy del {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  word-break: break-all;
}

.codex-new-address {
  color: #047857;
  font-size: 18px;
  font-weight: 800;
  line-height: inherit;
  letter-spacing: 0;
  margin-left: 3px;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  white-space: normal;
}

.codex-new-address:hover {
  color: #065f46;
}

.codex-notice-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.codex-notice-intro h1,
.codex-notice-rules h2 {
  margin: 0;
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0;
}

.codex-notice-intro p {
  margin: 6px 0 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.75;
}

.codex-notice-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.7;
}

.codex-notice-contact a {
  color: #047857;
  font-weight: 600;
  text-decoration: none;
}

.codex-notice-contact a:hover {
  text-decoration: underline;
}

.codex-notice-rules {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  border-top: 1px solid #e5e7eb;
  padding-top: 15px;
}

.codex-notice-rules ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 24px;
  margin: 0;
  padding-left: 20px;
  color: #374151;
  font-size: 13px;
  line-height: 1.65;
}

.codex-notice-rules li::marker {
  color: #b45309;
  font-weight: 700;
}

.dark [data-codex-storefront-notice] {
  border-color: #334155;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
}

.dark .codex-address-alert {
  border-bottom-color: #7f1d1d;
  background: #2b1218;
}

.dark .codex-address-copy strong {
  color: #fecaca;
}

.dark .codex-address-copy p {
  color: #fca5a5;
}

.dark .codex-new-address {
  color: #6ee7b7;
}

.dark .codex-notice-intro h1,
.dark .codex-notice-rules h2 {
  color: #f8fafc;
}

.dark .codex-notice-intro p,
.dark .codex-notice-contact,
.dark .codex-notice-rules ol {
  color: #cbd5e1;
}

.dark .codex-notice-rules {
  border-top-color: #334155;
}

@media (max-width: 767px) {
  [data-codex-products-hero] {
    margin: 16px 0 20px !important;
  }

  [data-codex-storefront-notice] {
    padding: 15px 14px;
  }

  .codex-address-alert {
    margin: -15px -14px 15px;
    padding: 14px;
  }

  .codex-address-copy strong,
  .codex-new-address {
    font-size: 18px;
  }

  .codex-new-address {
    overflow-wrap: anywhere;
  }

  .codex-notice-intro,
  .codex-notice-rules,
  .codex-notice-rules ol {
    grid-template-columns: 1fr;
  }

  .codex-notice-intro {
    gap: 12px;
  }

  .codex-notice-contact {
    gap: 5px 12px;
  }

  .codex-notice-rules {
    gap: 9px;
    margin-top: 13px;
    padding-top: 12px;
  }

  .codex-notice-rules ol {
    gap: 6px;
  }
}

/* Keep the tall product editor fully reachable inside the viewport. */
[class~="place-items-center"][class~="overflow-y-auto"]:has(> [role="dialog"].max-w-5xl) {
  align-items: start !important;
  justify-items: center !important;
}
