/* =========================================================
   Habbe static — theme & components (pure CSS, no Tailwind)
   Stacks on top of Bootstrap 5.3 RTL
   ========================================================= */
:root {
  --hb-orange: #FF8A00;
  --hb-orange-dark: #E85D04;
  --hb-navy: #17233C;
  --hb-bg: #F4F4F1;
  --hb-card: #FFFFFF;
  --hb-fg: #141414;
  --hb-muted: #ECEAE4;
  --hb-muted-fg: #6B6B66;
  --hb-border: #E2E0DA;
  --hb-radius: 1rem;
  --hb-font: 'Vazirmatn', 'Inter', Tahoma, sans-serif;
}
[data-bs-theme="dark"] {
  --hb-bg: #0D1117;
  --hb-card: #161B22;
  --hb-fg: #F2F2F2;
  --hb-muted: #1C2330;
  --hb-muted-fg: #9AA4B2;
  --hb-border: #232A36;
}

html { scroll-behavior: smooth; }
body {
  background: var(--hb-bg);
  color: var(--hb-fg);
  font-family: var(--hb-font);
  transition: background-color .25s ease, color .25s ease;
  overflow-x: hidden;
}
body.hb-modal-open { overflow: hidden; }
.font-latin { font-family: 'Inter', Tahoma, sans-serif; }
a { text-decoration: none; }
::selection { background: rgba(255, 138, 0, .3); }

.hb-container { width: 100%; max-width: 1600px; margin-inline: auto; padding-inline: .75rem; }
@media (min-width: 640px) { .hb-container { padding-inline: 1.25rem; } }
@media (min-width: 1024px) { .hb-container { padding-inline: 2rem; } }

/* ---------- buttons / inputs ---------- */
.hb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: 999px; padding: .625rem 1.25rem; font-size: .875rem; font-weight: 600;
  border: 1px solid transparent; transition: all .2s ease; cursor: pointer;
}
.hb-btn-primary {
  color: #fff; border: none;
  background: linear-gradient(135deg, var(--hb-orange), var(--hb-orange-dark));
  box-shadow: 0 8px 24px -10px rgba(255, 138, 0, .7);
}
.hb-btn-primary:hover { filter: brightness(1.05); color: #fff; box-shadow: 0 10px 28px -10px rgba(255, 138, 0, .9); }
.hb-btn-ghost { background: var(--hb-card); color: var(--hb-fg); border-color: var(--hb-border); }
.hb-btn-ghost:hover { background: var(--hb-muted); color: var(--hb-fg); }
.hb-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 2.5rem; height: 2.5rem; border-radius: 999px; border: none; background: transparent;
  color: var(--hb-muted-fg); transition: all .2s ease; cursor: pointer; position: relative;
}
.hb-icon-btn:hover, .hb-icon-btn.active { background: var(--hb-muted); color: var(--hb-fg); }
.hb-icon-btn.active { color: var(--hb-orange); }
.hb-icon-btn.sm { width: 2rem; height: 2rem; font-size: .85rem; }
.hb-input {
  width: 100%; border-radius: 1rem; border: 1px solid var(--hb-border);
  background: var(--hb-card); color: var(--hb-fg); padding: .75rem 1rem; font-size: .875rem;
  font-family: var(--hb-font); transition: box-shadow .2s ease;
}
.hb-input:focus { outline: none; border-color: var(--hb-orange); box-shadow: 0 0 0 3px rgba(255, 138, 0, .25); }

/* ---------- header ---------- */
.hb-header {
  position: sticky; top: 0; z-index: 1030;
  background: rgba(244, 244, 241, .82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hb-border);
  transition: box-shadow .25s ease;
}
[data-bs-theme="dark"] .hb-header { background: rgba(13, 17, 23, .82); }
.hb-header.is-compact { box-shadow: 0 8px 28px -16px rgba(0, 0, 0, .18); }
.hb-header-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; transition: height .25s ease; }
.hb-header.is-compact .hb-header-inner { height: 56px; }
.hb-logo { display: inline-flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.hb-logo img { height: 36px; width: auto; transition: height .25s ease; }
.hb-header.is-compact .hb-logo img { height: 30px; }
.hb-nav-link {
  display: inline-flex; align-items: center; gap: .3rem;
  border-radius: 999px; padding: .5rem .75rem; font-size: .875rem; font-weight: 500;
  color: var(--hb-muted-fg); background: transparent; border: none; cursor: pointer;
  transition: color .2s ease, background .2s ease; font-family: var(--hb-font);
}
.hb-nav-link:hover, .hb-nav-link.active { color: var(--hb-fg); background: var(--hb-muted); }
.hb-trending { display: flex; align-items: center; gap: .35rem; margin-inline-start: .75rem; padding-inline-start: .75rem; border-inline-start: 1px solid var(--hb-border); }

/* search overlay */
.hb-searchbar {
  position: absolute; inset-inline: 0; top: 100%;
  border-bottom: 1px solid var(--hb-border);
  background: var(--hb-bg); box-shadow: 0 24px 48px -24px rgba(0, 0, 0, .25);
  padding-block: 1rem;
}
.hb-searchrow { position: relative; display: flex; align-items: center; }
.hb-searchrow > .bi-search { position: absolute; inset-inline-start: 1rem; color: var(--hb-muted-fg); pointer-events: none; }
.hb-searchrow .hb-input { border-radius: 999px; padding-inline: 3rem 3rem; font-size: 1.05rem; padding-block: .9rem; }

/* ---------- chips ---------- */
.hb-chip {
  --chip: var(--hb-orange);
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600; line-height: 1; white-space: nowrap;
  padding: .32rem .65rem; border-radius: 999px; border: none; cursor: pointer;
  color: var(--chip); background: color-mix(in srgb, var(--chip) 12%, transparent);
  transition: background .2s ease, color .2s ease; font-family: var(--hb-font);
}
a.hb-chip { text-decoration: none; }
.hb-chip:hover { background: color-mix(in srgb, var(--chip) 22%, transparent); color: var(--chip); }
.hb-chip.is-solid { color: #fff; background: var(--chip); }
.hb-chip.is-solid:hover { color: #fff; filter: brightness(1.05); }
.hb-chip.lg { font-size: .85rem; padding: .5rem 1rem; }
.hb-eyebrow { color: var(--hb-orange); font-size: .72rem; font-weight: 800; letter-spacing: .02em; }

/* ---------- masonry ---------- */
.hb-masonry { position: relative; width: 100%; }
.hb-masonry-item { position: absolute; top: 0; right: 0; opacity: 0; transition: opacity .32s ease; }
.hb-masonry-item.is-placed { opacity: 1; }
.hb-sentinel { height: 1px; }
.hb-loadmore {
  margin: 2rem auto 0; max-width: 24rem; display: flex; align-items: center; justify-content: center; gap: .75rem;
  border: 1px solid var(--hb-border); background: var(--hb-card); border-radius: 1rem;
  padding: 1rem 1.25rem; font-size: .875rem; color: var(--hb-muted-fg);
}
.hb-loadmore .spinner-border { width: 1.1rem; height: 1.1rem; color: var(--hb-orange); }

/* ---------- news card ---------- */
.hb-card {
  position: relative; overflow: hidden; cursor: pointer;
  border-radius: 1rem; border: 1px solid var(--hb-border); background: var(--hb-card);
  transition: box-shadow .25s ease, border-color .25s ease, transform .25s ease;
}
.hb-card img { display: block; width: 100%; height: auto; background: var(--hb-muted); }
.hb-card-body { padding: .875rem; }
.hb-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.hb-card-top time { font-size: .7rem; color: var(--hb-muted-fg); white-space: nowrap; }
.hb-card-title { font-size: .95rem; font-weight: 700; line-height: 1.75; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hb-card-summary { margin: .375rem 0 0; font-size: .8rem; line-height: 1.9; color: var(--hb-muted-fg); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hb-card-foot { margin-top: .75rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.hb-card-source { display: inline-flex; align-items: center; gap: .375rem; min-width: 0; font-size: .75rem; color: var(--hb-muted-fg); transition: color .2s ease; }
.hb-card-source:hover { color: var(--hb-fg); }
.hb-card-source span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-card-actions { display: flex; align-items: center; gap: .05rem; opacity: 0; transition: opacity .2s ease; margin-inline-end: -0.35rem; }
@media (hover: hover) {
  .hb-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--hb-orange) 35%, var(--hb-border)); box-shadow: 0 18px 44px -20px rgba(0, 0, 0, .28); }
  [data-bs-theme="dark"] .hb-card:hover { box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .8); }
  .hb-card:hover .hb-card-actions, .hb-card:focus-within .hb-card-actions { opacity: 1; }
}
.hb-card:focus-visible { outline: 2px solid var(--hb-orange); outline-offset: 2px; }
.hb-card.featured-news { border-color: color-mix(in srgb, var(--hb-orange) 50%, transparent); }
.hb-card.featured-news .hb-card-title { font-size: 1.08rem; }
.hb-card.featured-news .hb-card-body::before {
  content: 'ویژه'; display: inline-block; margin-bottom: .5rem;
  font-size: .65rem; font-weight: 800; padding: .15rem .55rem; border-radius: 999px;
  color: #fff; background: linear-gradient(135deg, var(--hb-orange), var(--hb-orange-dark));
}
.hb-card.urgent-news { box-shadow: inset 0 3px 0 0 #E03131; }
.hb-card.urgent-news .hb-card-body::before {
  content: 'فوری'; display: inline-block; margin-bottom: .5rem;
  font-size: .65rem; font-weight: 800; padding: .15rem .55rem; border-radius: 999px;
  color: #E03131; background: color-mix(in srgb, #E03131 12%, transparent);
}
.hb-card.sponsored-news {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--hb-orange) 45%, var(--hb-border));
  background: color-mix(in srgb, var(--hb-orange) 5%, var(--hb-card));
}
.hb-card.sponsored-news::after {
  content: 'تبلیغات'; position: absolute; top: .6rem; left: .6rem; z-index: 2;
  font-size: .62rem; font-weight: 800; padding: .2rem .55rem; border-radius: 999px;
  color: #fff; background: var(--hb-orange);
}

/* source badge */
.hb-src-badge {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 999px; color: #fff; font-weight: 700; overflow: hidden;
}
.hb-src-badge.sm { width: 1.25rem; height: 1.25rem; font-size: .6rem; }
.hb-src-badge.md { width: 2.25rem; height: 2.25rem; font-size: .875rem; }
.hb-src-badge.lg { width: 4rem; height: 4rem; font-size: 1.5rem; border-radius: 1rem; }
.hb-src-badge img { width: 100%; height: 100%; object-fit: contain; background: var(--hb-card); }

/* ---------- skeleton ---------- */
.hb-skeleton { border-radius: .5rem; background: var(--hb-muted); animation: hb-shimmer 1.4s ease-in-out infinite; }
.hb-skel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 768px) { .hb-skel-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { .hb-skel-grid { grid-template-columns: repeat(6, 1fr); } }
.hb-skel-card { border-radius: 1rem; border: 1px solid var(--hb-border); background: var(--hb-card); overflow: hidden; }
.hb-skel-card .inner { padding: .875rem; display: flex; flex-direction: column; gap: .55rem; }

/* ---------- hero & modules ---------- */
.hb-hero { border-radius: 1.5rem; border: 1px solid var(--hb-border); background: var(--hb-card); overflow: hidden; }
.hb-hero-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .hb-hero-grid { grid-template-columns: 1.2fr 1fr; } }
.hb-module { position: relative; border-radius: 1rem; border: 1px solid var(--hb-border); background: var(--hb-card); padding: 1rem; }
.hb-module-advertisement { border-style: dashed; border-color: color-mix(in srgb, var(--hb-orange) 45%, var(--hb-border)); background: color-mix(in srgb, var(--hb-orange) 5%, var(--hb-card)); }
.hb-module-cta { background: linear-gradient(135deg, color-mix(in srgb, var(--hb-navy) 92%, #000), var(--hb-navy)); color: #fff; border: none; }
.hb-module-cta .text-muted { color: rgba(255, 255, 255, .8) !important; }
.hb-module-badge { position: absolute; top: .6rem; left: .6rem; font-size: .62rem; font-weight: 800; padding: .2rem .55rem; border-radius: 999px; color: #fff; background: var(--hb-orange); }

/* ---------- modal ---------- */
.hb-modal { position: fixed; inset: 0; z-index: 1080; display: flex; align-items: stretch; justify-content: center; }
@media (min-width: 576px) { .hb-modal { align-items: center; padding: 1.5rem; } }
.hb-modal[hidden] { display: none; }
.hb-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
.hb-modal-dialog {
  position: relative; width: 100%; overflow-y: auto; background: var(--hb-card);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .5);
  animation: hb-modal-in .22s ease;
}
@media (min-width: 576px) { .hb-modal-dialog { max-width: 960px; max-height: 90vh; border-radius: 1.5rem; } }
.hb-modal-close { position: sticky; top: .75rem; float: left; margin-inline-start: .75rem; z-index: 10; background: var(--hb-card); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.hb-modal-body { padding: 1.25rem; }
@media (min-width: 576px) { .hb-modal-body { padding: 2rem; } }
.hb-modal-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; border-block: 1px solid var(--hb-border); padding-block: .75rem; margin-top: 1.5rem; }
@keyframes hb-modal-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- states ---------- */
.hb-state { margin: 3rem auto; max-width: 28rem; text-align: center; border-radius: 1.5rem; padding: 2.5rem 1.5rem; }
.hb-state-error { border: 1px solid rgba(220, 53, 69, .3); background: rgba(220, 53, 69, .05); }
.hb-state-empty { border: 1px dashed var(--hb-border); }
.hb-state .hb-state-icon { display: inline-flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; border-radius: 999px; font-size: 1.5rem; margin-bottom: .75rem; }
.hb-endfeed { margin-top: 2.5rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; font-size: .75rem; color: var(--hb-muted-fg); }
.hb-endfeed img { width: 1.75rem; height: 1.75rem; opacity: .6; }

/* ---------- back to top / offline / toast ---------- */
.hb-backtop {
  position: fixed; bottom: 1.25rem; inset-inline-start: 1.25rem; z-index: 1040;
  width: 3rem; height: 3rem; border-radius: 999px; border: none; cursor: pointer;
  background: var(--hb-fg); color: var(--hb-bg); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .4);
  display: inline-flex; align-items: center; justify-content: center; transition: background .2s ease, color .2s ease, opacity .2s ease;
}
.hb-backtop:hover { background: var(--hb-orange); color: #fff; }
.hb-backtop[hidden] { display: none; }
.hb-offline { background: var(--hb-navy); color: #fff; font-size: .75rem; }
.hb-offline .hb-container { display: flex; align-items: center; gap: .5rem; padding-block: .5rem; }
.hb-offline .bi { color: var(--hb-orange); }
.hb-toast {
  position: fixed; bottom: 1.5rem; inset-inline-end: 1.5rem; z-index: 1090;
  background: var(--hb-fg); color: var(--hb-bg); border-radius: .75rem; padding: .6rem 1rem;
  font-size: .8rem; font-weight: 600; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .4);
  opacity: 0; transform: translateY(8px); transition: all .25s ease; pointer-events: none;
}
.hb-toast.show { opacity: 1; transform: none; }

/* ---------- footer ---------- */
.hb-footer { border-top: 1px solid var(--hb-border); margin-top: 4rem; background: color-mix(in srgb, var(--hb-card) 60%, transparent); }
.hb-footer a { color: var(--hb-muted-fg); }
.hb-footer a:hover { color: var(--hb-fg); }
.hb-footer-bottom { border-top: 1px solid var(--hb-border); }
.hb-footer-bottom .hb-container { padding-block: 1rem; font-size: .75rem; color: var(--hb-muted-fg); }

/* ---------- misc ---------- */
.hb-page { padding-block: 1.5rem; }
.hb-pagehead { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 576px) { .hb-pagehead { flex-direction: row; align-items: center; justify-content: space-between; } }
.hb-filterbox { display: flex; align-items: center; gap: .75rem; border: 1px dashed var(--hb-border); background: color-mix(in srgb, var(--hb-card) 50%, transparent); border-radius: 1rem; padding: .75rem 1rem; font-size: .75rem; color: var(--hb-muted-fg); margin-bottom: 1.5rem; }
.hb-surface { border-radius: 1.5rem; border: 1px solid var(--hb-border); background: var(--hb-card); }
.hb-panel { border-radius: 1.5rem; border: 1px solid var(--hb-border); background: var(--hb-card); padding: 1.75rem; }
.hb-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 999px; }
.hb-divider { border-top: 1px solid var(--hb-border); }
.hb-btn-sm { padding: .5rem 1rem; font-size: .8rem; }
.text-hb-orange { color: var(--hb-orange) !important; }
.bg-hb-navy { background: var(--hb-navy) !important; }
.hb-otp { text-align: center; font-size: 1.5rem; letter-spacing: .6em; padding-block: 1rem; }
.dropdown-menu { border-radius: 1rem; border-color: var(--hb-border); background: var(--hb-card); box-shadow: 0 20px 40px -20px rgba(0,0,0,.25); }
[data-bs-theme="dark"] .dropdown-menu { background: #161B22; }
.dropdown-item { border-radius: .75rem; font-size: .875rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--hb-muted); color: var(--hb-fg); }
.offcanvas { background: var(--hb-bg); }
.nav-pills .nav-link { border-radius: 999px; font-size: .875rem; color: var(--hb-muted-fg); }
.nav-pills .nav-link.active { background: var(--hb-muted); color: var(--hb-fg); }
.list-group-item { background: transparent; border-color: var(--hb-border); color: var(--hb-fg); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
