/* ==========================================================================
   أكادمية هيكا — شريط المعاينة التسويقي القابل للطيّ، قائمة الأدوار، وتنسيق القوائم
   ========================================================================== */

:root {
  --hk-mkt-bar-height: 64px;
}

body.hk-mkt-collapsed {
  --hk-mkt-bar-height: 0px !important;
}

body {
  padding-top: var(--hk-mkt-bar-height) !important;
  transition: padding-top 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Offset sticky headers inside website & workspace shells so they sit cleanly below the fixed marketing bar */
.ec-web-header,
.ec-topbar {
  top: var(--hk-mkt-bar-height) !important;
  transition: top 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 801px) {
  .ec-sidebar {
    top: var(--hk-mkt-bar-height) !important;
    min-height: calc(100vh - var(--hk-mkt-bar-height)) !important;
    transition: top 0.24s cubic-bezier(0.22, 1, 0.36, 1), min-height 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* ==========================================================================
   تحسين المسافات بين الأيقونات والنصوص في جميع القوائم وقائمة التحكم الجانبية
   ========================================================================== */

.ec-sidebar .ec-nav-link,
.ec-admin-sidebar .ec-nav-link {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 11px 16px !important;
  margin-bottom: 5px !important;
  border-radius: 11px !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
}

.ec-sidebar .ec-nav-link .ec-icon,
.ec-admin-sidebar .ec-nav-link .ec-icon {
  width: 19px !important;
  height: 19px !important;
  flex-shrink: 0 !important;
}

.ec-sidebar .ec-nav-label,
.ec-admin-sidebar .ec-nav-label {
  padding: 15px 16px 7px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px;
}

.ec-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
}

.ec-btn .ec-icon,
.ec-text-link .ec-icon {
  flex-shrink: 0;
}

.ec-text-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 9px !important;
}

.ec-course-meta span,
.ec-hero-proof span,
.ec-sales-lesson > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ec-checklist li {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
}

.ec-setup-link {
  gap: 16px !important;
}

.ec-editor-lesson > summary > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ec-editor-lesson > summary .ec-icon {
  margin-inline-end: 10px !important;
}

/* Same-document View Transitions with reduced-motion guard */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 180ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after,
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   الشريط التسويقي العلوي الثابت + خاصية الطيّ والفتح السلس
   ========================================================================== */

.hk-mkt-bar {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 950;
  min-height: 64px;
  background: linear-gradient(135deg, #131c1a 0%, #1d2b27 55%, #162420 100%);
  color: #f6f5f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 28px rgba(10, 16, 14, 0.28);
  font-family: var(--ec-font, "Tahoma", "Segoe UI", system-ui, sans-serif);
  display: flex;
  align-items: center;
  padding: 8px 18px;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

body.hk-mkt-collapsed .hk-mkt-bar {
  transform: translateY(-108%);
  opacity: 0;
  pointer-events: none;
}

/* الشريط العائم الصغير لفتح الهيدر التسويقي عند طيّه */
.hk-mkt-expand-tab {
  position: fixed;
  top: 0;
  inset-inline-start: 24px;
  z-index: 955;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #131c1a 0%, #1f302b 100%);
  color: #ffffff;
  padding: 6px 14px 8px;
  border-radius: 0 0 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

body.hk-mkt-collapsed .hk-mkt-expand-tab {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.hk-mkt-expand-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 2px 6px;
}

.hk-mkt-expand-btn:hover {
  color: #86efac;
}

.hk-mkt-expand-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #16a34a;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.hk-mkt-bar__inner {
  width: 100%;
  max-width: 1580px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Brand & Live Badge */
.hk-mkt-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.hk-mkt-brand__dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.22);
  flex-shrink: 0;
}

.hk-mkt-brand__tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  color: #d8e6df;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Role Switcher Cluster */
.hk-mkt-roles-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hk-mkt-role-pills {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}

.hk-mkt-role-pill {
  appearance: none;
  border: 0;
  background: transparent;
  color: #d4ddd9;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.hk-mkt-role-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.hk-mkt-role-pill[aria-pressed="true"] {
  background: var(--ec-primary, #bc5334);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.hk-mkt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

/* Dropdown Trigger Button */
.hk-mkt-trigger {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.hk-mkt-trigger:hover,
.hk-mkt-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.42);
}

.hk-mkt-trigger__badge {
  background: #eab308;
  color: #18181b;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}

/* Center/Right Utility Controls */
.hk-mkt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hk-mkt-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
  font: inherit;
  font-size: 0.79rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hk-mkt-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.hk-mkt-collapse-btn {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
}

.hk-mkt-select {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font: inherit;
  font-size: 0.79rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.hk-mkt-select option {
  background: #1a2421;
  color: #ffffff;
}

/* Temporary Save Indicator Pill */
.hk-mkt-save-btn {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(16, 185, 129, 0.14);
  color: #a7f3d0;
}

.hk-mkt-save-btn:hover {
  background: rgba(16, 185, 129, 0.24);
  color: #ecfdf5;
}

/* Prominent WhatsApp CTA Button */
.hk-mkt-whatsapp {
  appearance: none;
  border: 1px solid rgba(74, 222, 128, 0.5);
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff !important;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.hk-mkt-whatsapp:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.5);
}

.hk-mkt-whatsapp svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex-shrink: 0;
}

.hk-mkt-whatsapp__num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.22);
  padding: 2px 8px;
  border-radius: 999px;
  direction: ltr;
  unicode-bidi: embed;
}

/* ==========================================================================
   Viewport-Aware Top-Layer Popover Dropdowns (Mega Scenarios & Save Manager)
   ========================================================================== */

.hk-mkt-popover {
  position: fixed;
  inset: auto;
  top: calc(var(--hk-mkt-bar-height) + 8px);
  inset-inline: 16px;
  max-width: 1340px;
  max-height: calc(100dvh - var(--hk-mkt-bar-height) - 24px);
  margin-inline: auto;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #17221f;
  color: #f5f5f0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow-y: auto;
  z-index: 980;
  display: none;
}

.hk-mkt-popover:is(:popover-open, .\:popover-open, .is-open) {
  display: block;
}

.hk-mkt-popover--compact {
  max-width: 480px;
  inset-inline-start: auto;
  inset-inline-end: 16px;
}

.hk-mkt-popover__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.hk-mkt-popover__head h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  color: #ffffff;
}

.hk-mkt-popover__head p {
  margin: 0;
  font-size: 0.86rem;
  color: #b9c8c2;
}

.hk-mkt-close {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

/* 4-Role Scenarios Grid inside the Mega Dropdown */
.hk-mkt-role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1180px) {
  .hk-mkt-role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .hk-mkt-role-grid {
    grid-template-columns: 1fr;
  }
}

.hk-mkt-role-col {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.hk-mkt-role-col.is-active {
  border-color: var(--ec-primary, #bc5334);
  background: rgba(188, 83, 52, 0.11);
}

.hk-mkt-role-col__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hk-mkt-role-col__title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hk-mkt-role-col__status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  white-space: nowrap;
}

.hk-mkt-role-col.is-active .hk-mkt-role-col__status {
  background: #22c55e;
  color: #052e16;
}

.hk-mkt-role-col__desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #b8c7c0;
}

.hk-mkt-scenario-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hk-mkt-scenario-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #ecf0ee;
  text-decoration: none;
  font-size: 0.81rem;
  font-weight: 600;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.hk-mkt-scenario-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hk-mkt-scenario-icon {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.92rem;
}

.hk-mkt-scenario-link:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateX(-2px);
}

[dir="ltr"] .hk-mkt-scenario-link:hover {
  transform: translateX(2px);
}

.hk-mkt-scenario-link small {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mega Dropdown Footer */
.hk-mkt-popover__foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hk-mkt-doc-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Dialog Light-Dismiss Styling & Feature Tour */
.hk-tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.hk-tour-card {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--ec-border, rgba(0, 0, 0, 0.1));
  background: var(--ec-surface, #ffffff);
}

.hk-tour-card h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.hk-tour-card p {
  margin: 0;
  font-size: 0.83rem;
  opacity: 0.85;
}

/* ==========================================================================
   إصلاحات شاملة للتباعد، صفحة الحساب، البطاقات، ومنع التصاق العناصر في كافة الصفحات
   ========================================================================== */

/* 1. تحويل .ec-stack إلى حاوية عمودية مرنة حقيقية لمنع التصاق الأزرار أو النصوص المتجاورة */
.ec-stack {
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
}

.ec-stack > * + * {
  margin-top: 0 !important;
}

.ec-stack > :where(.ec-btn, .ec-badge, .ec-text-link):not(.ec-btn-full) {
  align-self: flex-start;
}

/* 2. تنسيق صفحة الحساب (حسابك في الأكاديمية) لمنع التصاق الروابط والأزرار */
.hk-account-panel {
  gap: 20px !important;
}

.hk-account-actions-primary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.hk-account-actions-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--ec-border);
  width: 100%;
}

.hk-account-links-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hk-account-pill-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 15px;
  border-radius: 9px;
  background: var(--ec-surface-alt);
  border: 1px solid var(--ec-border);
  color: var(--ec-text) !important;
  font-size: 12.5px;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.hk-account-pill-link:hover {
  border-color: var(--ec-primary);
  color: var(--ec-primary) !important;
  background: var(--ec-primary-soft);
}

.hk-account-logout-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 15px;
  border-radius: 9px;
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.25);
  color: #dc2626 !important;
  font-size: 12.5px;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.hk-account-logout-link:hover {
  background: rgba(185, 28, 28, 0.15);
  border-color: rgba(185, 28, 28, 0.45);
}

[data-theme="shadow"] .hk-account-logout-link {
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.32);
}

/* 3. ضمان التباعد في كافة صفوف الإجراءات والفلاتر والشارات في جميع الصفحات */
.ec-inline,
.ec-row-actions {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
}

.hk-order-head-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ec-filters > label,
.ec-video-caption label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ec-radio {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* حماية إضافية: منع التصاق أي زرين أو رابطين متجاورين داخل أي حاوية عادية */
:where(p, div, section, article, aside, td):not(.ec-stack, .ec-inline, .ec-row-actions, .hk-mkt-role-pills, .hk-account-actions-primary, .hk-account-links-group) > :where(.ec-btn, .ec-text-link, .ec-badge) + :where(.ec-btn, .ec-text-link, .ec-badge) {
  margin-inline-start: 12px;
}

/* ضمان تباعد العناصر داخل بطاقات الحالات الفارغة والصفحات الجانبية */
.ec-empty > * + * {
  margin-top: 14px;
}

.ec-sales-grid > aside.ec-card > * + * {
  margin-top: 14px;
}

@media print {
  .hk-mkt-bar,
  .hk-mkt-expand-tab,
  .hk-mkt-popover {
    display: none !important;
  }
  body {
    padding-top: 0 !important;
  }
}
