/* ==========================================================================
   bell.css — floating "Yangiliklar" (ex-"Blog") notification bell + panel.

   Loaded once, globally, from frontend/views/_partials/notification-bell.php
   (every public page via layouts/home.php and layouts/inner.php, except
   $isMinimal focused-flow inner pages). Reuses inner.css/home.css's design
   tokens (--ink, --gold, --surface, --muted, --line-light, --radius-card,
   --radius-pill, --shadow-card, --fs-meta, --fs-ui) with a fallback on every
   var(), same convention as blog.css.

   z-index: 85 — above the sticky header (40) and all normal page content, but
   BELOW the mobile nav backdrop/sheet (90/100, see home.css) so opening the
   hamburger menu naturally covers the bell instead of fighting it for space.
   ========================================================================== */

.ak-bell { position: fixed; right: 18px; bottom: 18px; z-index: 85; }

@media (min-width: 640px) {
  .ak-bell { right: 28px; bottom: 28px; }
}

/* ------------------------------- Bell button ------------------------------ */

.ak-bell-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: var(--gold, #efb631);
  color: var(--ink, #0b1928);
  box-shadow: 0 14px 34px rgba(11, 25, 40, .28), 0 2px 8px rgba(11, 25, 40, .12);
  cursor: pointer;
  font-family: inherit;
  /* Hidden until bell.js reveals it (slide/pop-in ~3-4s after load) — avoids a
     flash of an unstyled/placed button before the unread count is known. */
  opacity: 0;
  transform: translateY(14px) scale(.6);
  pointer-events: none;
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease;
}
.ak-bell-btn:focus-visible { outline: 3px solid var(--gold, #efb631); outline-offset: 3px; }

.ak-bell.is-visible .ak-bell-btn { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.ak-bell-icon { font-size: 25px; line-height: 1; transform: translateY(-1px); }

/* Gentle periodic wiggle (bell.js toggles .is-wiggling every ~9s). Respects
   prefers-reduced-motion below. */
@keyframes ak-bell-wiggle {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-12deg); }
  30% { transform: rotate(10deg); }
  45% { transform: rotate(-7deg); }
  60% { transform: rotate(5deg); }
  75% { transform: rotate(-2deg); }
}
.ak-bell.is-visible .ak-bell-btn.is-wiggling .ak-bell-icon { animation: ak-bell-wiggle .7s ease-in-out; }

/* Unread posts → a soft gold ring keeps pulsing out of the button, so the bell stays
   noticeable on a busy mobile page between wiggles. */
@keyframes ak-bell-ring {
  0% { transform: scale(1); opacity: .55; }
  100% { transform: scale(1.65); opacity: 0; }
}
.ak-bell-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--gold, #efb631);
  opacity: 0;
  z-index: -1;
  pointer-events: none;
}
.ak-bell.is-visible.has-unread:not(.is-open) .ak-bell-btn::before { animation: ak-bell-ring 2.2s ease-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .ak-bell-btn::before { animation: none !important; }
  .ak-bell-btn { transition: opacity .3s ease; transform: none !important; }
  .ak-bell.is-visible .ak-bell-btn { transform: none; }
  .ak-bell-btn.is-wiggling .ak-bell-icon { animation: none !important; }
}

/* --------------------------------- Badge ----------------------------------- */

.ak-bell-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #d9372b;
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  border: 2px solid var(--page, #f4f6f8);
}

/* --------------------------------- Panel ------------------------------------ */

.ak-bell-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(360px, calc(100vw - 36px));
  max-height: min(70vh, 480px);
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border-radius: var(--radius-card, 16px);
  box-shadow: 0 24px 60px rgba(11, 25, 40, .28), 0 2px 10px rgba(11, 25, 40, .08);
  border: 1px solid var(--line-light, #e6e9ed);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
}
.ak-bell-panel[hidden] { display: flex; visibility: hidden; pointer-events: none; }
.ak-bell.is-open .ak-bell-panel { opacity: 1; transform: translateY(0) scale(1); visibility: visible; pointer-events: auto; }

.ak-bell-panel-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--line-light, #e6e9ed); flex-shrink: 0; }
.ak-bell-panel-head strong { font-size: 16px; color: var(--ink, #0b1928); }

.ak-bell-list { overflow-y: auto; flex: 1 1 auto; min-height: 60px; }
.ak-bell-empty { margin: 0; padding: 22px 18px; color: var(--muted, #6b7280); font-size: var(--fs-meta, 14px); text-align: center; }

.ak-bell-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line-light, #eef0f3);
}
.ak-bell-item:last-child { border-bottom: 0; }
.ak-bell-item:hover,
.ak-bell-item:focus-visible { background: var(--page, #f7f8fa); }

.ak-bell-item-thumb {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--page, #eef0f3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--muted, #9aa3ad);
}
.ak-bell-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ak-bell-item-body { min-width: 0; flex: 1 1 auto; }
.ak-bell-item-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink, #0b1928);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ak-bell-item-date { margin: 3px 0 0; font-size: 11.5px; color: var(--muted, #6b7280); }

.ak-bell-item-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d9372b;
  margin-left: 2px;
}

.ak-bell-all {
  display: block;
  padding: 12px 18px;
  text-align: center;
  font-size: var(--fs-meta, 14px);
  font-weight: 750;
  color: var(--ink, #0b1928);
  border-top: 1px solid var(--line-light, #e6e9ed);
  text-decoration: none;
  flex-shrink: 0;
}
.ak-bell-all:hover { background: var(--page, #f7f8fa); }

.ak-bell-push { padding: 0 14px 14px; flex-shrink: 0; }
.ak-bell-push-btn {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-pill, 999px);
  background: var(--gold, #efb631);
  color: var(--ink, #0b1928);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.ak-bell-push-btn:disabled { opacity: .6; cursor: default; }
.ak-bell-push-hint { margin: 8px 2px 0; font-size: 11.5px; color: var(--muted, #6b7280); text-align: center; }

/* ----------------------------- Mobile bottom sheet --------------------------- */

@media (max-width: 640px) {
  .ak-bell-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 76vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
    transform-origin: bottom center;
  }
  .ak-bell.is-open .ak-bell-panel { transform: translateY(0); }
  .ak-bell-panel-head { padding-top: 18px; }
  .ak-bell-panel-head::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-light, #e2e5ea);
    margin: 0 auto 12px;
  }
}
