/* ============================================================
   Advokat_CMS – gornja plava traka (notifikacije + podešavanja)
   ============================================================ */

:root {
  --cms-plava: #0647ba;
  --cms-plava-svijetla: #2563eb;
}

body.has-topbar {
  padding-top: 58px !important;
}

.cms-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: linear-gradient(90deg, var(--cms-plava) 0%, var(--cms-plava-svijetla) 100%);
  box-shadow: 0 2px 12px rgba(6, 71, 186, 0.35);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ---------- Logo / naziv ---------- */
.cms-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

.cms-topbar__brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}

.cms-topbar__naziv {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Dugmad desno ---------- */
.cms-topbar__akcije {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cms-ikona-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.cms-ikona-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.cms-ikona-btn:active {
  transform: scale(0.94);
}

.cms-ikona-btn.je-aktivan {
  background: #fff;
  color: var(--cms-plava);
}

.cms-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  border: 2px solid #0f52c9;
  box-sizing: content-box;
}

.cms-badge[hidden] {
  display: none;
}

@keyframes cms-zvonce-trese {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(14deg); }
  40% { transform: rotate(-12deg); }
  60% { transform: rotate(8deg); }
  80% { transform: rotate(-6deg); }
}

.cms-ikona-btn.trese i {
  animation: cms-zvonce-trese 0.7s ease;
}

/* ---------- Panel (zajedničko) ---------- */
.cms-panel {
  position: fixed;
  top: 64px;
  right: 14px;
  width: 390px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.26);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  z-index: 1300;
}

.cms-panel[hidden] {
  display: none;
}

.cms-panel__zaglavlje {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.cms-panel__naslov {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.cms-tekst-btn {
  border: none;
  background: transparent;
  color: var(--cms-plava-svijetla);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.cms-tekst-btn:hover {
  background: #e0ecff;
}

.cms-tekst-btn.opasno {
  color: #dc2626;
}

.cms-tekst-btn.opasno:hover {
  background: #fee2e2;
}

/* ---------- Lista notifikacija ---------- */
.cms-notif-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.cms-notif-stavka {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  color: inherit;
}

.cms-notif-stavka:hover {
  background: #f8fafc;
}

.cms-notif-stavka.nije-procitano {
  background: #eff6ff;
}

.cms-notif-stavka.nije-procitano:hover {
  background: #e0ecff;
}

.cms-notif-ikona {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: #e0ecff;
  color: var(--cms-plava);
}

.cms-notif-ikona.crvena { background: #fee2e2; color: #dc2626; }
.cms-notif-ikona.zelena { background: #dcfce7; color: #16a34a; }
.cms-notif-ikona.zuta   { background: #fef3c7; color: #b45309; }
.cms-notif-ikona.siva   { background: #e2e8f0; color: #475569; }

.cms-notif-sadrzaj {
  min-width: 0;
  flex: 1;
}

.cms-notif-naslov {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 2px;
}

.cms-notif-opis {
  font-size: 0.8rem;
  color: #475569;
  margin: 0 0 4px;
  word-break: break-word;
}

.cms-notif-vrijeme {
  font-size: 0.72rem;
  color: #94a3b8;
}

.cms-prazno {
  padding: 34px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

/* ---------- Podešavanja ---------- */
.cms-panel__tijelo {
  padding: 6px 0;
  overflow-y: auto;
}

.cms-red {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
}

.cms-red__opis {
  min-width: 0;
}

.cms-red__naslov {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
}

.cms-red__pomoc {
  display: block;
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 2px;
}

.cms-razdjelnik {
  height: 1px;
  background: #e2e8f0;
  margin: 6px 0;
}

.cms-select,
.cms-raspon {
  flex-shrink: 0;
}

.cms-select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
}

.cms-raspon {
  width: 110px;
  accent-color: var(--cms-plava-svijetla);
  cursor: pointer;
}

/* Prekidač (toggle) */
.cms-prekidac {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.cms-prekidac input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cms-prekidac span {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.cms-prekidac span::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.cms-prekidac input:checked + span {
  background: var(--cms-plava-svijetla);
}

.cms-prekidac input:checked + span::before {
  transform: translateX(20px);
}

/* Dugme unutar podešavanja */
.cms-puno-dugme {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 6px 16px 14px;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: var(--cms-plava-svijetla);
  color: #fff;
  font-size: 0.87rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease;
}

.cms-puno-dugme:hover:not(:disabled) {
  background: var(--cms-plava);
}

.cms-puno-dugme:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.cms-napomena {
  margin: 0 16px 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  line-height: 1.5;
}

.cms-napomena[hidden] {
  display: none;
}

/* ---------- Mobilna verzija ---------- */
@media (max-width: 640px) {
  body.has-topbar {
    padding-top: 54px !important;
  }

  .cms-topbar {
    height: 54px;
    padding: 0 12px;
  }

  .cms-topbar__naziv {
    font-size: 0.95rem;
  }

  .cms-panel {
    top: 60px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 380px) {
  .cms-topbar__naziv {
    display: none;
  }
}

/* U instaliranoj (PWA) verziji nema smisla nuditi instalaciju */
@media (display-mode: standalone) {
  .cms-instalacija-blok {
    display: none;
  }
}
