/* ============================================================
   BeHonest v3 — App-style CSS
   Mobile-first, Instagram-feel, React-like experience
   Colors: #28C0B8 (primary), Facebook blue, white, dark
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/* ── Anti-Flash: تطبيق فوري قبل تحميل JS ── */
/* هاد السيلكتور بيشتغل بمجرد ما الـ inline script يحط dark-mode على html */
html.dark-mode,
html.dark-mode body {
  background: #14161e !important;
  color: #e8eaed !important;
  color-scheme: dark;
}

/* ── CSS Variables ── */
:root {
  --bh-primary:       #28C0B8;
  --bh-primary-dark:  #1da399;
  --bh-primary-light: #e0f7f6;
  --bh-primary-glow:  rgba(40,192,184,0.25);
  --bh-fb:            #1877F2;
  --bh-fb-dark:       #0d65d9;
  --bh-ig-start:      #833ab4;
  --bh-ig-mid:        #fd1d1d;
  --bh-ig-end:        #fcb045;
  --bh-gradient:      linear-gradient(135deg, #28C0B8 0%, #1877F2 100%);
  --bh-gradient-ig:   linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  --bh-dark:          #0f1117;
  --bh-dark2:         #1a1d27;
  --bh-surface:       #ffffff;
  --bh-surface2:      #f5f7fa;
  --bh-border:        #e8eaed;
  --bh-text:          #1a1d27;
  --bh-text2:         #5f6368;
  --bh-text3:         #9aa0a6;
  --bh-success:       #00b894;
  --bh-warning:       #fdcb6e;
  --bh-danger:        #e17055;
  --bh-radius:        16px;
  --bh-radius-sm:     10px;
  --bh-radius-lg:     24px;
  --bh-shadow:        0 2px 16px rgba(0,0,0,0.08);
  --bh-shadow-lg:     0 8px 32px rgba(0,0,0,0.12);
  --bh-nav-h:         60px;
  --bh-bottom-h:      64px;
  --bh-font:          'Cairo', 'Tajawal', sans-serif;
  --bh-transition:    cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--bh-font);
  background: var(--bh-surface2);
  color: var(--bh-text);
  direction: rtl;
  text-align: right;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow: visible;
}

/* Push content below fixed nav */
main {
  padding-top: var(--bh-nav-h, 60px) !important;
  padding-bottom: calc(var(--bh-bottom-h, 64px) + max(env(safe-area-inset-bottom, 0px), 8px) + 16px) !important;
  min-height: 100vh;
}

/* ── TOP NAV BAR (App-style) ── */
.bh-navbar {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  width: 100% !important;
  height: var(--bh-nav-h) !important;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--bh-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 99990 !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.bh-navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.bh-navbar-logo {
  height: 34px;
  width: auto;
}
.bh-navbar-title {
  font-size: 1.15rem;
  font-weight: 800;
  background: var(--bh-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bh-navbar-v {
  font-size: 0.55rem;
  font-weight: 700;
  background: var(--bh-gradient);
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  padding: 2px 6px;
  border-radius: 20px;
}

.bh-navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bh-nav-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--bh-text);
  font-size: 1.1rem;
  transition: background 0.2s var(--bh-transition);
  text-decoration: none;
}
.bh-nav-icon-btn:hover, .bh-nav-icon-btn:active {
  background: var(--bh-surface2);
  color: var(--bh-primary);
}
.bh-nav-badge {
  position: absolute;
  top: 4px; left: 4px;
  min-width: 16px; height: 16px;
  background: var(--bh-danger);
  border-radius: 10px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bh-surface);
  line-height: 1;
}

.bh-nav-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bh-primary);
  cursor: pointer;
}
body.admin-bar header.bh-navbar {
    margin-top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar header.bh-navbar {
        margin-top: 46px;
    }
}

/* ── BOTTOM NAV BAR ── */
.bh-bottom-nav {
  position: fixed !important;
  bottom: 0 !important; left: 0 !important; right: 0 !important;
  width: 100% !important;
  height: auto !important;
  min-height: var(--bh-bottom-h) !important;
  background: var(--bh-surface) !important;
  border-top: 1px solid var(--bh-border);
  display: flex !important;
  align-items: center;
  justify-content: space-around;
  z-index: 99980 !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 8px;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px) !important;
  box-shadow: 0 -1px 0 var(--bh-border), 0 -4px 20px rgba(0,0,0,.1);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}

.bh-bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--bh-text3);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: var(--bh-radius-sm);
  transition: color 0.2s var(--bh-transition);
  position: relative;
  cursor: pointer;
  background: none; border: none;
}
.bh-bnav-item i {
  font-size: 1.3rem;
  transition: transform 0.2s var(--bh-transition);
}
.bh-bnav-item.active {
  color: var(--bh-primary);
}
.bh-bnav-item.active i {
  transform: translateY(-2px);
}
.bh-bnav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 16px; height: 16px;
  background: var(--bh-danger);
  border-radius: 10px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bh-surface);
}

/* Active indicator dot */
.bh-bnav-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--bh-primary);
}

/* ── FAB (Compose/Send) button ── */
.bh-fab {
  position: fixed;
  bottom: calc(var(--bh-bottom-h) + 20px);
  left: 20px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--bh-gradient);
  color: #fff;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--bh-primary-glow);
  border: none; cursor: pointer;
  z-index: 900;
  transition: transform 0.2s var(--bh-transition), box-shadow 0.2s;
  text-decoration: none;
}
.bh-fab:hover, .bh-fab:active {
  transform: scale(1.1);
  box-shadow: 0 8px 28px var(--bh-primary-glow);
  color: #fff;
}

/* ── PAGE CONTAINER ── */
.bh-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 12px;
}

/* ── CARDS ── */
.bh-card {
  background: var(--bh-surface);
  border-radius: var(--bh-radius);
  box-shadow: var(--bh-shadow);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--bh-border);
  transition: box-shadow 0.2s var(--bh-transition), transform 0.15s var(--bh-transition);
}
.bh-card:active {
  transform: scale(0.99);
  box-shadow: var(--bh-shadow-lg);
}
.bh-card-body {
  padding: 16px;
}
.bh-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bh-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── PROFILE HERO ── */
.bh-profile-hero {
  background: var(--bh-surface);
  border-radius: var(--bh-radius-lg);
  padding: 24px 16px 16px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--bh-shadow);
  border: 1px solid var(--bh-border);
  position: relative;
  overflow: hidden;
}
.bh-profile-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80px;
  background: var(--bh-gradient);
  opacity: 0.08;
}

.bh-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}
.bh-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bh-surface);
  box-shadow: 0 0 0 3px var(--bh-primary), var(--bh-shadow);
  display: block;
}
.bh-avatar-edit {
  position: absolute;
  bottom: 0; right: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bh-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  text-decoration: none;
  border: 2px solid var(--bh-surface);
  transition: transform 0.2s var(--bh-transition);
}
.bh-avatar-edit:hover { transform: scale(1.15); color: #fff; }

.bh-profile-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--bh-text);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.bh-premium-icon {
  color: #f4a01f;
  font-size: 1rem;
}

/* Link copy bar */
.bh-link-bar {
  display: flex;
  align-items: center;
  background: var(--bh-surface2);
  border: 1px solid var(--bh-border);
  border-radius: 12px;
  padding: 6px 10px 6px 6px;
  margin-top: 14px;
  gap: 8px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.bh-link-bar-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--bh-font);
  font-size: 0.8rem;
  color: var(--bh-text2);
  text-align: center;
  direction: ltr;
  min-width: 0;
}
.bh-link-bar-btn {
  background: var(--bh-gradient);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--bh-font);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.bh-link-bar-btn:active { opacity: 0.8; }

/* Stats row */
.bh-stats-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--bh-border);
}
.bh-stat {
  text-align: center;
}
.bh-stat-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--bh-text);
}
.bh-stat-label {
  font-size: 0.72rem;
  color: var(--bh-text3);
  font-weight: 500;
}

/* ── TABS (App-style) ── */
.bh-tabs {
  display: flex;
  background: var(--bh-surface);
  border-radius: var(--bh-radius);
  margin-bottom: 16px;
  padding: 4px;
  gap: 4px;
  box-shadow: var(--bh-shadow);
  border: 1px solid var(--bh-border);
  position: sticky;
  top: calc(var(--bh-nav-h) + 8px);
  z-index: 100;
}
.bh-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-family: var(--bh-font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--bh-text3);
  cursor: pointer;
  transition: all 0.25s var(--bh-transition);
  position: relative;
  white-space: nowrap;
}
.bh-tab-btn.active {
  background: var(--bh-primary-light);
  color: var(--bh-primary);
  font-weight: 700;
}
.bh-tab-btn.active-fav {
  background: #fff8e6;
  color: #c8840a;
}
.bh-tab-btn.active-sent {
  background: #e6f9f2;
  color: #007a56;
}
.bh-tab-count {
  min-width: 20px; height: 20px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  background: var(--bh-border);
  color: var(--bh-text3);
  line-height: 1;
}
.bh-tab-btn.active .bh-tab-count {
  background: var(--bh-primary);
  color: #fff;
}
.bh-tab-btn.active-fav .bh-tab-count {
  background: #f4a01f;
  color: #fff;
}
.bh-tab-btn.active-sent .bh-tab-count {
  background: var(--bh-success);
  color: #fff;
}

/* ── SKELETON SCREEN ── */
.bh-skeleton {
  border-radius: var(--bh-radius);
  background: linear-gradient(90deg, var(--bh-border) 25%, #f0f0f0 50%, var(--bh-border) 75%);
  background-size: 200% 100%;
  animation: bh-shimmer 1.4s infinite;
}
@keyframes bh-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.bh-skeleton-card {
  background: var(--bh-surface);
  border-radius: var(--bh-radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--bh-border);
}
.bh-sk-line { border-radius: 6px; margin-bottom: 8px; }
.bh-sk-avatar { border-radius: 50%; }
.bh-sk-btn { border-radius: 8px; }

/* ── MESSAGE CARD ── */
.bh-msg-card {
  background: var(--bh-surface);
  border-radius: var(--bh-radius);
  border: 1px solid var(--bh-border);
  margin-bottom: 10px;
  overflow: hidden;
  transition: all 0.25s var(--bh-transition);
  animation: bh-fadein 0.35s var(--bh-transition) both;
}
@keyframes bh-fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bh-msg-card:active { transform: scale(0.99); }
.bh-msg-card.deleting {
  opacity: 0;
  transform: translateX(-30px);
  pointer-events: none;
}
.bh-msg-card.new-msg {
  border-right: 3px solid var(--bh-primary);
  background: linear-gradient(to left, var(--bh-surface), var(--bh-primary-light));
}

.bh-msg-body {
  padding: 14px 16px 10px;
}
.bh-msg-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--bh-text);
  line-height: 1.7;
  margin-bottom: 0;
  word-break: break-word;
}
.bh-msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--bh-border);
  background: var(--bh-surface2);
}
.bh-msg-time {
  font-size: 0.72rem;
  color: var(--bh-text3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.bh-msg-actions {
  display: flex;
  gap: 4px;
}
.bh-msg-action-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--bh-border);
  background: var(--bh-surface);
  cursor: pointer;
  font-size: 1rem;
  color: var(--bh-text2);
  transition: all 0.2s var(--bh-transition);
  flex-shrink: 0;
}
.bh-msg-action-btn:hover  { border-color: var(--bh-primary); color: var(--bh-primary); background: var(--bh-primary-light); }
.bh-msg-action-btn:active { transform: scale(0.92); }
.bh-msg-action-btn.fav-active { color: #f4a01f; border-color: #f4a01f; background: #fff8e6; }
.bh-msg-action-btn.delete     { color: var(--bh-danger);    border-color: rgba(225,112,85,.3); }
.bh-msg-action-btn.delete:hover { background: #fde8e8; border-color: var(--bh-danger); }
.bh-msg-action-btn.share      { color: #c13584;            border-color: rgba(193,53,132,.3); }
.bh-msg-action-btn.share:hover  { background: #fdf0f8; border-color: #c13584; }
.bh-msg-action-btn.reply      { color: var(--bh-primary);  border-color: rgba(40,192,184,.3); }
.bh-msg-action-btn.reply:hover  { background: var(--bh-primary-light); border-color: var(--bh-primary); }
.bh-msg-action-btn.download   { color: var(--bh-fb);       border-color: rgba(24,119,242,.3); }
.bh-msg-action-btn.download:hover { background: #e8f0fe; border-color: var(--bh-fb); }

/* Sent message card: show receiver */
.bh-msg-receiver {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bh-surface2);
  border-bottom: 1px solid var(--bh-border);
  font-size: 0.78rem;
  color: var(--bh-text2);
}
.bh-msg-receiver-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

/* ── LOAD MORE / END ── */
.bh-load-more {
  text-align: center;
  padding: 20px 0;
}
.bh-load-more-btn {
  background: var(--bh-surface);
  border: 1.5px solid var(--bh-primary);
  color: var(--bh-primary);
  border-radius: 12px;
  padding: 10px 28px;
  font-family: var(--bh-font);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--bh-transition);
}
.bh-load-more-btn:hover {
  background: var(--bh-primary-light);
}
.bh-all-loaded {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--bh-text3);
  font-size: 0.82rem;
  padding: 16px 0 24px;
}
.bh-all-loaded i { color: var(--bh-success); }

/* ── SPINNER ── */
.bh-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--bh-border);
  border-top-color: var(--bh-primary);
  border-radius: 50%;
  animation: bh-spin 0.7s linear infinite;
  margin: 0 auto;
}
@keyframes bh-spin {
  to { transform: rotate(360deg); }
}
.bh-loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--bh-text3);
  font-size: 0.85rem;
}

/* ── EMPTY STATE ── */
.bh-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 20px;
  text-align: center;
}
.bh-empty-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--bh-surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  color: var(--bh-text3);
}
.bh-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--bh-text);
  margin: 0;
}
.bh-empty-desc {
  font-size: 0.82rem;
  color: var(--bh-text3);
  margin: 0;
}

/* ── TOAST NOTIFICATIONS ── */
.bh-toasts {
  position: fixed !important;
  bottom: calc(var(--bh-bottom-h) + max(env(safe-area-inset-bottom, 0px), 8px) + 6px) !important;
  left: 12px !important;
  right: 12px !important;
  z-index: 99995 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100% - 24px) !important;
  pointer-events: none;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.bh-toast {
  background: var(--bh-dark);
  color: #fff;
  border-radius: var(--bh-radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--bh-shadow-lg);
  pointer-events: all;
  animation: bh-toast-in 0.3s var(--bh-transition) both;
  max-width: 100%;
}
@keyframes bh-toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.bh-toast.out {
  animation: bh-toast-out 0.3s var(--bh-transition) both;
}
@keyframes bh-toast-out {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}
.bh-toast.success .bh-toast-icon { color: var(--bh-success); }
.bh-toast.danger  .bh-toast-icon { color: var(--bh-danger); }
.bh-toast.info    .bh-toast-icon { color: var(--bh-primary); }
.bh-toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.bh-toast-msg { flex: 1; }

/* ── INLINE ALERT (telegram) ── */
.bh-alert-tg {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--bh-radius-sm);
  padding: 12px 14px;
  margin: 8px 12px 0;
  font-size: 0.85rem;
  color: var(--bh-text);
}
.bh-alert-tg i { color: #0088cc; font-size: 1.1rem; flex-shrink: 0; }
.bh-alert-tg a { color: var(--bh-primary); font-weight: 700; }
.bh-alert-tg-close {
  margin-right: auto;
  background: none; border: none;
  cursor: pointer; padding: 0; color: var(--bh-text3);
  font-size: 1rem;
}

/* ── STORY / SHARE MODAL ── */
.bh-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 2147483646 !important;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: bh-backdrop-in 0.25s ease;
  padding: 0;
}

@keyframes bh-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bh-sheet {
  position: relative;
  z-index: 2147483647 !important;
  background: var(--bh-surface);
  border-radius: 24px 24px 0 0 !important;
  width: 100%;
  max-width: 540px;
  max-height: 90vh !important;
  overflow-y: auto !important;
  animation: bh-sheet-up 0.35s var(--bh-transition);
  padding: 0 0 max(env(safe-area-inset-bottom, 0px), 16px) !important;
}

@keyframes bh-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.bh-sheet-handle {
  width: 40px; height: 4px;
  background: var(--bh-border);
  border-radius: 2px;
  margin: 12px auto 0;
}
.bh-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--bh-border);
}
.bh-sheet-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--bh-text);
  display: flex; align-items: center; gap: 8px;
}
.bh-sheet-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bh-surface2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--bh-text2);
}
.bh-sheet-body {
  padding: 16px 20px;
}

/* Story style swatches */
.bh-style-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.bh-swatch {
  width: 42px; height: 42px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 3px solid transparent;
  flex-shrink: 0;
}
.bh-swatch.active {
  transform: scale(1.12);
  border-color: var(--bh-text);
  box-shadow: 0 0 0 2px var(--bh-surface), 0 0 0 4px var(--bh-text);
}

/* Story card preview (portrait) */
.bh-story-preview {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 9/16;
  border-radius: 16px;
  margin: 0 auto 16px;
  overflow: hidden;
  box-shadow: var(--bh-shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
}
.bh-sc-inner {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
}
.bh-sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: auto;
}
.bh-sc-site-name {
  color: rgba(255,255,255,0.9);
  font-weight: 800;
  font-size: 0.9rem;
}
.bh-sc-anon-badge {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 700;
}
.bh-sc-msg-bubble {
  border-radius: 18px;
  overflow: hidden;
  margin: 12px 0;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(0,0,0,0.18);
}
.bh-sc-msgbox-header {
  min-height: 88px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(160deg,#28C0B8,#1877F2);
}
.bh-sc-msgbox-title {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.35;
  direction: rtl;
}
.bh-sc-msgbox-body {
  background: #f2f2f2;
  padding: 18px 16px 20px;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.bh-sc-msg-text {
  color: #111;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.55;
  text-align: center;
  direction: rtl;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bh-sc-footer {
  text-align: center;
  margin-top: auto;
}
.bh-sc-cta {
  color: rgba(255,255,255,0.9);
  font-weight: 700;
  font-size: 0.8rem;
  display: block;
}
.bh-sc-link {
  color: rgba(255,255,255,0.65);
  font-size: 0.72rem;
  direction: ltr;
}

/* Share action buttons */
.bh-share-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bh-share-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  padding: 10px 14px;
  border: none;
  font-family: var(--bh-font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.bh-share-btn:active { opacity: 0.8; }
.bh-share-btn-ig {
  background: var(--bh-gradient-ig);
  color: #fff;
}
.bh-share-btn-dl {
  background: var(--bh-gradient);
  color: #fff;
}
.bh-share-btn-link {
  background: var(--bh-surface2);
  color: var(--bh-text);
  border: 1px solid var(--bh-border);
}

/* ── REPLY MODAL ── */
/* Reply modal - hidden by default, JS sets display:flex to open */
.bh-reply-modal,
#bh-reply-modal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.65) !important;
  z-index: 99970 !important;
  display: none !important;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 !important;
}
.bh-reply-box {
  background: var(--bh-surface);
  border-radius: var(--bh-radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--bh-shadow-lg);
}
.bh-reply-orig {
  background: var(--bh-surface2);
  border-radius: var(--bh-radius-sm);
  border-right: 3px solid var(--bh-primary);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--bh-text2);
  margin-bottom: 14px;
  max-height: 80px;
  overflow-y: auto;
}
.bh-textarea {
  width: 100%;
  border: 1.5px solid var(--bh-border);
  border-radius: var(--bh-radius-sm);
  padding: 12px 14px;
  font-family: var(--bh-font);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.bh-textarea:focus { border-color: var(--bh-primary); }

/* ── BUTTONS ── */
.bh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  border-radius: 12px;
  padding: 10px 20px;
  font-family: var(--bh-font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s var(--bh-transition);
  text-decoration: none;
}
.bh-btn:active { transform: scale(0.97); }
.bh-btn-primary {
  background: var(--bh-gradient);
  color: #fff;
  box-shadow: 0 4px 14px var(--bh-primary-glow);
}
.bh-btn-primary:hover { color: #fff; opacity: 0.92; }
.bh-btn-ghost {
  background: transparent;
  color: var(--bh-text2);
  border: 1.5px solid var(--bh-border);
}
.bh-btn-ghost:hover { background: var(--bh-surface2); }
.bh-btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
  border-radius: 10px;
}

/* ── SEND MESSAGE PAGE (profile) ── */
.bh-send-hero {
  background: var(--bh-surface);
  border-radius: var(--bh-radius-lg);
  padding: 32px 20px 24px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--bh-shadow);
  border: 1px solid var(--bh-border);
  position: relative;
  overflow: hidden;
}
.bh-send-hero-bg {
  position: absolute; top: 0; left: 0; right: 0; height: 100px;
  background: var(--bh-gradient);
  opacity: 0.07;
  pointer-events: none;
}

.bh-msg-form-card {
  background: var(--bh-surface);
  border-radius: var(--bh-radius-lg);
  padding: 20px;
  box-shadow: var(--bh-shadow);
  border: 1px solid var(--bh-border);
}
.bh-msg-textarea {
  width: 100%;
  min-height: 120px;
  border: 1.5px solid var(--bh-border);
  border-radius: 14px;
  padding: 14px 16px;
  font-family: var(--bh-font);
  font-size: 0.95rem;
  resize: none;
  outline: none;
  background: var(--bh-surface2);
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 12px;
  display: block;
}
.bh-msg-textarea:focus {
  border-color: var(--bh-primary);
  background: var(--bh-surface);
}

.bh-char-count {
  font-size: 0.75rem;
  color: var(--bh-text3);
  text-align: left;
  direction: ltr;
  margin-bottom: 12px;
  display: block;
}
.bh-char-count.warn { color: var(--bh-danger); }

/* ── AUTH FORMS ── */
.bh-auth-card {
  background: var(--bh-surface);
  border-radius: var(--bh-radius-lg);
  padding: 28px 20px;
  box-shadow: var(--bh-shadow-lg);
  border: 1px solid var(--bh-border);
  max-width: 420px;
  margin: 24px auto;
}
.bh-auth-logo {
  text-align: center;
  margin-bottom: 20px;
}
.bh-auth-logo-icon {
  width: 60px; height: 60px;
  border-radius: 18px;
  background: var(--bh-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin: 0 auto 10px;
  box-shadow: 0 4px 20px var(--bh-primary-glow);
}
.bh-auth-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--bh-text);
  text-align: center;
  margin: 0 0 6px;
}
.bh-auth-sub {
  font-size: 0.82rem;
  color: var(--bh-text3);
  text-align: center;
  margin: 0 0 20px;
}

.bh-input-group {
  margin-bottom: 14px;
}
.bh-input-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--bh-text2);
  margin-bottom: 6px;
  display: block;
}
.bh-input {
  width: 100%;
  border: 1.5px solid var(--bh-border);
  border-radius: 12px;
  padding: 11px 14px;
  font-family: var(--bh-font);
  font-size: 0.9rem;
  outline: none;
  background: var(--bh-surface2);
  transition: border-color 0.2s, background 0.2s;
  color: var(--bh-text);
}
.bh-input:focus {
  border-color: var(--bh-primary);
  background: var(--bh-surface);
}
.bh-input.is-invalid { border-color: var(--bh-danger); }
.bh-input.is-valid   { border-color: var(--bh-success); }
.bh-input-error {
  font-size: 0.75rem;
  color: var(--bh-danger);
  margin-top: 4px;
  display: block;
}

.bh-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--bh-text3); font-size: 0.78rem;
  margin: 16px 0;
}
.bh-divider::before, .bh-divider::after {
  content: ''; flex: 1;
  border-top: 1px solid var(--bh-border);
}

.bh-fb-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  background: var(--bh-fb);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-family: var(--bh-font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.bh-fb-btn:hover { background: var(--bh-fb-dark); color: #fff; }

/* ── FRIENDS PAGE ── */
.bh-friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bh-surface);
  border-radius: var(--bh-radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--bh-border);
  transition: all 0.2s var(--bh-transition);
}
.bh-friend-card:active { transform: scale(0.98); }
.bh-friend-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--bh-border);
}
.bh-friend-info { flex: 1; min-width: 0; }
.bh-friend-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--bh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bh-friend-actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.bh-friend-action-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--bh-border);
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--bh-text2);
  transition: all 0.2s;
}
.bh-friend-action-btn.accept { border-color: var(--bh-success); color: var(--bh-success); }
.bh-friend-action-btn.reject { border-color: var(--bh-danger); color: var(--bh-danger); }
.bh-friend-action-btn:active { transform: scale(0.9); }

/* ── SETTINGS PAGE ── */
.bh-settings-section {
  background: var(--bh-surface);
  border-radius: var(--bh-radius);
  border: 1px solid var(--bh-border);
  overflow: hidden;
  margin-bottom: 16px;
}
.bh-settings-section-title {
  padding: 12px 16px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--bh-text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bh-setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--bh-border);
  cursor: pointer;
  transition: background 0.15s;
}
.bh-setting-row:first-of-type { border-top: none; }
.bh-setting-row:active { background: var(--bh-surface2); }
.bh-setting-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.bh-setting-content { flex: 1; min-width: 0; }
.bh-setting-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bh-text);
}
.bh-setting-desc {
  font-size: 0.75rem;
  color: var(--bh-text3);
  margin-top: 1px;
}
.bh-setting-arrow {
  color: var(--bh-text3);
  font-size: 0.85rem;
}


/* ── PULL TO REFRESH indicator ── */
.bh-ptr {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 0; overflow: hidden;
  transition: height 0.2s;
  color: var(--bh-text3);
  font-size: 0.82rem;
}
.bh-ptr.active { height: 48px; }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .bh-page { padding: 12px 8px; }
  .bh-profile-hero { padding: 20px 12px 14px; }
  .bh-stats-row { gap: 16px; }
  .bh-avatar { width: 76px; height: 76px; }
  .bh-tab-btn { font-size: 0.78rem; padding: 9px 4px; }
  .bh-msg-body { padding: 12px 12px 8px; }
  .bh-msg-text { font-size: 0.9rem; }
}


/* ── DARK MODE — class-based, light is default, never auto ── */
html.dark-mode body,
html.dark-mode {
  --bh-surface:        #1c1e26;
  --bh-surface2:       #14161e;
  --bh-border:         #2c2f3d;
  --bh-text:           #e8eaed;
  --bh-text2:          #9aa0a6;
  --bh-text3:          #5f6368;
  /* override light-tint vars for dark mode */
  --bh-primary-light:  rgba(40,192,184,0.12);
  background: #14161e !important;
}

/* ── Dark mode: action button hover/active tints ── */
html.dark-mode .bh-msg-action-btn:hover        { background: rgba(40,192,184,0.12) !important; }
html.dark-mode .bh-msg-action-btn.fav-active   { background: rgba(244,160,31,0.15) !important; border-color: #f4a01f !important; }
html.dark-mode .bh-msg-action-btn.delete:hover { background: rgba(225,112,85,0.15) !important; }
html.dark-mode .bh-msg-action-btn.share:hover  { background: rgba(193,53,132,0.15) !important; }
html.dark-mode .bh-msg-action-btn.reply:hover  { background: rgba(40,192,184,0.12) !important; }
html.dark-mode .bh-msg-action-btn.download:hover { background: rgba(24,119,242,0.15) !important; }

/* ── Dark mode: tab buttons ── */
html.dark-mode .bh-tab-btn.active      { background: rgba(40,192,184,0.15) !important; }
html.dark-mode .bh-tab-btn.active-fav  { background: rgba(244,160,31,0.15)  !important; color: #f4a01f !important; }
html.dark-mode .bh-tab-btn.active-sent { background: rgba(34,197,94,0.12)   !important; color: #22c55e !important; }

/* ── Dark mode: new-msg card gradient ── */
html.dark-mode .bh-msg-card.new-msg { background: linear-gradient(to left, #1c1e26, rgba(40,192,184,0.08)) !important; }

/* ── Dark mode: inline reply block ── */
html.dark-mode .bh-reply-block { background: rgba(40,192,184,0.10) !important; border-right-color: var(--bh-primary) !important; }
html.dark-mode .bh-navbar {
  background: rgba(28,30,38,0.92) !important;
  border-bottom-color: var(--bh-border);
}
html.dark-mode .bh-bottom-nav {
  background: rgba(28,30,38,0.96) !important;
  border-top-color: var(--bh-border);
}
/* Toggle button */
.bh-theme-toggle {
  background: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  cursor: pointer;
  color: var(--bh-text2);
  font-size: 1.15rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.bh-theme-toggle:hover { background: var(--bh-surface2) !important; color: var(--bh-primary) !important; }
.bh-theme-toggle .bi-sun-fill        { display: none !important; }
.bh-theme-toggle .bi-moon-stars-fill { display: inline-block !important; }
html.dark-mode .bh-theme-toggle .bi-sun-fill        { display: inline-block !important; }
html.dark-mode .bh-theme-toggle .bi-moon-stars-fill { display: none !important; }

/* ── HTML/BODY overflow fix (safe, doesn't break position:fixed) ── */
html { overflow-x: clip !important; }
body { overflow: visible !important; overflow-x: clip !important; }

/* ── Admin bar offsets ── */
body.admin-bar .bh-navbar { top: 32px !important; }
body.admin-bar main { padding-top: calc(var(--bh-nav-h) + 32px) !important; }
@media screen and (max-width:782px) {
  body.admin-bar .bh-navbar { top: 46px !important; }
  body.admin-bar main { padding-top: calc(var(--bh-nav-h) + 46px) !important; }
}

/* ── Desktop: hide bottom nav, reset padding ── */
@media (min-width: 1024px) {
  .bh-bottom-nav { display: none !important; }
  main { padding-bottom: 24px !important; }
}
@media (max-width: 1023px) {
  main {
    padding-bottom: calc(var(--bh-bottom-h) + max(env(safe-area-inset-bottom, 0px), 8px) + 16px) !important;
  }
}

/* ── Desktop toasts ── */
@media (min-width: 1024px) {
  .bh-toasts {
    bottom: 16px !important;
    left: auto !important;
    right: 16px !important;
    max-width: 360px !important;
  }
}

/* ── Z-index overrides ── */
#bh-reply-modal { z-index: 99970 !important; }
.bh-navbar .dropdown-menu { z-index: 99991 !important; position: absolute !important; }

/* ── Reply modal animation ── */
@keyframes bh-modal-pop {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Dark mode adjustments ── */
html.dark-mode .bh-bottom-nav { background: rgba(28,30,38,.98) !important; }
html.dark-mode #bh-reply-box  { background: #1c1e26 !important; }
html.dark-mode .dropdown-menu { background: #1c1e26 !important; border-color: #2c2f3d !important; color: #e8eaed !important; }
html.dark-mode .dropdown-menu .px-3 div { color: #e8eaed !important; }
html.dark-mode .dropdown-item { color: #e8eaed !important; }
html.dark-mode .dropdown-item:hover { background: #2c2f3d !important; color: #fff !important; }
html.dark-mode .dropdown-divider { border-color: #2c2f3d !important; }
html.dark-mode .dropdown-menu .border-bottom { border-color: #2c2f3d !important; }
html.dark-mode .bh-settings-section { background: #1c1e26 !important; border-color: #2c2f3d !important; }
html.dark-mode #bh-notif-panel { background: #1c1e26 !important; border-color: #2c2f3d !important; }
html.dark-mode .bh-alert-tg { background: #1e2435 !important; border-color: #2c3a5a !important; }

/* ── Story card text ── */
.bh-sc-msgbox-body .bh-sc-msg-text { color: #111 !important; }

/* ── Dark mode: textarea & input text color ── */
html.dark-mode .bh-textarea,
html.dark-mode .bh-msg-textarea,
html.dark-mode .bh-input,
html.dark-mode .bh-link-bar-input,
html.dark-mode textarea,
html.dark-mode input[type="text"],
html.dark-mode input[type="email"],
html.dark-mode input[type="password"],
html.dark-mode input[type="search"],
html.dark-mode input[type="tel"],
html.dark-mode input[type="url"],
html.dark-mode input[type="number"] {
  color: #e8eaed !important;
  -webkit-text-fill-color: #e8eaed !important;
}
html.dark-mode .bh-textarea::placeholder,
html.dark-mode .bh-msg-textarea::placeholder,
html.dark-mode .bh-input::placeholder,
html.dark-mode textarea::placeholder,
html.dark-mode input::placeholder {
  color: #5f6368 !important;
  opacity: 1 !important;
}
