/* =========================================================
   Obaveštenja: zvonce, padajući spisak, kartica, stranica
   ========================================================= */

/* ---------- Zvonce u gornjoj traci ---------- */
.notif-bell { position: relative; width: 40px; height: 40px; flex: none; color: var(--text-2); }
.notif-bell:hover { background: var(--surface-3); color: var(--text); }
.notif-bell svg.i { width: 21px; height: 21px; }
.notif-count {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px;
  text-align: center; box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.notif-count.hidden, .nav-count.hidden { display: none; }
.notif-bell.ring svg.i { animation: notif-ring .9s ease-in-out; transform-origin: 50% 3px; }
.notif-bell.ring .notif-count { animation: notif-pop .45s ease-out; }
@keyframes notif-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); }
  45% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); }
}
@keyframes notif-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* broj nepročitanih u meniju levo */
.nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; font-style: normal; line-height: 20px; text-align: center;
}
.nav a { position: relative; }
@media (min-width: 768px) {
  .app.collapsed .nav-count { position: absolute; top: 5px; right: 8px; min-width: 9px; width: 9px; height: 9px; padding: 0; font-size: 0; }
}

/* ---------- Jedno obaveštenje (spisak i stranica) ---------- */
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 16px; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); background: transparent; color: inherit; font: inherit; cursor: pointer;
  transition: background .15s;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-3); }
.notif-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface-3)); }
.notif-item.read { opacity: .62; }
.notif-item.read .notif-ico { filter: grayscale(1); }
.notif-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.notif-title { font-weight: 750; font-size: 14px; }
.notif-item.read .notif-title { font-weight: 600; }
.notif-body { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.notif-time { font-size: 12px; color: var(--muted); }
.notif-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--danger); }

.notif-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.notif-ico svg.i { width: 18px; height: 18px; }
.notif-ico.info { background: var(--info-soft); color: var(--info); }
.notif-ico.warning { background: var(--warning-soft); color: var(--warning); }
.notif-ico.success { background: var(--success-soft); color: var(--success); }
.notif-ico.danger { background: var(--danger-soft); color: var(--danger); }
.notif-ico.muted { background: var(--surface-3); color: var(--muted); }

/* ---------- Padajući spisak ispod zvonca ---------- */
.notif-panel {
  position: fixed; z-index: 150; width: min(380px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 100px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; animation: notif-drop .18s ease-out;
}
.notif-panel .notif-list { overflow-y: auto; }
.notif-panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.notif-panel-head b { flex: 1; min-width: 0; font-size: 15px; }
.notif-panel-head .btn { flex: none; }
.notif-sound { flex: none; width: 32px; height: 32px; color: var(--muted); }
.notif-sound.on { color: var(--primary); }
.notif-sound:hover { background: var(--surface-3); }
.notif-sound svg.i { width: 18px; height: 18px; }
/* isključen zvuk: mala oznaka na zvoncu */
.notif-bell.silent::after {
  content: ''; position: absolute; left: 9px; bottom: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 2px var(--bg);
}
.notif-panel-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-top: 1px solid var(--border);
  color: var(--primary); font-weight: 700; font-size: 13px; text-decoration: none;
}
.notif-panel-foot:hover { background: var(--surface-3); }
.notif-panel-foot svg.i { width: 15px; height: 15px; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; color: var(--muted); font-size: 13px; }
.notif-empty svg.i { width: 26px; height: 26px; }
@keyframes notif-drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Kartica kada stigne novo (gore desno) ---------- */
.notif-cards { position: fixed; top: 76px; right: 20px; z-index: 210; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.notif-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 10px 14px 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: notif-in .3s cubic-bezier(.2, .9, .3, 1.2);
  transition: opacity .3s, transform .3s;
}
.notif-card:hover { border-color: var(--border-strong); border-left-color: var(--primary); }
.notif-card.out { opacity: 0; transform: translateX(24px); }
.notif-card-x { width: 28px; height: 28px; flex: none; }
.notif-card-x svg.i { width: 15px; height: 15px; }
@keyframes notif-in { from { opacity: 0; transform: translateX(40px); } }

/* ---------- Stranica Obaveštenja ---------- */
.notif-sound-card { margin-bottom: 16px; }
.notif-sound-card .card-head h3 { display: flex; align-items: center; gap: 8px; }
.notif-sound-card .card-head h3 svg.i { width: 18px; height: 18px; color: var(--primary); }
.notif-sound-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 20px; }
.notif-sound-opts .btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.notif-sound-opts .seg { flex-wrap: wrap; max-width: 100%; }
.notif-sound-opts .seg button { white-space: nowrap; }
.notif-page .card-head h3 { display: flex; align-items: center; gap: 8px; }
.notif-page .card-head h3 svg.i { width: 18px; height: 18px; color: var(--primary); }
.notif-day {
  padding: 10px 16px 6px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.notif-page .notif-list + .notif-day { border-top: 1px solid var(--border); }

@media (max-width: 767px) {
  /* gornja traka na uskom ekranu: zvonce + dugme za termin uvek stanu, dugačak naslov se skraćuje */
  .topbar { gap: 8px; }
  .topbar > div:not(.spacer) { min-width: 0; }
  .topbar h1 { overflow: hidden; text-overflow: ellipsis; }
  .notif-bell { width: 36px; }
  .notif-cards { top: 64px; right: 12px; left: 12px; width: auto; }
  .notif-panel { right: 12px !important; left: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .notif-bell.ring svg.i, .notif-bell.ring .notif-count, .notif-card, .notif-panel { animation: none; }
}
