/* Nisa Dark Mode — opt-in only (Light Mode remains the default) */

html[data-nisa-theme="dark"] {
  color-scheme: dark !important;
  --site-main-primary: #e8eef5 !important;
  --site-main-accent: #3b6e9c !important;
  --site-main-text: #e8eef5 !important;
  --site-main-muted: #a8bacd !important;
  --site-main-bg: #0f1722 !important;
  --site-main-bg-soft: #141f2e !important;
  --site-main-surface: #182536 !important;
  --site-main-border: #2a3d54 !important;
  --site-main-surface-tint: #1f3045 !important;

  --color-primary: var(--site-main-primary) !important;
  --color-accent: var(--site-main-accent) !important;
  --color-text: var(--site-main-text) !important;
  --color-secondary: var(--site-main-muted) !important;
  --color-text-muted: var(--site-main-muted) !important;
  --color-secondary-light-active: var(--site-main-bg) !important;
  --color-secondary-light-active-2: var(--site-main-bg-soft) !important;
  --color-surface: var(--site-main-surface) !important;
  --color-border: var(--site-main-border) !important;
  --color-secondary-normal: var(--site-main-surface-tint) !important;
  --color-bg: var(--site-main-bg) !important;

  --color-primary-darker: #e8eef5 !important;
  --color-white-darker: #b8c7d9 !important;
  --color-surface-overlay: rgba(24, 37, 54, 0.94) !important;
  --color-focus-ring: rgba(201, 163, 79, 0.28) !important;
  --color-shadow: rgba(0, 0, 0, 0.45) !important;
  --color-shadow-soft: rgba(0, 0, 0, 0.28) !important;
  --color-shadow-medium: rgba(0, 0, 0, 0.38) !important;

  --home-ui-border: #2a3d54 !important;
  --home-ui-text: #e8eef5 !important;
  --home-ui-muted: #a8bacd !important;

  --status-page-bg-color-1: #0f1722 !important;
  --status-page-bg-color-2: #141f2e !important;
  --status-page-bg-color-3: #182536 !important;
  --status-page-bg-color-4: #1d2c40 !important;
}

@media (prefers-color-scheme: dark) {
  html[data-nisa-theme="dark"],
  html[data-nisa-theme="dark"] body {
    background-color: var(--site-main-bg) !important;
    color: var(--site-main-text) !important;
    color-scheme: dark !important;
  }
}

html[data-nisa-theme="dark"] body {
  background-color: var(--site-main-bg) !important;
  color: var(--site-main-text) !important;
}

/* Preserve crisp contrast on primary & secondary buttons in dark mode */
html[data-nisa-theme="dark"] .btn.btn-primary,
html[data-nisa-theme="dark"] .cookie-consent__btn--primary {
  background: #2f5c85;
  border-color: #3f72a1;
  color: #fffaf0;
}

html[data-nisa-theme="dark"] .btn.btn-primary:hover,
html[data-nisa-theme="dark"] .cookie-consent__btn--primary:hover {
  background: #3b6e9c;
  border-color: #4c84b8;
  color: #fffaf0;
}

html[data-nisa-theme="dark"] .cart-count {
  background: var(--color-gold, #c9a34f);
  color: #0f1722;
}

html[data-nisa-theme="dark"] input,
html[data-nisa-theme="dark"] select,
html[data-nisa-theme="dark"] textarea {
  background-color: var(--site-main-surface);
  color: var(--site-main-text);
  border-color: var(--site-main-border);
}

html[data-nisa-theme="dark"] input::placeholder,
html[data-nisa-theme="dark"] textarea::placeholder {
  color: var(--site-main-muted);
}

/* Override hardcoded light surfaces in Angular components when Dark Mode is active */
html[data-nisa-theme="dark"] .shopping-duaa,
html[data-nisa-theme="dark"] .product-card-link,
html[data-nisa-theme="dark"] .size-chart__table,
html[data-nisa-theme="dark"] .qty-btn,
html[data-nisa-theme="dark"] .end-prompt-btn--continue,
html[data-nisa-theme="dark"] .chatbot-retry-btn,
html[data-nisa-theme="dark"] .coming-soon-page,
html[data-nisa-theme="dark"] .snf-page,
html[data-nisa-theme="dark"] .not-found-page,
html[data-nisa-theme="dark"] .uc-page,
html[data-nisa-theme="dark"] .loader-page,
html[data-nisa-theme="dark"] .thumb,
html[data-nisa-theme="dark"] .summary-product-image {
  background: var(--site-main-surface) !important;
  color: var(--site-main-text) !important;
  border-color: var(--site-main-border) !important;
}

html[data-nisa-theme="dark"] .shopping-duaa__eyebrow {
  background: var(--site-main-surface-tint) !important;
  color: var(--color-gold, #c9a34f) !important;
  border: 1px solid var(--site-main-border) !important;
}

html[data-nisa-theme="dark"] .shopping-duaa__text,
html[data-nisa-theme="dark"] .shopping-duaa__text--arabic {
  color: var(--site-main-text) !important;
}

html[data-nisa-theme="dark"] .size-chart__table th,
html[data-nisa-theme="dark"] .size-chart__table td {
  border-color: var(--site-main-border) !important;
  color: var(--site-main-text) !important;
}

/* Smooth transition only during active theme toggle */
html.nisa-theme-transition,
html.nisa-theme-transition body,
html.nisa-theme-transition .header,
html.nisa-theme-transition .footer,
html.nisa-theme-transition .cart-drawer {
  transition: background-color 0.28s ease, color 0.28s ease, border-color 0.28s ease;
}

/* Theme toggle button — fixed in header next to sidebar hamburger */
.header .container {
  position: relative;
}

#nisa-theme-toggle {
  position: fixed;
  top: calc(var(--announcement-height, 0px) + 18px);
  left: calc(var(--page-pad-x, 1.5rem) + 46px);
  z-index: 1250;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--site-main-border, #d6e0ea);
  background: var(--site-main-surface, #ffffff);
  color: var(--site-main-text, #204566);
  box-shadow: 0 2px 8px var(--color-shadow-soft, rgba(0, 0, 0, 0.08));
  font-family: var(--font-body, "Noto Sans", system-ui, sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s ease,
    background-color 0.25s ease,
    border-color 0.25s ease;
}

.header #nisa-theme-toggle {
  position: absolute;
  top: 50%;
  left: calc(var(--page-pad-x, 1.5rem) + 46px);
  transform: translateY(-50%);
  z-index: 105;
  box-shadow: none;
}

#nisa-theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--color-shadow-medium, rgba(0, 0, 0, 0.12));
}

.header #nisa-theme-toggle:hover {
  transform: translateY(calc(-50% - 1px));
}

#nisa-theme-toggle:active {
  transform: translateY(0);
}

.header #nisa-theme-toggle:active {
  transform: translateY(-50%);
}

#nisa-theme-toggle:focus-visible {
  outline: 2px solid var(--color-gold, #c9a34f);
  outline-offset: 2px;
}

#nisa-theme-toggle svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

html[data-nisa-theme="dark"] #nisa-theme-toggle {
  background: #182536;
  border-color: #2a3d54;
  color: #e8eef5;
}

html[data-nisa-theme="dark"] #nisa-theme-toggle svg {
  color: var(--color-gold, #c9a34f);
}

@media (max-width: 600px) {
  #nisa-theme-toggle,
  .header #nisa-theme-toggle {
    left: calc(var(--page-pad-x, 0.75rem) + 40px);
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }

  #nisa-theme-toggle span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #nisa-theme-toggle,
  html.nisa-theme-transition,
  html.nisa-theme-transition body,
  html.nisa-theme-transition .header,
  html.nisa-theme-transition .footer,
  html.nisa-theme-transition .cart-drawer {
    transition: none !important;
  }
}

/* Add to Cart button: matches Quick View styling and appears only on card hover/focus */
.product-card .product-card__quick-view {
  inset-inline-start: 10px !important;
  inset-inline-end: auto !important;
  left: auto;
  bottom: 12px !important;
  width: max-content !important;
  max-width: calc(50% - 14px) !important;
  padding: 8px 14px !important;
  transform: translateY(8px) !important;
}

.product-card:hover .product-card__quick-view,
.product-card:focus-within .product-card__quick-view {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.product-card .product-card__quick-add {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: absolute;
  inset-inline-start: auto !important;
  inset-inline-end: 10px !important;
  bottom: 12px !important;
  z-index: 5;
  width: max-content !important;
  max-width: calc(50% - 14px) !important;
  height: auto !important;
  padding: 8px 14px !important;
  border: 0 !important;
  border-radius: 2px !important;
  color: var(--color-text, #204566) !important;
  background: var(--color-surface-overlay, rgba(255, 255, 255, 0.92)) !important;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: none !important;
  font-family: var(--font-body, "Noto Sans", system-ui, sans-serif);
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
  opacity: 0 !important;
  visibility: visible !important;
  pointer-events: none !important;
  cursor: pointer;
  transform: translateY(8px) !important;
  transition: opacity 0.3s, transform 0.3s, background-color 0.2s, color 0.2s !important;
}

.product-card:hover .product-card__quick-add,
.product-card:focus-within .product-card__quick-add {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

.product-card .product-card__quick-add-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.product-card .product-card__quick-add::after {
  content: "Add to cart";
  white-space: nowrap;
}

html[lang^="ar"] .product-card .product-card__quick-add::after,
[dir="rtl"] .product-card .product-card__quick-add::after {
  content: "أضف للسلة";
}

.product-card .product-card__quick-add.product-card__quick-add--added {
  background: #2e7d32 !important;
  color: #ffffff !important;
}

.product-card .product-card__quick-add.product-card__quick-add--added::after {
  content: "Added ✓";
}

html[lang^="ar"] .product-card .product-card__quick-add.product-card__quick-add--added::after,
[dir="rtl"] .product-card .product-card__quick-add.product-card__quick-add--added::after {
  content: "تمت الإضافة ✓";
}

@media (max-width: 480px) {
  .product-card .product-card__quick-view {
    display: none !important;
  }

  .product-card .product-card__quick-add {
    max-width: calc(100% - 20px) !important;
    padding: 7px 12px !important;
    font-size: 0.7rem !important;
  }
}
