/* Circlo Iteration 9 - notifications */

.notifications-panel.i9-panel {
  width: min(430px, calc(100vw - 24px));
  max-height: min(720px, calc(100vh - 82px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.i9-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
}

.i9-head h3 { margin: 0; }

.i9-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.i9-icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3, #eef2f7);
  color: inherit;
  cursor: pointer;
  font-size: 17px;
}

.i9-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.i9-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  background: transparent;
  color: var(--muted, #64748b);
  font-weight: 700;
}

.i9-tabs button.active {
  color: var(--brand, #2563eb);
  background: var(--brand-soft, #dbeafe);
}

#notificationsList {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 12px;
}

.i9-notification {
  width: 100%;
  display: grid;
  grid-template-columns: 46px minmax(0,1fr) 10px;
  gap: 10px;
  align-items: center;
  border: 0;
  border-radius: 12px;
  padding: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.i9-notification:hover { background: var(--surface-2, #f8fafc); }
.i9-notification.unread { background: color-mix(in srgb, var(--brand-soft, #dbeafe) 58%, transparent); }

.i9-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: #dbeafe;
  flex: 0 0 auto;
}

.i9-avatar-fallback {
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #1d4ed8;
  border: 2px solid #2563eb;
}

.i9-copy { min-width: 0; }
.i9-copy strong { display: block; margin-bottom: 2px; font-size: .92rem; }
.i9-copy p { margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
.i9-copy small { display: block; margin-top: 4px; color: var(--muted, #64748b); }

.i9-unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand, #2563eb);
}

.i9-empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted, #64748b);
}

.i9-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.i9-preferences {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.i9-preferences.hidden { display: none; }

.i9-preferences-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.56);
}

.i9-preferences-card {
  position: relative;
  width: min(520px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  border-radius: 16px;
  background: var(--surface, #fff);
  color: inherit;
  box-shadow: 0 24px 70px rgba(15,23,42,.28);
}

.i9-preferences-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.i9-preferences-card header h2 { margin: 0; font-size: 1.18rem; }
.i9-preferences-body { padding: 8px 20px 18px; }

.i9-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.i9-pref-row div { min-width: 0; }
.i9-pref-row strong { display: block; }
.i9-pref-row span { display: block; margin-top: 2px; color: var(--muted, #64748b); font-size: .84rem; }
.i9-pref-row input { width: 20px; height: 20px; accent-color: var(--brand, #2563eb); }

.i9-pref-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
}

.i9-post-preview {
  position: fixed;
  inset: 0;
  z-index: 5100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.i9-post-preview.hidden { display: none; }
.i9-post-preview-backdrop { position:absolute; inset:0; background:rgba(15,23,42,.6); }
.i9-post-preview-card { position:relative; width:min(620px,100%); max-height:90vh; overflow:auto; border-radius:16px; background:var(--surface,#fff); box-shadow:0 24px 70px rgba(15,23,42,.3); }
.i9-post-preview-card header { display:flex; justify-content:space-between; align-items:center; padding:16px 18px; border-bottom:1px solid var(--border,#e5e7eb); }
.i9-post-preview-body { padding:18px; }
.i9-post-preview-body img { width:100%; max-height:520px; object-fit:contain; border-radius:12px; margin-top:12px; background:#0f172a; }
.i9-post-preview-author { color:var(--muted,#64748b); margin-bottom:12px; }
.i9-post-preview-text { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.5; }

@media (max-width: 720px) {
  .notifications-panel.i9-panel {
    left: 8px !important;
    right: 8px !important;
    width: auto;
    max-height: calc(100vh - 72px);
  }
}

/* Step 1.5 unread notification badge */
.i9-notification-badge
 {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-sizing: border-box;
}

.i9-notification-badge[hidden], .i9-notification-badge.hidden {
  display: none !important;
}

/* BEGIN STEP 1.6 NOTIFICATION SETTINGS MODAL */
#i9Settings {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}

#i9Settings.hidden,
#i9Settings[hidden] {
  display: none !important;
}

#i9Preferences {
  width: min(520px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  overflow-y: auto;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  padding: 22px;
  background: var(--surface, var(--card-bg, #ffffff));
  color: inherit;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

#i9PrefTitle {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 750;
  line-height: 1.25;
}

#i9Preferences label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 48px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  cursor: pointer;
}

#i9Preferences label:last-of-type {
  border-bottom: 0;
}

#i9Preferences input[type="checkbox"][data-i9-pref] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  margin: 0;
  border: 1px solid rgba(100, 116, 139, 0.55);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

#i9Preferences input[type="checkbox"][data-i9-pref]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
  transition: transform 140ms ease;
}

#i9Preferences input[type="checkbox"][data-i9-pref]:checked {
  border-color: var(--accent, #2563eb);
  background: var(--accent, #2563eb);
}

#i9Preferences input[type="checkbox"][data-i9-pref]:checked::before {
  transform: translateX(20px);
}

#i9Preferences input[type="checkbox"][data-i9-pref]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

#i9SavePrefs,
#i9CancelPrefs {
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

#i9SavePrefs {
  border: 1px solid var(--accent, #2563eb);
  background: var(--accent, #2563eb);
  color: #ffffff;
}

#i9CancelPrefs {
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: transparent;
  color: inherit;
}

@media (max-width: 560px) {
  #i9Settings {
    align-items: flex-end;
    padding: 12px;
  }

  #i9Preferences {
    width: 100%;
    max-height: 86vh;
    border-radius: 18px 18px 12px 12px;
  }
}
/* END STEP 1.6 NOTIFICATION SETTINGS MODAL */
