/**
 * Cloche de notifications (header) : barre latérale plein écran, sortant du
 * bord droit (symétrique du menu mobile #menu-mobile, qui sort du bord
 * gauche) — plus visible et plus cohérente qu'un petit popup ancré sous
 * l'icône, sur toutes les tailles d'écran.
 */
.notif-icon {
  color: inherit;
}

/* État "notifications non lues" : la cloche se remplit en bleu marque et
   fait une petite secousse périodique — un vrai signal visuel, pas juste
   le badge chiffré (facilement manqué). */
.notif-icon .ph-bell.has-unread {
  color: var(--brand-primary, #2563eb);
  animation: oms-bell-shake 3.2s ease-in-out infinite;
}

@keyframes oms-bell-shake {
  0%, 84%, 100% { transform: rotate(0deg); }
  86% { transform: rotate(-12deg); }
  88% { transform: rotate(10deg); }
  90% { transform: rotate(-8deg); }
  92% { transform: rotate(6deg); }
  94% { transform: rotate(-3deg); }
  96% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .notif-icon .ph-bell.has-unread {
    animation: none;
  }
}

.oms-notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  z-index: 150;
  transition: width 0.35s ease;
}

.oms-notif-panel.open {
  width: 360px;
  max-width: 80vw;
}

.oms-notif-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  width: 360px;
  max-width: 80vw;
}

.oms-notif-panel__head strong {
  font-size: 16px;
}

.oms-notif-panel__head-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.oms-notif-panel__close {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  border: none;
  background: #f1f5f9;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.oms-notif-panel__close:hover {
  background: #e2e8f0;
}

.oms-notif-panel__toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid #e2e8f0;
  width: 360px;
  max-width: 80vw;
}

.oms-notif-panel__toolbar-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
}

.oms-notif-panel__toolbar-btn:hover {
  color: var(--brand-primary, #2563eb);
  text-decoration: underline;
}

.oms-notif-panel__list {
  height: calc(100% - 103px);
  overflow-y: auto;
  padding: 6px;
  width: 360px;
  max-width: 80vw;
}

.oms-notif-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: #64748b;
}

.oms-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: transparent;
  position: relative;
}

.oms-notif-item:hover {
  background: #f8fafc;
}

.oms-notif-item.unread {
  background: #eff6ff;
}

.oms-notif-item.unread:hover {
  background: #e0edff;
}

.oms-notif-item__delete {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.oms-notif-item__delete:hover,
.oms-notif-item__delete:focus-visible {
  background: #fee2e2;
  color: #dc2626;
}

.oms-notif-item__icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #0f172a;
  overflow: hidden;
}

.oms-notif-item__icon--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.oms-notif-item__body {
  min-width: 0;
  flex: 1 1 auto;
}

.oms-notif-item__title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 2px;
}

.oms-notif-item__text {
  font-size: 12.5px;
  color: #475569;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.oms-notif-item__time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
  display: block;
}

/* Interrupteur ON/OFF — aucun composant équivalent n'existait déjà côté site public */
.oms-toggle-switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.oms-toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.oms-toggle-switch__track {
  width: 40px;
  height: 22px;
  border-radius: 9999px;
  background: #cbd5e1;
  display: block;
  position: relative;
  transition: background-color 0.2s ease;
}

.oms-toggle-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
  transition: transform 0.2s ease;
}

.oms-toggle-switch input:checked + .oms-toggle-switch__track {
  background: var(--brand-primary, #2563eb);
}

.oms-toggle-switch input:checked + .oms-toggle-switch__track .oms-toggle-switch__thumb {
  transform: translateX(18px);
}

.oms-toggle-switch input:disabled + .oms-toggle-switch__track {
  opacity: 0.55;
  cursor: default;
}

/* Petits écrans : la barre latérale reste à 80% de l'écran, jamais plein écran */
@media (max-width: 420px) {
  .oms-notif-panel.open {
    width: 80vw;
  }

  .oms-notif-panel__head,
  .oms-notif-panel__list {
    width: 80vw;
    max-width: 80vw;
  }
}

.oms-notif-panel__head {
  padding-top: max(16px, env(safe-area-inset-top));
}
