/* =========================================================
   🌿 HMC Brand Override (cleaned)
   ========================================================= */
/* Report (button normalization):
   - Accent CTA updates: templates/ordering/catalog.html, templates/b2b/catalog.html,
     templates/ordering/b2b/catalog.html, templates/ordering/partials/_product_grid.html,
     templates/ordering/partials/_products_list.html, templates/ordering/partials/_product_card.html,
     templates/ordering/b2b_dashboard.html, templates/core/landing.html, templates/ops/inbox.html,
     templates/ops/order_chat.html, templates/components/chat_launcher.html,
     templates/components/contact_panel.html, templates/components/contact_dropdown.html,
     templates/ordering/order_list.html, templates/ordering/order_detail.html,
     templates/ordering/order_create.html, templates/ordering/ops_detail.html,
     templates/ordering/ops_team.html, ordering/templates/ordering/partials/_ops_modals.html.
   - Primary/confirm buttons unified: templates/core/login.html, templates/ordering/order_create.html,
     templates/ordering/b2b/cart.html, templates/ordering/partials/_line_row.html,
     templates/ordering/ops_list.html, templates/ordering/ops_team.html,
     ordering/templates/ordering/partials/_ops_modals.html,
     apps/deal_generator/templates/deal_generator/list.html,
     apps/deal_generator/templates/deal_generator/form.html.
   - Legacy bg/btn-light overrides removed or replaced: templates/ordering/catalog.html,
     templates/b2b/catalog.html, templates/ordering/b2b/catalog.html,
     templates/ordering/partials/_product_grid.html, templates/components/contact_dropdown.html,
     templates/components/contact_panel.html, templates/ordering/b2b_dashboard.html. */
:root {
  --hmc-brand-primary: #2F4738;
  --hmc-brand-primary-hover: #3A5645;
  --hmc-brand-primary-active: #244333;

  --hmc-brand-accent: #8C2E6E;
  --hmc-brand-accent-hover: #A03B7E;
  --hmc-brand-accent-active: #73255C;

  --hmc-brand-bg: #F8F9F8;
  --hmc-brand-border: #E2EAE6;
  --hmc-brand-text: #1E1E1E;

  --hmc-shadow-sm: 0 4px 12px rgba(0,0,0,.04);
  --hmc-shadow: 0 6px 16px rgba(47, 71, 56, 0.18);
  --hmc-shadow-strong: 0 10px 26px rgba(47, 71, 56, 0.24);
}

/* Brand utility fallbacks (for pages without Tailwind) */
.bg-brand {
  background-color: var(--hmc-brand-primary) !important;
  color: #ffffff !important;
}
.bg-brand\/90 {
  background-color: rgba(47, 71, 56, 0.9) !important;
  color: #ffffff !important;
}
.bg-brand\/15 {
  background-color: rgba(47, 71, 56, 0.15) !important;
}
.bg-brand\/10 {
  background-color: rgba(47, 71, 56, 0.10) !important;
}
.bg-brand\/5 {
  background-color: rgba(47, 71, 56, 0.05) !important;
}
.hover\:bg-brand\/90:hover {
  background-color: rgba(47, 71, 56, 0.9) !important;
}
.hover\:bg-brand\/5:hover {
  background-color: rgba(47, 71, 56, 0.05) !important;
}
.text-brand {
  color: var(--hmc-brand-primary) !important;
}
.text-brand\/80 {
  color: rgba(47, 71, 56, 0.80) !important;
}
.text-brand\/70 {
  color: rgba(47, 71, 56, 0.70) !important;
}
.text-brand\/60 {
  color: rgba(47, 71, 56, 0.60) !important;
}
.text-brand\/50 {
  color: rgba(47, 71, 56, 0.50) !important;
}
.text-brand\/45 {
  color: rgba(47, 71, 56, 0.45) !important;
}
.text-brand\/40 {
  color: rgba(47, 71, 56, 0.40) !important;
}
.hover\:text-brand\/80:hover {
  color: rgba(47, 71, 56, 0.80) !important;
}
.border-brand {
  border-color: var(--hmc-brand-primary) !important;
}
.border-brand\/30 {
  border-color: rgba(47, 71, 56, 0.30) !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* -------------------------------
   BASE BUTTON
   ------------------------------- */
.btn,
button,
[type="button"],
[type="submit"] {
  border-radius: 8px;
  font-weight: 600;
  transition: all .22s ease;
  box-shadow: none;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:focus-visible {
  outline: 2px solid rgba(140,46,110,.35);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(140,46,110,.14);
}
.btn:disabled,
button:disabled,
[type="submit"]:disabled {
  background-color: rgba(212,214,212,.85) !important;
  border-color: rgba(212,214,212,.9) !important;
  color: rgba(85,89,86,.8) !important;
  cursor: not-allowed;
  transform: none;
}

/* =========================================================
   1) PRIMARY (الأخضر) - للحاجات التشغيلية بس
   ========================================================= */
.btn-primary,
.btn-success,
.btn-hmc-primary,
.bg-primary,
.bg-success {
  background-color: var(--hmc-brand-primary) !important;
  border: 1px solid var(--hmc-brand-primary) !important;
  color: #fff !important;
  box-shadow: var(--hmc-shadow) !important;
}
.btn-primary:hover,
.btn-success:hover,
.btn-hmc-primary:hover,
.bg-primary:hover,
.bg-success:hover {
  background-color: var(--hmc-brand-primary-hover) !important;
  border-color: var(--hmc-brand-primary-hover) !important;
  box-shadow: var(--hmc-shadow-strong) !important;
}
.btn-primary:active,
.btn-success:active {
  background-color: var(--hmc-brand-primary-active) !important;
  border-color: var(--hmc-brand-primary-active) !important;
}

.btn-hmc-primary {
  background: var(--hmc-brand-primary) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: var(--hmc-shadow);
}
.btn-hmc-primary:hover {
  background: var(--hmc-brand-primary-hover) !important;
}
.btn-hmc-primary:active {
  background: var(--hmc-brand-primary-active) !important;
}

.btn-hmc-accent {
  background: var(--hmc-brand-accent) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: var(--hmc-shadow);
}
.btn-hmc-accent:hover {
  background: var(--hmc-brand-accent-hover) !important;
}
.btn-hmc-accent:active {
  background: var(--hmc-brand-accent-active) !important;
}

/* =========================================================
   2) ACCENT (البنفسجي) - للتواصل / CTA / chat / cart
   ========================================================= */
.btn-accent,
a.btn-accent,
button.btn-accent,
.bg-accent {
  background-color: var(--hmc-brand-accent) !important;
  border: 1px solid var(--hmc-brand-accent) !important;
  color: #fff !important;
  background-image: none !important;
  box-shadow: var(--hmc-shadow);
}
.btn-accent:hover,
a.btn-accent:hover,
button.btn-accent:hover,
.bg-accent:hover {
  background-color: var(--hmc-brand-accent-hover) !important;
  border-color: var(--hmc-brand-accent-hover) !important;
  color: #fff !important;
}
.btn-accent:active,
.bg-accent:active {
  background-color: var(--hmc-brand-accent-active) !important;
  border-color: var(--hmc-brand-accent-active) !important;
}

/* لو حد حاطط bg-white بالغلط على زرار بنفسجي */
.btn-accent.bg-white,
.btn-accent.btn-light,
.bg-accent.bg-white {
  background-color: var(--hmc-brand-accent) !important;
  color: #fff !important;
}

/* =========================================================
   3) OUTLINE VARIANTS
   ========================================================= */
/* أخضر */
.btn-outline-primary,
.btn-outline-success,
.btn-outline-brand {
  background-color: transparent !important;
  border: 1.5px solid var(--hmc-brand-primary) !important;
  color: var(--hmc-brand-primary) !important;
}
.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-brand:hover {
  background-color: var(--hmc-brand-primary) !important;
  color: #fff !important;
  box-shadow: var(--hmc-shadow);
}

/* بنفسجي */
.btn-outline-accent {
  background-color: transparent !important;
  border: 1.5px solid var(--hmc-brand-accent) !important;
  color: var(--hmc-brand-accent) !important;
}
.btn-outline-accent:hover {
  background-color: rgba(140,46,110,.12) !important;
  color: var(--hmc-brand-accent) !important;
}

/* =========================================================
   4) SECONDARY / LIGHT
   ========================================================= */
.btn-light,
.btn-outline-light {
  background-color: var(--hmc-brand-bg) !important;
  border: 1px solid var(--hmc-brand-border) !important;
  color: var(--hmc-brand-primary) !important;
}
.btn-light:hover,
.btn-outline-light:hover {
  background-color: #E2EAE6 !important;
}

.nav-auth-outline {
  background-color: transparent !important;
  border: 1.5px solid var(--hmc-brand-primary) !important;
  color: var(--hmc-brand-primary) !important;
  box-shadow: none !important;
}

.nav-auth-outline:hover,
.nav-auth-outline:focus-visible {
  background-color: var(--hmc-brand-primary) !important;
  border-color: var(--hmc-brand-primary) !important;
  color: #ffffff !important;
  box-shadow: var(--hmc-shadow);
}

.nav-auth-outline:active {
  background-color: var(--hmc-brand-primary-active) !important;
  border-color: var(--hmc-brand-primary-active) !important;
  color: #ffffff !important;
  transform: translateY(0);
}

.site-header .nav-auth-outline {
  border-color: rgba(255, 255, 255, 0.65) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

.site-header .nav-auth-outline:hover,
.site-header .nav-auth-outline:focus-visible {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px -18px rgba(17, 24, 39, 0.6);
}

.site-header .nav-auth-outline:active {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.75) !important;
  color: #ffffff !important;
  transform: translateY(0);
}

/* =========================================================
   5) LINKS & TEXT
   ========================================================= */
a,
.text-accent,
.link-accent {
  color: var(--hmc-brand-accent);
}
a:hover {
  color: var(--hmc-brand-accent-hover);
  text-decoration: underline;
}
.text-brand,
.text-primary,
.nav-link.active {
  color: var(--hmc-brand-primary) !important;
}

.site-header nav a {
  color: rgba(255, 255, 255, 0.92) !important;
  text-decoration: none;
}
.site-header nav a:hover,
.site-header nav a:focus {
  color: #ffffff !important;
  text-decoration: none;
}
.site-header .btn-outline,
.site-header .btn-outline-light {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  background-color: transparent !important;
}
.site-header .btn-outline:hover,
.site-header .btn-outline-light:hover,
.site-header .btn-outline:focus,
.site-header .btn-outline-light:focus {
  background-color: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}
.site-header .btn-outline .text-brand\/40,
.site-header .btn-outline-light .text-brand\/40 {
  color: rgba(255, 255, 255, 0.65) !important;
}
.site-header #ops-bell {
  color: #ffffff !important;
}

/* =========================================================
   6) FLOATING / CHAT BUTTONS
   ========================================================= */
.btn-floating,
.btn-float,
.fab-button {
  background-color: var(--hmc-brand-accent) !important;
  border: 1px solid var(--hmc-brand-accent) !important;
  color: #fff !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 20px rgba(140, 46, 110, 0.35) !important;
}
.btn-floating:hover,
.btn-float:hover {
  background-color: var(--hmc-brand-accent-hover) !important;
  transform: translateY(-2px);
}

/* =========================================================
   7) SURFACES / CARDS
   ========================================================= */
.card,
.dropdown-menu,
.modal-content,
.list-group-item {
  border-radius: 12px;
  border: 1px solid var(--hmc-brand-border);
  box-shadow: var(--hmc-shadow-sm);
  background-color: #fff;
}

.card-hmc {
  background: #fff;
  border: 1px solid var(--hmc-brand-border);
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  padding: 1.5rem;
}

/* Inputs */
.form-control:focus,
.form-select:focus {
  border-color: var(--hmc-brand-accent) !important;
  box-shadow: 0 0 0 3px rgba(140,46,110,.12) !important;
}

input,
select,
textarea,
.form-control,
.form-select {
  background: #fff;
  border: 1px solid var(--hmc-brand-border);
  color: var(--hmc-brand-text);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--hmc-brand-primary);
  box-shadow: 0 0 0 3px rgba(47,71,56,0.18);
  outline: none;
  background: #fff;
}

/* =========================================================
   8) BADGES / ALERTS
   ========================================================= */
.badge-primary,
.badge-success,
.badge-info {
  background-color: var(--hmc-brand-accent) !important;
  color: #fff !important;
  border-radius: 999px !important;
  border: none !important;
}
.badge-hmc-accent {
  background-color: var(--hmc-brand-accent) !important;
  color: #fff !important;
  border-radius: 999px !important;
  border: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
}
.alert {
  border-radius: 12px !important;
  border: 1px solid rgba(47, 71, 56, 0.12) !important;
  background-color: rgba(47, 71, 56, 0.04) !important;
  color: var(--hmc-brand-text) !important;
}
.alert-danger {
  background-color: rgba(194, 64, 53, .08) !important;
  border: 1px solid rgba(194, 64, 53, .35) !important;
  color: #8C2E6E !important;
}

/* =========================================================
   9) Tailwind colour normalisation (legacy templates)
   ========================================================= */
.bg-indigo-600,
.bg-slate-900,
.hover\:bg-indigo-700:hover,
.hover\:bg-slate-700:hover,
.hover\:bg-emerald-100:hover {
  background-color: var(--hmc-brand-primary-hover) !important;
}
.text-slate-900,
.text-slate-700,
.text-slate-600,
.text-slate-500 {
  color: var(--hmc-brand-text) !important;
}
.border-slate-200,
.border-slate-100 {
  border-color: var(--hmc-brand-border) !important;
}
.bg-slate-50\/70 {
  background: #fff !important;
}

/* =========================================================
   10) OPS order-line polish (CSS-only; no HTMX/template changes)
   ========================================================= */
#order-lines {
  --ops-focus-ring: rgba(140, 46, 110, 0.28);
  --ops-focus-shadow: 0 0 0 2px rgba(140, 46, 110, 0.14), 0 6px 14px rgba(140, 46, 110, 0.10);
  --ops-override-tint: rgba(140, 46, 110, 0.05);
  --ops-override-border: rgba(140, 46, 110, 0.24);
}

/* 1) OPS focus ring (purple tinted, accessible) */
#order-lines :is(input, select, textarea, .input-control):focus-visible,
[data-ops-approve-form] :is(input, select, textarea, .input-control):focus-visible,
[data-ops-action-form] :is(input, select, textarea, .input-control):focus-visible {
  outline: 2px solid var(--ops-focus-ring) !important;
  outline-offset: 1px;
  border-color: rgba(140, 46, 110, 0.42) !important;
  box-shadow: var(--ops-focus-shadow) !important;
}

#order-lines :is(input, select, textarea, .input-control):focus:not(:focus-visible),
[data-ops-approve-form] :is(input, select, textarea, .input-control):focus:not(:focus-visible),
[data-ops-action-form] :is(input, select, textarea, .input-control):focus:not(:focus-visible) {
  outline: none !important;
}

/* 2) Standard OPS pill system (can be reused gradually without template rewrites) */
.ops-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.12rem 0.52rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
}
.ops-pill.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.22);
  color: #047857;
}
.ops-pill.warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.24);
  color: #b45309;
}
.ops-pill.danger {
  background: rgba(244, 63, 94, 0.10);
  border-color: rgba(244, 63, 94, 0.20);
  color: #be123c;
}
.ops-pill.override {
  background: rgba(140, 46, 110, 0.10);
  border-color: rgba(140, 46, 110, 0.20);
  color: #7a245f;
}

/* Apply pill sizing consistency to current OPS badges without changing markup */
#order-lines [id^="line-status-"] > span:first-child,
#order-lines [data-override-pending-badge],
#order-lines [data-override-applied-badge],
#order-lines [data-override-note-saved-badge],
#order-lines .line-computed .line-pricing-summary > span.inline-flex.items-center.rounded-full {
  border-radius: 999px !important;
  padding: 0.12rem 0.52rem !important;
  font-size: 0.66rem !important;
  font-weight: 700 !important;
  line-height: 1.05 !important;
}

/* Make the top-right "Note saved" badge read like an override metadata pill */
#order-lines [data-override-note-saved-badge] {
  background: rgba(140, 46, 110, 0.09) !important;
  border: 1px solid rgba(140, 46, 110, 0.18) !important;
  color: #7a245f !important;
}

/* 3) Tabular numbers for OPS summary/amount scanning */
#order-lines .line-computed,
#order-lines [id^="line-qty-summary-"],
#order-lines [id^="line-pricing-summary-"],
#order-lines .line-pricing-summary,
#order-lines .tabular-nums {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* 4) Override highlight (active/pending override) */
#order-lines .line-card:has([data-qty-form][data-override-pending]) .line-computed [id^="line-pricing-summary-"],
#order-lines .line-card:has([data-qty-form][data-override-applied]) .line-computed [id^="line-pricing-summary-"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, var(--ops-override-tint) 100%) !important;
  border-color: var(--ops-override-border) !important;
  box-shadow: inset 0 0 0 1px rgba(140, 46, 110, 0.05);
}

/* 5) Emphasize Total */
#order-lines .line-computed .line-pricing-summary > span.font-semibold {
  color: #1f2937 !important;
  font-weight: 700 !important;
}
#order-lines .line-computed .line-pricing-summary > span.font-semibold .tabular-nums {
  color: #111827 !important;
  font-weight: 700 !important;
}
