/* ==========================================================================
   Stories — circular avatar row, full-screen viewer, composer.
   Markup: includes/widgets/stories.php   Behaviour: assets/js/components/stories.js
   ========================================================================== */
.pb-stories { padding: 14px 14px 12px; overflow: hidden; }
.pb-stories .pb-sec-hd { padding: 0 4px; margin-bottom: 12px; }
.pb-stories__row {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 2px 4px;
  scrollbar-width: none; cursor: grab;
}
.pb-stories__row::-webkit-scrollbar { display: none; }
.pb-stories__row.is-dragging { cursor: grabbing; scroll-snap-type: none; }

.pb-story {
  flex: none; width: 86px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  scroll-snap-align: start; border: 0; background: none; padding: 0; color: var(--pb-text);
}
.pb-story__ring {
  position: relative; width: 84px; height: 84px; border-radius: 50%; padding: 3px;
  background: linear-gradient(45deg, #fbb231, #f43f8e);
}
.pb-story--official .pb-story__ring { background: linear-gradient(45deg, #a855f7, #6366f1); }
.pb-story--seen .pb-story__ring { background: #dcd8cc; }
.pb-story__inner { width: 100%; height: 100%; border-radius: 50%; padding: 3px; background: var(--pb-bg); overflow: hidden; }
.pb-story__img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: flex; align-items: center; justify-content: center;
  background: #f4efe2 center / cover no-repeat; color: var(--pb-primary); font-size: 22px;
}
.pb-story__label { max-width: 86px; font-size: 14.5px; color: var(--pb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pb-story--add .pb-story__ring { background: none; border: 2px dashed #d9d4c8; padding: 0; display: flex; align-items: center; justify-content: center; }
.pb-story__plus { width: 40px; height: 40px; border-radius: 50%; background: var(--pb-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.pb-story__badge {
  position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff;
  background: var(--pb-primary); border: 2px solid #fff;
}
.pb-story__badge--official { background: #6366f1; }
.pb-stories__loading { flex: none; width: 86px; height: 110px; display: flex; align-items: center; justify-content: center; color: var(--pb-text-faint); font-size: 20px; }

/* Viewer */
.pb-sv { position: fixed; inset: 0; z-index: 500; display: none; flex-direction: column; background: #000; }
.pb-sv.is-open { display: flex; }
.pb-sv__bars { display: flex; gap: 4px; padding: 12px 12px 0; }
.pb-sv__bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.pb-sv__fill { height: 100%; width: 0; background: #fff; }
.pb-sv__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: #fff; }
.pb-sv__avatar { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #333; display: flex; align-items: center; justify-content: center; }
.pb-sv__avatar img { width: 100%; height: 100%; object-fit: cover; }
.pb-sv__user { font-family: var(--pb-font-head); font-weight: 800; font-size: 15px; }
.pb-sv__time { font-size: 13px; opacity: .7; }
.pb-sv__actions { margin-left: auto; display: flex; gap: 8px; }
.pb-sv__actions button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 15px; }
.pb-sv__body { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.pb-sv__media { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pb-sv__media img, .pb-sv__media video { max-width: 100%; max-height: 100%; object-fit: contain; }
.pb-sv__nav { position: absolute; top: 0; bottom: 0; width: 35%; cursor: pointer; }
.pb-sv__nav--l { left: 0; } .pb-sv__nav--r { right: 0; }
.pb-sv__caption { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); color: #fff; text-align: center; font-size: 15px; min-height: 24px; }

/* Story composer */
.pb-sc { position: fixed; inset: 0; z-index: 210; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 16, 8, .55); }
.pb-sc.is-open { display: flex; }
.pb-sc__box { width: 100%; max-width: 380px; padding: 18px; background: #fff; border-radius: 20px; display: flex; flex-direction: column; gap: 12px; }
.pb-sc__hd { display: flex; align-items: center; justify-content: space-between; font-family: var(--pb-font-head); font-size: 18px; }
.pb-sc__hd button { border: 0; background: none; font-size: 18px; }
.pb-sc__preview img, .pb-sc__preview video { width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; background: #f4f1ea; }
.pb-sc__box input[type=text] { height: 44px; padding: 0 16px; border: 1px solid var(--pb-border-3); border-radius: 22px; outline: 0; }
.pb-sc__box input[type=text]:focus { border-color: var(--pb-primary); }

/* ── Phones: no title/icon, smaller rings, tighter card ─────────────────── */
@media (max-width: 899px) {
  .pb-stories { padding: 10px 10px 8px; border-radius: 14px; }
  .pb-stories .pb-sec-hd { display: none; }
  .pb-stories__row { gap: 8px; padding: 0 2px 2px; }
  .pb-story { width: 64px; gap: 4px; }
  .pb-story__ring { width: 60px; height: 60px; padding: 2px; }
  .pb-story__inner { padding: 2px; }
  .pb-story__img { font-size: 17px; }
  .pb-story__label { max-width: 64px; font-size: 12px; }
  .pb-story__plus { width: 30px; height: 30px; font-size: 14px; }
  .pb-story__badge { width: 19px; height: 19px; font-size: 9px; right: -2px; bottom: -2px; }
  .pb-stories__loading { width: 64px; height: 84px; }
}
