/* DoMyDesk Core - Notifications. Couleurs uniquement via variables du thème. */

/* ==========================================================
   Cloche du header
   - reste strictement à l'intérieur de la barre haute
   - le compteur est compact pour ne jamais augmenter sa hauteur
   ========================================================== */
#top-bar .dmd-notify-trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 0 0 auto;
  width: auto;
  min-width: 18px;
  max-width: 44px;
  height: 16px;
  min-height: 16px;
  max-height: 16px;
  margin: 0 0 0 2px;
  padding: 0 2px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--text-color);
  font: inherit;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  vertical-align: middle;
}
#top-bar .dmd-notify-trigger > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 12px;
  line-height: 1;
  font-size: 10px;
}
#top-bar .dmd-notify-trigger:hover,
#top-bar .dmd-notify-trigger.has-unread {
  border-color: var(--border-color);
  background: var(--panel-bg);
}
#top-bar .dmd-notify-count {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10px;
  height: 10px;
  max-height: 10px;
  padding: 0 2px;
  border-radius: 5px;
  background: var(--danger-color);
  color: var(--title-color);
  font-size: 6.5px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#top-bar .dmd-notify-count.is-zero { display: none; }

/* ==========================================================
   Liste des notifications
   ========================================================== */
.dmd-notify-overlay,
.dmd-notify-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: max(44px, calc(var(--topbar-height, 26px) + 12px)) 14px 14px;
  background: var(--shadow-color);
}
.dmd-notify-detail-overlay { z-index: 20020; }
.dmd-notify-overlay.is-open,
.dmd-notify-detail-overlay.is-open { display: flex; }

.dmd-notify-window,
.dmd-notify-detail-window {
  width: min(720px, 96vw);
  max-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--section-bg);
  color: var(--text-color);
  box-shadow: 0 14px 38px var(--shadow-color);
}
.dmd-notify-detail-window { width: min(760px, 96vw); }

.dmd-notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--panel-bg);
}
.dmd-notify-head strong { color: var(--title-color); font-size: 14px; }
.dmd-notify-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dmd-notify-head button,
.dmd-notify-item-actions button,
.dmd-notify-item-actions a,
.dmd-notify-detail-actions a,
.dmd-notify-detail-actions button {
  width: auto;
  min-width: 0;
  min-height: 24px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 10px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.dmd-notify-head button:hover,
.dmd-notify-item-actions button:hover,
.dmd-notify-item-actions a:hover,
.dmd-notify-detail-actions a:hover,
.dmd-notify-detail-actions button:hover {
  border-color: var(--primary-color);
  background: var(--primary-soft);
}

.dmd-notify-list,
.dmd-notify-detail-body {
  overflow: auto;
  padding: 8px;
}
.dmd-notify-detail-body { padding: 12px; }

.dmd-notify-empty {
  padding: 28px 12px;
  color: var(--muted-color);
  text-align: center;
  font-size: 12px;
}
.dmd-notify-item {
  position: relative;
  padding: 10px 11px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  margin-bottom: 7px;
}
.dmd-notify-item.is-unread { border-left: 3px solid var(--primary-color); }
.dmd-notify-item[data-level="danger"] { border-color: var(--danger-color); }
.dmd-notify-item[data-level="warning"] { border-color: var(--warning-color); }
.dmd-notify-item[data-level="success"] { border-color: var(--success-color); }

.dmd-notify-item-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--title-color);
  font-size: 12px;
  font-weight: 700;
}
.dmd-notify-item-title-button {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--title-color);
  text-align: left;
  cursor: pointer;
}
.dmd-notify-item-title-button:hover {
  background: transparent;
  color: var(--primary-color);
  transform: none;
}
.dmd-notify-item-title-button span:last-child { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }

.dmd-notify-item-message {
  margin-top: 5px;
  color: var(--text-color);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.dmd-notify-item-meta {
  margin-top: 6px;
  color: var(--muted-color);
  font-size: 9px;
}
.dmd-notify-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ==========================================================
   Popup de détail
   ========================================================== */
.dmd-notify-detail-section {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
}
.dmd-notify-detail-section:last-child { margin-bottom: 0; }
.dmd-notify-detail-section h4 {
  margin: 0 0 8px;
  color: var(--title-color);
  font-size: 12px;
}
.dmd-notify-detail-message {
  margin: 0 0 10px;
  color: var(--text-color);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.dmd-notify-detail-line {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid var(--border-color);
  font-size: 10px;
}
.dmd-notify-detail-line:first-of-type { border-top: 0; }
.dmd-notify-detail-line span { color: var(--muted-color); }
.dmd-notify-detail-line strong { color: var(--text-color); overflow-wrap: anywhere; }

.dmd-notify-change {
  padding: 9px;
  margin-top: 7px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: var(--panel-bg);
}
.dmd-notify-change-title {
  display: block;
  margin-bottom: 7px;
  color: var(--title-color);
  font-size: 11px;
}
.dmd-notify-change-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}
.dmd-notify-change-values > div:not(.dmd-notify-change-arrow) {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--input-bg);
}
.dmd-notify-change-values span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-color);
  font-size: 9px;
}
.dmd-notify-change-values strong {
  display: block;
  color: var(--text-color);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.dmd-notify-change-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-weight: 700;
}
.dmd-notify-change-permissions {
  margin-top: 7px;
  color: var(--muted-color);
  font-size: 9px;
  overflow-wrap: anywhere;
}
.dmd-notify-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
}

@media (max-width: 700px) {
  .dmd-notify-overlay,
  .dmd-notify-detail-overlay { padding: 44px 6px 6px; align-items: flex-end; }
  .dmd-notify-window,
  .dmd-notify-detail-window { width: 100%; max-height: 86vh; border-radius: 10px 10px 4px 4px; }
  .dmd-notify-head { padding: 9px; align-items: flex-start; }
  .dmd-notify-detail-line { grid-template-columns: 1fr; gap: 3px; }
  .dmd-notify-change-values { grid-template-columns: 1fr; }
  .dmd-notify-change-arrow { min-height: 18px; transform: rotate(90deg); }
}
.dmd-notify-detail-legacy {
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  color: var(--muted-color);
  background: var(--panel-bg);
  font-size: 10px;
  line-height: 1.45;
}
