/* Zackgo Enterprise Notification Center & Activity Timeline */

/* ── Notification bell & dropdown ── */
.zg-notif-wrap { position: relative; display: inline-flex; z-index: 50; }

.zg-notif-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(6, 11, 24, 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.zg-notif-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.zg-notif-dropdown {
  position: fixed;
  width: min(400px, calc(100vw - 24px));
  max-height: min(480px, calc(100vh - 96px));
  background: var(--surface-elevated, #FFFFFF);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 16px;
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.06);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition:
    opacity 0.22s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.22s cubic-bezier(0.32, 0.72, 0, 1),
    visibility 0.22s;
}

.zg-notif-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.zg-notif-dropdown[hidden] {
  display: none !important;
}

.zg-notif-dd-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #E7EAF0);
}

.zg-notif-dd-header h3 { font-size: 15px; font-weight: 700; flex: 1; margin: 0; color: var(--text-strong, #06231B); }
.zg-notif-dd-count { font-size: 11px; font-weight: 600; color: var(--accent, #E0B44C); background: rgba(224,180,76,.12); padding: 2px 8px; border-radius: 100px; }
.zg-notif-dd-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.zg-notif-dd-close:hover { background: var(--grey-100, #F3F4F6); color: var(--text-strong, #06231B); }
.zg-notif-dd-close:focus-visible { outline: 2px solid var(--accent, #E0B44C); outline-offset: 2px; }

.zg-notif-dd-list { overflow-y: auto; flex: 1; max-height: 340px; }
.zg-notif-dd-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-top: 1px solid var(--border, #E7EAF0); gap: 8px;
}

.zg-notif-dd-all, .zg-notif-dd-mark {
  font-size: 12px; font-weight: 600; background: none; border: none; cursor: pointer;
  color: var(--navy, #06231B); font-family: inherit; padding: 6px 0;
}
.zg-notif-dd-mark { color: var(--accent, #E0B44C); }

/* ── Notification items ── */
.zg-notif-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border, #F0F2F5);
  transition: background 0.12s;
}
.zg-notif-item.zg-notif-clickable { cursor: pointer; }
.zg-notif-item.zg-notif-clickable:hover { background: var(--grey-50, #FAFBFC); }
.zg-notif-item.zg-notif-clickable:focus-visible {
  outline: 2px solid var(--accent, #E0B44C);
  outline-offset: -2px;
}
.zg-notif-actions--compact { margin-top: 8px; }
.zg-notif-item.unread { border-left: 3px solid var(--accent, #E0B44C); background: color-mix(in oklab, var(--accent, #E0B44C) 4%, transparent); }
.zg-notif-item.compact { padding: 10px 14px; }

.zg-notif-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in oklab, var(--cat-color, #60A5FA) 12%, transparent);
  color: var(--cat-color, #60A5FA);
}

.zg-notif-body { flex: 1; min-width: 0; }
.zg-notif-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.zg-notif-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.zg-notif-unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent, #E0B44C); }
.zg-notif-title { font-size: 13px; font-weight: 600; color: var(--text-strong, #06231B); margin: 0 0 4px; line-height: 1.35; }
.zg-notif-desc { font-size: 12px; color: var(--text-dim, #64748B); margin: 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.zg-notif-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.zg-notif-actor { font-weight: 600; }
.zg-notif-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.zg-notif-act {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border, #E7EAF0); background: var(--surface, #fff);
  cursor: pointer; font-family: inherit; color: var(--text-dim);
}
.zg-notif-act.primary { background: var(--navy, #06231B); color: #fff; border-color: var(--navy); }
.zg-notif-act:hover { border-color: var(--navy); }

.zg-notif-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.zg-notif-empty-state { padding: 60px 24px; text-align: center; }
.zg-notif-empty-icon { font-size: 40px; margin-bottom: 12px; }
.zg-notif-empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text-strong); }
.zg-notif-empty-state p { font-size: 13px; color: var(--text-muted); max-width: 360px; margin: 0 auto; }

/* ── Full page ── */
.zg-notif-page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.zg-notif-page-header h2 { font-size: 20px; font-weight: 700; margin: 0 0 4px; color: var(--text-strong); }
.zg-notif-page-header p { font-size: 13px; color: var(--text-muted); margin: 0; }
.zg-notif-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.zg-notif-search {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; min-width: 200px; background: var(--surface);
  color: var(--text-strong);
}
.zg-notif-btn {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: none; background: var(--navy, #06231B); color: #fff; cursor: pointer; font-family: inherit;
}
.zg-notif-btn.outline { background: transparent; border: 1px solid var(--border); color: var(--text-strong); }

.zg-notif-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.zg-notif-filter {
  padding: 6px 12px; border-radius: 100px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-family: inherit;
  color: var(--text-dim); transition: all 0.12s;
}
.zg-notif-filter.active, .zg-notif-filter:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

.zg-notif-page-list {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-elevated, #fff);
}

/* ── Mobile sheet ── */
.zg-notif-sheet { position: fixed; inset: 0; z-index: 2000; pointer-events: none; }
.zg-notif-sheet.open { pointer-events: auto; }
.zg-notif-sheet-backdrop {
  position: absolute; inset: 0; background: rgba(6, 11, 24, 0.5);
  opacity: 0; transition: opacity 0.22s;
}
.zg-notif-sheet.open .zg-notif-sheet-backdrop { opacity: 1; }
.zg-notif-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh;
  background: var(--surface-elevated, #fff); border-radius: 20px 20px 0 0;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column; overflow: hidden;
}
.zg-notif-sheet.open .zg-notif-sheet-panel { transform: translateY(0); }
.zg-notif-sheet-header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.zg-notif-sheet-header h3 { flex: 1; font-size: 16px; font-weight: 700; margin: 0; }
.zg-notif-sheet-close { background: none; border: none; cursor: pointer; padding: 4px; }
.zg-notif-sheet-list { overflow-y: auto; flex: 1; }
.zg-notif-sheet-footer { padding: 12px 20px; border-top: 1px solid var(--border); text-align: center; }

/* ── Activity timeline ── */
.zg-act-timeline { position: relative; padding: 8px 0; }
.zg-act-group { margin-bottom: 24px; }
.zg-act-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 12px; padding-left: 44px;
}
.zg-act-item { display: flex; gap: 12px; padding: 0 0 20px 0; position: relative; }
.zg-act-line { width: 32px; flex-shrink: 0; display: flex; justify-content: center; }
.zg-act-dot {
  width: 32px; height: 32px; border-radius: 10px; border: 2px solid;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  background: var(--surface-elevated, #fff); position: relative; z-index: 1;
}
.zg-act-item:not(:last-child) .zg-act-line::after {
  content: ''; position: absolute; left: 15px; top: 32px; bottom: -8px;
  width: 2px; background: var(--border, #E7EAF0);
}
.zg-act-content { flex: 1; min-width: 0; padding-top: 4px; }
.zg-act-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.zg-act-header strong { font-size: 14px; color: var(--text-strong); }
.zg-act-header time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.zg-act-desc { font-size: 13px; color: var(--text-dim); margin: 0 0 6px; line-height: 1.5; }
.zg-act-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--text-muted); }
.zg-act-role { text-transform: capitalize; background: var(--grey-100); padding: 1px 6px; border-radius: 4px; }
.zg-act-link { font-size: 12px; font-weight: 600; color: var(--navy); text-decoration: none; display: inline-block; margin-top: 6px; }
.zg-act-loading, .zg-act-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ── Admin activity center ── */
.zg-admin-act-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.zg-admin-act-select, .zg-admin-act-date {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text-strong);
}
.zg-analytics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.zg-analytics-card {
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-elevated, #fff); display: flex; flex-direction: column; gap: 6px;
}
.zg-analytics-card span { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.zg-analytics-card strong { font-size: 22px; font-weight: 700; color: var(--text-strong); }
.zg-analytics-card.warn strong { color: #E0B44C; }
.zg-analytics-card.crit strong { color: #EF4444; }

.zg-audit-item {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: var(--surface-elevated);
}
.zg-audit-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.zg-audit-header strong { font-size: 13px; }
.zg-audit-meta { font-size: 12px; color: var(--text-muted); }
.zg-audit-changes, .zg-audit-reason { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.zg-user-activity { display: flex; flex-direction: column; gap: 24px; }
.zg-user-act-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text-strong); }
.zg-user-act-list { list-style: none; padding: 0; margin: 0; }
.zg-user-act-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.zg-user-act-list a { color: var(--navy); font-weight: 600; text-decoration: none; }
.zg-user-act-list time { font-size: 11px; color: var(--text-muted); }

/* Dark mode */
[data-theme="dark"] .zg-notif-dropdown,
[data-theme="dark"] .zg-notif-page-list,
[data-theme="dark"] .zg-notif-sheet-panel {
  background: var(--surface-elevated, #111827);
  border-color: var(--border, #1F2937);
}
[data-theme="dark"] .zg-notif-item.unread {
  background: color-mix(in oklab, var(--accent) 8%, transparent);
}

@media (max-width: 767px) {
  .zg-notif-dropdown { display: none !important; }
  .zg-notif-backdrop { display: none !important; }
  .zg-admin-act-toolbar { flex-direction: column; align-items: stretch; }
  .zg-notif-search { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .zg-notif-dropdown,
  .zg-notif-backdrop,
  .zg-notif-sheet-panel,
  .zg-notif-sheet-backdrop {
    transition: none !important;
  }
}
