/**
 * @file theme.css
 * Minsait Marketplace Theme Variables
 *
 * Color palette based on Minsait corporate branding.
 * Primary color: #480e2a (deep wine/maroon)
 */

:root {
  /* Minsait Marketplace Color Palette */
  --background: oklch(0.97 0.008 350);       /* #f8f6f7 - Light background */
  --foreground: oklch(0.12 0.04 350);        /* #1a0f14 - Text main */
  --card: oklch(1 0 0);                       /* #ffffff - Surface light */
  --card-foreground: oklch(0.12 0.04 350);   /* #1a0f14 - Text main */
  --primary: oklch(0.25 0.09 350);           /* #480e2a - Minsait wine */
  --primary-foreground: oklch(1 0 0);        /* #ffffff - White */
  --secondary: oklch(0.95 0.015 350);        /* #f2e8ed - Accent light */
  --secondary-foreground: oklch(0.25 0.09 350); /* #480e2a - Primary */
  --muted: oklch(0.95 0.015 350);            /* #f2e8ed - Accent light */
  --muted-foreground: oklch(0.5 0.1 350);    /* #925472 - Text muted */
  --accent: oklch(0.95 0.015 350);           /* #f2e8ed - Accent light */
  --accent-foreground: oklch(0.25 0.09 350); /* #480e2a - Primary */
  --destructive: oklch(0.55 0.2 25);         /* Red for errors */
  --destructive-foreground: oklch(1 0 0);    /* White */
  --border: oklch(0.9 0.025 350);            /* #e5d2db - Border light */
  --input: oklch(0.9 0.025 350);             /* #e5d2db - Input border */

  /* Success/Status colors */
  --success: oklch(0.6 0.15 145);            /* Green for in-stock */
  --success-foreground: oklch(1 0 0);
  --warning: oklch(0.7 0.15 60);             /* Orange for low stock */
  --warning-foreground: oklch(0.2 0 0);

  /* Typography - Inter font family */
  --font-sans: "Inter", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: "Fira Mono", "Menlo", "Consolas", "Liberation Mono", monospace;

  /* Border radius matching prototype */
  --radius: 0.375rem;

  /* Shadows */
  --shadow-x: 0;
  --shadow-y: 1px;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-opacity: 0.1;
  --shadow-color: oklch(0.25 0.09 350);
  --shadow-2xs: 0 1px 3px 1px hsl(350 30% 10% / 0.05);
  --shadow-xs: 0 1px 3px 1px hsl(350 30% 10% / 0.05), 0 1px 2px -1px hsl(350 30% 10% / 0.1);
  --shadow-sm: 0 1px 3px 1px hsl(350 30% 10% / 0.1), 0 2px 4px -1px hsl(350 30% 10% / 0.1);
  --shadow: 0 1px 3px 1px hsl(350 30% 10% / 0.1), 0 2px 4px -1px hsl(350 30% 10% / 0.1);
  --shadow-md: 0 1px 3px 1px hsl(350 30% 10% / 0.1), 0 4px 6px -2px hsl(350 30% 10% / 0.1);
  --shadow-lg: 0 1px 3px 1px hsl(350 30% 10% / 0.1), 0 8px 10px -2px hsl(350 30% 10% / 0.1);
  --shadow-xl: 0 1px 3px 1px hsl(350 30% 10% / 0.1), 0 12px 14px -3px hsl(350 30% 10% / 0.1);
  --shadow-2xl: 0 1px 3px 1px hsl(350 30% 10% / 0.1), 0 16px 18px -3px hsl(350 30% 10% / 0.1);
  --tracking-normal: 0em;
  --spacing: 0.25rem;

  /* Navbar height for hero billboard overlay */
  --navbar-height: calc(var(--spacing) * 20);

  @media (min-width: 768px) {
    --navbar-height: calc(var(--spacing) * 20);
  }

  /* Marketplace specific variables */
  --header-bg: oklch(1 0 0 / 0.95);          /* Header background with transparency */
  --surface-dark: oklch(0.2 0.05 350);       /* #2d1b24 - Dark surface */
  --background-dark: oklch(0.15 0.04 350);   /* #201219 - Dark background */
}

.dark {
  --background: oklch(0.15 0.04 350);        /* #201219 - Dark background */
  --foreground: oklch(1 0 0);                /* White */
  --card: oklch(0.2 0.05 350);               /* #2d1b24 - Surface dark */
  --card-foreground: oklch(1 0 0);           /* White */
  --primary: oklch(0.35 0.12 350);           /* Lighter primary for dark mode */
  --primary-foreground: oklch(1 0 0);        /* White */
  --secondary: oklch(0.3 0.06 350);
  --secondary-foreground: oklch(1 0 0);
  --muted: oklch(0.25 0.05 350);
  --muted-foreground: oklch(0.75 0.06 350);  /* Lighter muted text */
  --accent: oklch(0.35 0.12 350);
  --accent-foreground: oklch(1 0 0);
  --destructive: oklch(0.55 0.2 25);
  --destructive-foreground: oklch(1 0 0);
  --border: oklch(0.35 0.08 350);
  --input: oklch(0.35 0.08 350);
  --font-sans: "Inter", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: "Fira Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
  --radius: 0.375rem;
  --shadow-x: 0;
  --shadow-y: 1px;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-opacity: 0.15;
  --shadow-color: oklch(0 0 0);
  --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.1);
  --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.1);
  --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.15), 0 1px 2px -1px hsl(0 0% 0% / 0.15);
  --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.15), 0 1px 2px -1px hsl(0 0% 0% / 0.15);
  --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.15), 0 2px 4px -1px hsl(0 0% 0% / 0.15);
  --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.15), 0 4px 6px -1px hsl(0 0% 0% / 0.15);
  --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.15), 0 8px 10px -1px hsl(0 0% 0% / 0.15);
  --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.15), 0 12px 14px -1px hsl(0 0% 0% / 0.15);

  --header-bg: oklch(0.2 0.05 350 / 0.95);   /* Dark header background */
}

/* Product gallery */
.product-variation-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-variation-gallery__media {
  width: 100%;
  height: 100%;
}

.product-variation-gallery__media img,
.product-variation-gallery__media picture,
.product-variation-gallery__media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-variation-gallery__thumb {
  background: var(--card);
  border-color: transparent;
}

.product-variation-gallery__thumb:hover {
  border-color: rgba(72, 14, 42, 0.25);
}

.product-variation-gallery__thumb.is-active {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Main image hover zoom */
.product-variation-gallery [data-gallery-main] .product-variation-gallery__media img,
.product-variation-gallery [data-gallery-main] .product-variation-gallery__media picture img {
  transition: transform 0.4s ease;
  transform-origin: center;
  will-change: transform;
}

.product-variation-gallery [data-gallery-main]:hover .product-variation-gallery__media img,
.product-variation-gallery [data-gallery-main]:hover .product-variation-gallery__media picture img {
  transform: scale(1.05);
}

.product-variation-gallery [data-gallery-main] {
  cursor: zoom-in;
}

/* Product variants */
.product-variants .attribute-widgets {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Force attribute color radios to layout in a row */
[id^="edit-purchased-entity-0-attributes-attribute-color"] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Price styling for variation price field */
[class^="product--variation-field--variation_price"],
[class*=" product--variation-field--variation_price"] {
  color: rgb(72 14 42 / var(--tw-text-opacity, 1));
  --tw-text-opacity: 1;
  font-weight: 700;
  font-size: 2.25rem;
  line-height: 2.5rem;
}

.product-variants .attribute-widgets > .form-item {
  margin: 0;
}

.product-variants .attribute-widgets > .form-item > label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-variants .attribute-widgets fieldset > legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-variants .variant-attribute--color,
.product-variants .variant-attribute--memory {
  display: flex;
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.product-variants .variant-attribute--memory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.product-variants input[type="radio"][name*="[attribute_color]"],
.product-variants input[type="radio"][name*="[attribute_memory]"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.product-variants .variant-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--swatch-color, #e2e8f0);
  cursor: pointer;
  font-size: 0;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.product-variants .variant-swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.product-variants input[type="radio"][name*="[attribute_color]"]:checked + .variant-swatch,
.product-variants .variant-swatch.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px rgba(72, 14, 42, 0.5), 0 6px 12px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.product-variants input[type="radio"][name*="[attribute_color]"]:focus-visible + .variant-swatch {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.product-variants .variant-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1.1rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.product-variants input[type="radio"][name*="[attribute_memory]"]:checked + .variant-card,
.product-variants .variant-card.is-selected {
  border-color: rgba(72, 14, 42, 0.4);
  background: rgba(72, 14, 42, 0.06);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.product-variants input[type="radio"][name*="[attribute_memory]"]:focus-visible + .variant-card {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Hide Drupal AJAX progress spinner/text in product interactions */
.ajax-progress,
.ajax-progress-throbber,
.ajax-progress .message,
.ajax-progress .progress-text {
  display: none !important;
}

/* Add to cart quantity layout */
.product-add-to-cart {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.product-qty__input {
  -moz-appearance: textfield;
}

.product-qty__input::-webkit-outer-spin-button,
.product-qty__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Product reviews */
.marketplace-product-detail .product-reviews-section {
  max-width: 56rem;
}

.marketplace-product-detail .product-reviews-field {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.marketplace-product-detail .product-reviews-field__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.marketplace-product-detail .product-reviews-field__empty {
  margin: 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: rgba(72, 14, 42, 0.03);
  color: var(--muted-foreground);
}

.marketplace-product-detail .product-review-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-xs);
}

.marketplace-product-detail .product-review-card__title {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--foreground);
  font-weight: 700;
}

.marketplace-product-detail .product-review-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.marketplace-product-detail .product-review-card__meta p {
  margin: 0;
}

.marketplace-product-detail .product-review-card__permalink a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.marketplace-product-detail .product-review-card__permalink a:hover {
  text-decoration: underline;
}

.marketplace-product-detail .product-review-card__content h3 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--foreground);
}

.marketplace-product-detail .product-review-card__content p {
  margin: 0;
  line-height: 1.65;
  color: var(--foreground);
}

.marketplace-product-detail .product-review-card__content > * + * {
  margin-top: 0.75rem;
}

.marketplace-product-detail .product-review-card__actions .links {
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  list-style: none;
}

.marketplace-product-detail .product-review-card__actions .links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.marketplace-product-detail .product-review-card__actions .links a:hover {
  text-decoration: underline;
}

.marketplace-product-detail .product-review-card .fivestar-form-item {
  margin: 0;
}

.marketplace-product-detail .product-review-card .fivestar-form-item select.vote {
  min-height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.35rem 0.65rem;
  background: var(--card);
  color: var(--foreground);
}

.marketplace-product-detail .product-review-card .fivestar-summary {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.marketplace-product-detail .product-reviews-field__form {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  padding: 1.25rem;
}

.marketplace-product-detail .product-reviews-field__form-title {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  line-height: 1.2;
  color: var(--foreground);
}

.marketplace-product-detail .product-reviews-field__form .form-item {
  margin-bottom: 1rem;
}

.marketplace-product-detail .product-reviews-field__form label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
}

.marketplace-product-detail .product-reviews-field__form input[type="text"],
.marketplace-product-detail .product-reviews-field__form input[type="email"],
.marketplace-product-detail .product-reviews-field__form input[type="url"],
.marketplace-product-detail .product-reviews-field__form input[type="number"],
.marketplace-product-detail .product-reviews-field__form textarea,
.marketplace-product-detail .product-reviews-field__form select {
  width: 100%;
  min-height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--card);
  color: var(--foreground);
  padding: 0.5rem 0.75rem;
}

.marketplace-product-detail .product-reviews-field__form textarea {
  min-height: 10rem;
  resize: vertical;
}

.marketplace-product-detail .product-reviews-field__form .description {
  margin-top: 0.35rem;
  color: var(--muted-foreground);
  font-size: 0.8rem;
}

.marketplace-product-detail .product-reviews-field__form .filter-wrapper {
  margin-top: 0.85rem;
  margin-bottom: 1rem;
}

.marketplace-product-detail .product-reviews-field__form .links.inline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.marketplace-product-detail .product-reviews-field__form .links.inline li {
  color: var(--muted-foreground);
}

.marketplace-product-detail .product-reviews-field__form .links.inline a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.marketplace-product-detail .product-reviews-field__form .links.inline a:hover {
  text-decoration: underline;
}

.marketplace-product-detail .product-reviews-field__form .button,
.marketplace-product-detail .product-reviews-field__form input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.45rem 1rem;
  border-radius: 0.6rem;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.marketplace-product-detail .product-reviews-field__form .button:hover,
.marketplace-product-detail .product-reviews-field__form input[type="submit"]:hover {
  opacity: 0.92;
}

.marketplace-product-detail .product-reviews-field__form .button + .button,
.marketplace-product-detail .product-reviews-field__form input[type="submit"] + .button,
.marketplace-product-detail .product-reviews-field__form .button + input[type="submit"] {
  margin-left: 0.45rem;
}

/* Store catalog sort select */
.store-catalog-toolbar__sort,
[data-store-sort-form] {
  flex-shrink: 0;
}

.store-catalog-exposed-form {
  display: flex;
  align-items: center;
}

.store-catalog-exposed-form .form-item,
.store-catalog-sort-select {
  margin: 0;
}

.store-catalog-exposed-form .form-item > label,
.store-catalog-exposed-form .description {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.store-catalog-exposed-form select,
.store-sort-select[data-store-sort-select],
.store-sort-select {
  min-width: 14.5rem;
  border: 1px solid var(--border) !important;
  border-radius: 0.7rem !important;
  background-color: var(--card) !important;
  color: var(--foreground) !important;
  padding: 0.55rem 2.35rem 0.55rem 0.9rem !important;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05) !important;
}

.store-catalog-exposed-form select:hover,
.store-sort-select[data-store-sort-select]:hover,
.store-sort-select:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border)) !important;
}

.store-catalog-exposed-form select:focus,
.store-catalog-exposed-form select:focus-visible,
.store-sort-select[data-store-sort-select]:focus,
.store-sort-select[data-store-sort-select]:focus-visible,
.store-sort-select:focus,
.store-sort-select:focus-visible {
  outline: none !important;
  color: var(--foreground) !important;
  background-color: var(--card) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent) !important;
}

.store-catalog-exposed-form select option,
.store-sort-select[data-store-sort-select] option,
.store-sort-select option {
  color: #1a0f14;
  background-color: #ffffff;
  font-weight: 500;
}

.store-catalog-exposed-form select option[disabled],
.store-sort-select[data-store-sort-select] option[disabled],
.store-sort-select option[disabled] {
  color: var(--muted-foreground) !important;
}

.dark .store-catalog-exposed-form select option,
.dark .store-sort-select[data-store-sort-select] option,
.dark .store-sort-select option {
  color: #ffffff;
  background-color: var(--surface-dark);
}

@media (max-width: 640px) {
  .store-catalog-exposed-form select,
  .store-sort-select[data-store-sort-select],
  .store-sort-select {
    min-width: 11.5rem;
  }
}
