/* ============================================================
   DIGIX AI — notifications.css
   Envelope button (header, far right, past the avatar), unread
   dot, slide-out panel, and critical-alert toast popups.
   Uses the shared --bg/--panel/--green/--blue/--red/--amber tokens
   from styles.css so this works identically under light/dark theme
   (see theme.css) with zero hardcoded colors.
   ============================================================ */

.notif-btn{
  position:relative;
  width:32px; height:32px;
  border-radius:50%;
  background:var(--panel2);
  border:1px solid var(--border);
  color:var(--text-dim);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  flex-shrink:0;
  transition:.15s;
}
.notif-btn:hover{ border-color:var(--green-dim); color:var(--green); }
.notif-btn svg{ width:16px; height:16px; }

.notif-count{
  position:absolute; top:-4px; right:-4px;
  min-width:16px; height:16px; padding:0 4px;
  border-radius:8px;
  background:var(--blue);
  color:#031420;
  font-family:var(--mono); font-size:9px; font-weight:700; line-height:16px;
  text-align:center;
  box-shadow:0 0 0 2px var(--panel2);
}
.notif-count.critical{
  background:var(--red);
  color:#2b0505;
}

/* ===== compact floating panel — matches .panel (dashboard.css)
   exactly: same fixed top-right position, same width, same open
   animation (opacity+translateY, not a full-height slide-in), same
   transparent click-catcher overlay used for Settings/History/Risk. ===== */
.notif-panel-overlay{
  position:fixed; inset:0; z-index:200;
  background:transparent;
  display:none;
}
.notif-panel-overlay.open{ display:block; }

.notif-panel{
  position:fixed; top:64px; right:20px; z-index:201;
  width:min(300px,90vw);
  max-height:80vh;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 20px 60px rgba(0,0,0,.5);
  opacity:0; transform:translateY(-8px);
  pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
  display:flex; flex-direction:column;
  overflow:hidden;
}
.notif-panel.open{ opacity:1; transform:translateY(0); pointer-events:auto; }

.notif-panel-head{
  display:flex; flex-direction:column; align-items:flex-start; gap:10px;
  padding:16px 18px 12px;
  border-bottom:1px solid var(--border-soft);
  flex-shrink:0;
}
.notif-panel-title{
  font-family:var(--display); font-size:15px; font-weight:700;
}
.notif-panel-actions{ display:flex; gap:8px; }
.notif-action-btn{
  all:unset; cursor:pointer;
  font-family:var(--mono); font-size:10px;
  padding:5px 9px; border-radius:5px;
  border:1px solid var(--border);
  color:var(--text-dim);
  white-space:nowrap;
}
.notif-action-btn:hover{ border-color:var(--green-dim); color:var(--green); }
.notif-action-btn.notif-action-danger:hover{ border-color:#8C2E2E; color:var(--red); }

.notif-panel-list{
  flex:1; overflow-y:auto;
  padding:8px 0;
}
.notif-panel-empty{
  padding:40px 20px; text-align:center;
  font-family:var(--mono); font-size:11.5px; color:var(--text-faint);
}
.notif-panel-list:not(:empty) + .notif-panel-empty{ display:none; }

.notif-item{
  display:flex; gap:10px; align-items:flex-start;
  padding:12px 18px;
  border-bottom:1px solid var(--border-soft);
  cursor:pointer;
  position:relative;
}
.notif-item:hover{ background:var(--panel2); }
.notif-item.unread::before{
  content:''; position:absolute; left:6px; top:18px;
  width:6px; height:6px; border-radius:50%;
  background:var(--blue);
}
.notif-item.unread.critical::before{ background:var(--red); }
.notif-item-body{ flex:1; min-width:0; }
.notif-item-title{
  font-family:var(--sans); font-size:12.5px; font-weight:600;
  color:var(--text); margin-bottom:3px;
}
.notif-item.critical .notif-item-title{ color:var(--red); }
.notif-item-message{
  font-family:var(--sans); font-size:11.5px; color:var(--text-dim);
  line-height:1.5;
}
.notif-item-time{
  font-family:var(--mono); font-size:9.5px; color:var(--text-faint);
  margin-top:5px;
}
.notif-item-delete{
  all:unset; cursor:pointer; flex-shrink:0;
  width:20px; height:20px; border-radius:5px;
  display:flex; align-items:center; justify-content:center;
  color:var(--text-faint);
  opacity:0; transition:.12s;
}
.notif-item:hover .notif-item-delete{ opacity:1; }
.notif-item-delete:hover{ color:var(--red); background:var(--panel2); }
.notif-item-delete svg{ width:12px; height:12px; }

/* ===== critical toast popups ===== */
.notif-toast-stack{
  position:fixed; top:16px; right:16px; z-index:200;
  display:flex; flex-direction:column; gap:10px;
  max-width:340px;
}
.notif-toast{
  background:var(--panel);
  border:1px solid #8C2E2E;
  border-left:3px solid var(--red);
  border-radius:8px;
  padding:14px 16px;
  box-shadow:0 8px 30px rgba(0,0,0,.4);
  display:flex; gap:10px; align-items:flex-start;
  animation:notif-toast-in .22s ease;
}
.notif-toast-icon{
  flex-shrink:0; width:18px; height:18px; color:var(--red); margin-top:1px;
}
.notif-toast-body{ flex:1; min-width:0; }
.notif-toast-title{
  font-family:var(--sans); font-size:12.5px; font-weight:700; color:var(--red);
  margin-bottom:3px;
}
.notif-toast-message{
  font-family:var(--sans); font-size:11.5px; color:var(--text-dim); line-height:1.5;
}
.notif-toast-close{
  all:unset; cursor:pointer; flex-shrink:0;
  color:var(--text-faint); width:16px; height:16px;
}
.notif-toast-close:hover{ color:var(--text); }

@keyframes notif-toast-in{
  from{ opacity:0; transform:translateX(20px); }
  to{ opacity:1; transform:translateX(0); }
}
.notif-toast.leaving{
  animation:notif-toast-out .18s ease forwards;
}
@keyframes notif-toast-out{
  to{ opacity:0; transform:translateX(20px); }
}

@media (prefers-reduced-motion: reduce){
  .notif-panel, .notif-panel-overlay, .notif-toast{ animation:none !important; transition:none !important; }
}

@media (max-width:480px){
  .notif-toast-stack{ left:12px; right:12px; max-width:none; top:12px; }
}
