/* SB Share – share sheet (product pages). Loaded only when the sheet is enabled. */
.sbshare-sheet {
  --sbshare-accent: #1259ba;
  --sbshare-radius: 7px;
  --sbshare-text: #1f2430;
  --sbshare-muted: #5b6472;
  --sbshare-line: #d6dbe3;
  --sbshare-bg: #ffffff;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  direction: rtl;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.sbshare-sheet[hidden] { display: none; }
.sbshare-sheet-open { overflow: hidden; }

.sbshare-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity .2s ease;
}
.sbshare-sheet.is-open .sbshare-sheet__backdrop { opacity: 1; }

/* ---------- panel: bottom sheet (phones & narrow tablets) ---------- */
.sbshare-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 640px;
  max-height: min(88vh, 88dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--sbshare-bg);
  color: var(--sbshare-text);
  border-radius: var(--sbshare-radius) var(--sbshare-radius) 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
  padding: 6px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
  outline: none;
  box-sizing: border-box;
}
.sbshare-sheet.is-open .sbshare-sheet__panel { transform: translateY(0); }

.sbshare-sheet__grip {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: #c9d0da;
  margin: 4px auto 8px;
}

.sbshare-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.sbshare-sheet__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--sbshare-text);
}
.sbshare-sheet__close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sbshare-line);
  border-radius: var(--sbshare-radius);
  background: #fff;
  color: var(--sbshare-muted);
  cursor: pointer;
  padding: 0;
}
.sbshare-sheet__close svg { width: 18px; height: 18px; }
.sbshare-sheet__close:hover { color: var(--sbshare-accent); border-color: var(--sbshare-accent); }

.sbshare-sheet__product {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--sbshare-line);
  border-radius: var(--sbshare-radius);
  margin-bottom: 10px;
}
.sbshare-sheet__product[hidden] { display: none; }
.sbshare-sheet__thumb {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 5px;
  background: #fff;
}
.sbshare-sheet__meta { min-width: 0; }
.sbshare-sheet__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sbshare-sheet__price {
  font-size: 13px;
  color: var(--sbshare-accent);
  font-weight: 700;
  margin-top: 2px;
  direction: rtl;
}

/* ---------- actions ---------- */
.sbshare-sheet__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.sbshare-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--sbshare-line);
  border-radius: var(--sbshare-radius);
  background: #fff;
  color: var(--sbshare-text);
  text-align: right;
  cursor: pointer;
  font: inherit;
  transition: border-color .15s ease, background-color .15s ease;
}
.sbshare-action:hover,
.sbshare-action:focus-visible {
  border-color: var(--sbshare-accent);
  background: rgba(18, 89, 186, .05);
  outline: none;
}
.sbshare-action.is-busy { opacity: .6; pointer-events: none; }
.sbshare-action__icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--sbshare-radius);
  background: var(--sbshare-accent);
  color: #fff;
}
.sbshare-action__icon svg { width: 20px; height: 20px; }
.sbshare-action__text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.sbshare-action__label { font-size: 14px; font-weight: 600; line-height: 1.4; }
.sbshare-action__hint {
  font-size: 11.5px;
  color: var(--sbshare-muted);
  direction: ltr;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- preview ---------- */
.sbshare-sheet__preview { margin-top: 10px; }
.sbshare-sheet__preview[hidden] { display: none; }
.sbshare-preview {
  border: 1px solid var(--sbshare-line);
  border-radius: var(--sbshare-radius);
  padding: 0 10px;
}
.sbshare-preview__summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--sbshare-muted);
  padding: 9px 0;
  list-style: none;
  user-select: none;
}
.sbshare-preview__summary::-webkit-details-marker { display: none; }
.sbshare-preview__summary::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  margin: 0 2px 2px 8px;
  transition: transform .15s ease;
}
.sbshare-preview[open] .sbshare-preview__summary::before { transform: rotate(-135deg); margin-bottom: -2px; }
.sbshare-preview__text {
  margin: 0 0 10px;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.8;
  background: #f3f5f8;
  border-radius: 5px;
  color: var(--sbshare-text);
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}

/* ---------- social row (reuses the module's network colours) ---------- */
.sbshare-sheet__socials { margin-top: 12px; }
.sbshare-sheet__socials[hidden] { display: none; }
.sbshare-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
.sbshare-socials .sbshare-socials__item {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--sbshare-radius) !important;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  margin: 0 !important;
  float: none !important;
}
.sbshare-socials .sbshare-socials__item i { line-height: 1; }

/* ---------- toast ---------- */
.sbshare-notice {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 2147483647;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 7px;
  background: var(--sbshare-accent, #1259ba);
  color: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  direction: rtl;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  pointer-events: none;
}

/* ---------- very small / low-res phones ---------- */
@media (max-width: 360px) {
  .sbshare-sheet__panel { padding-left: 12px; padding-right: 12px; }
  .sbshare-action { min-height: 48px; gap: 10px; }
  .sbshare-action__icon { width: 32px; height: 32px; }
  .sbshare-action__label { font-size: 13px; }
  .sbshare-sheet__title { font-size: 15px; }
}
@media (max-height: 560px) {
  .sbshare-sheet__product { display: none; }
  .sbshare-sheet__panel { max-height: 96vh; }
}

/* ---------- tablets & desktop (≥768px): centred dialog ---------- */
@media (min-width: 768px) {
  .sbshare-sheet:not(.sbshare-sheet--bottom-desktop) .sbshare-sheet__panel {
    top: 50%;
    bottom: auto;
    left: 50%;
    right: auto;
    width: min(440px, calc(100vw - 48px));
    max-height: min(86vh, 760px);
    border-radius: var(--sbshare-radius);
    padding: 16px 18px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    transform: translate(-50%, -50%) scale(.96);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease;
  }
  .sbshare-sheet:not(.sbshare-sheet--bottom-desktop).is-open .sbshare-sheet__panel {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .sbshare-sheet:not(.sbshare-sheet--bottom-desktop) .sbshare-sheet__grip { display: none; }
  .sbshare-sheet__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sbshare-action { min-height: 56px; }
  .sbshare-sheet__thumb { width: 56px; height: 56px; }
}

/* ---------- large desktop (≥1600px / 4K scaling) ---------- */
@media (min-width: 1600px) {
  .sbshare-sheet:not(.sbshare-sheet--bottom-desktop) .sbshare-sheet__panel { width: 480px; }
  .sbshare-action__label { font-size: 15px; }
  .sbshare-preview__text { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .sbshare-sheet__panel,
  .sbshare-sheet__backdrop { transition: none; }
}
