/* shared/report-notes.css — site-wide "Notes" floating button + panel. Loaded on
   every page right alongside shared/report-bugreport.css; classes are namespaced
   "rn-" (Report Notes) and use !important on layout-critical rules for the
   same reason shared/report-bugreport.css does — this widget needs to look and
   behave the same no matter which page's own CSS is also loaded. Sits
   directly above the Feedback fab (#abr-fab) rather than on top of it.

   Palette/type matched to the rest of the site rather than invented fresh:
   #3a7bc8 primary blue / #0b5394 darker companion (index.css, used for
   links, active states, hover borders — see .report-card:hover, h1 color),
   'Roboto' + -apple-system font stack (index.css body), #333333 primary
   text / #666666 secondary / #9ca3af muted, #D1D5DB / #e5e7eb borders. The
   note cards themselves are styled directly off index.css's .report-card
   (white bg, 14px radius, subtle shadow, hover lift with a blue left
   border) since the person asked for "a nice card grid" — the same visual
   language as the homepage's dashboard cards. */

#rn-fab {
  position: fixed !important;
  bottom: 78px !important;
  right: 22px !important;
  z-index: 999999 !important;
  height: 46px;
  width: auto;
  border-radius: 23px;
  background: var(--brand-blue, #3a7bc8);
  color: var(--text-on-brand, #fff);
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  cursor: pointer;
  display: none; /* shown via JS once a session is confirmed */
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1;
  padding: 0 18px;
  transition: transform .15s ease, box-shadow .15s ease;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#rn-fab.rn-visible { display: flex; }
#rn-fab:hover  { transform: scale(1.08); box-shadow: 0 6px 22px rgba(0,0,0,.35); background: var(--brand-blue-dark, #0b5394); }
#rn-fab:active { transform: scale(0.96); }

/* Fab dock: parked off to the side until the cursor is in the bottom-right
   corner — see the matching block in shared/report-theme-toggle.css for the full
   explanation. ".fab-dock-open" is toggled on this and the other two fabs
   (#abr-fab, #rt-fab) together by the single listener in
   shared/report-theme-toggle.js. Fine-pointer/hover devices only, so touch
   hardware keeps the always-visible resting state above. */
@media (hover: hover) and (pointer: fine) {
  #rn-fab {
    transform: translateX(40px);
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease, box-shadow .15s ease, background .15s ease;
  }
  #rn-fab.fab-dock-open { transform: translateX(0); opacity: 1; pointer-events: auto; }
}

#rn-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999998 !important;
  background: rgba(13, 13, 26, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#rn-backdrop.rn-visible { display: flex; }

/* Wide/tall — "takes up most of the screen" per the explicit request,
   unlike shared/report-bugreport.css's small abr-card (this one holds a scrollable
   card grid, not a short form). */
#rn-card {
  position: relative;
  background: var(--bg-surface, #fff);
  border-radius: 14px;
  width: min(1200px, 94vw);
  height: min(880px, 90vh);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  padding: 0;
  color: var(--text-primary, #333333);
  display: flex;
  flex-direction: column;
}

.rn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-faint, #eee);
  flex-shrink: 0;
}
.rn-title { font-family: 'Roboto', -apple-system, sans-serif; font-weight: 700; font-size: 17px; color: var(--text-primary, #333333); }
.rn-close { background: none; border: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--text-muted, #9ca3af); padding: 4px; }
.rn-close:hover { color: var(--text-tertiary, #374151); }

.rn-context {
  padding: 10px 24px;
  font-size: 12px;
  color: var(--text-secondary, #666666);
  border-bottom: 1px solid var(--bg-subtle, #f3f4f6);
  flex-shrink: 0;
}
.rn-context strong { color: var(--text-primary, #333333); }

.rn-scope-toggle {
  display: flex;
  gap: 6px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--bg-subtle, #f3f4f6);
  flex-shrink: 0;
}
.rn-scope-btn {
  border: 1px solid var(--border, #D1D5DB);
  border-radius: 12px;
  background: var(--bg-surface-alt, #f9fafb);
  color: var(--text-tertiary, #374151);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
}
.rn-scope-btn.rn-scope-active { background: var(--brand-blue, #3a7bc8); border-color: var(--brand-blue, #3a7bc8); color: var(--text-on-brand, #fff); }

/* ── Scrollable card grid, grouped by page ─────────────────────────────── */

.rn-list {
  padding: 16px 24px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}
.rn-empty { padding: 40px 0; text-align: center; color: var(--text-muted, #9ca3af); font-size: 13px; }
.rn-error-text { color: var(--status-error, #dc2626); }

.rn-page-section { margin-bottom: 24px; }
.rn-page-section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #666666);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #D1D5DB);
}
.rn-page-section-count { color: var(--text-muted, #9ca3af); font-weight: 400; text-transform: none; letter-spacing: normal; font-size: 12px; }

.rn-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.rn-card {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, #D1D5DB);
  border-left: 3px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .15s, box-shadow .15s;
}
.rn-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  border-left-color: var(--brand-blue, #3a7bc8);
}
.rn-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--text-muted, #9ca3af); }
.rn-card-byline { margin-left: auto; }
.rn-card-tag { background: var(--tag-blue-bg, #eaf1fa); color: var(--brand-blue, #3a7bc8); border-radius: 10px; padding: 2px 9px; font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .3px; }
/* Ad Platform tag reuses the same pill shape as the client tag but in a
   distinct color (amber) so a note tagged all the way to a campaign/ad group/
   ad is visually distinguishable at a glance from a plain client-only tag. */
.rn-card-tag-ad { background: var(--badge-warning-bg-alt, #fdf3e0); color: var(--badge-warning-text, #b45309); text-transform: none; letter-spacing: normal; }
.rn-card-body { flex: 1; font-size: 13px; line-height: 1.5; color: var(--text-primary, #333333); white-space: pre-wrap; word-break: break-word; }
.rn-card-actions { display: flex; gap: 12px; }
.rn-note-action { background: none; border: none; padding: 0; font-size: 11px; font-weight: 600; color: var(--brand-blue, #3a7bc8); cursor: pointer; }
.rn-note-action:hover { text-decoration: underline; }
.rn-note-action-danger { color: var(--status-error, #dc2626); }

/* ── Add-note form ────────────────────────────────────────────────────────── */

.rn-add-section { border-top: 1px solid var(--border-faint, #eee); padding: 14px 24px; flex-shrink: 0; }
.rn-add-toggle {
  width: 100%;
  border: 1.5px dashed var(--border, #D1D5DB);
  border-radius: 8px;
  background: var(--bg-surface, #fff);
  color: var(--text-tertiary, #374151);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 0;
  cursor: pointer;
}
.rn-add-toggle:hover { border-color: var(--brand-blue, #3a7bc8); color: var(--brand-blue, #3a7bc8); }

.rn-textarea, .rn-edit-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border-subtle, #e5e7eb);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: 'Roboto', -apple-system, sans-serif;
  color: var(--text-primary, #333333);
  background: var(--bg-surface, #fff);
  resize: vertical;
  min-height: 70px;
}
.rn-textarea:focus, .rn-edit-textarea:focus { outline: none; border-color: var(--brand-blue, #3a7bc8); }

.rn-add-row { display: flex; align-items: center; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.rn-check-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary, #374151); cursor: pointer; }

.rn-field { margin-top: 10px; }
.rn-field-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary, #666666); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.rn-page-picker { margin-top: 8px; padding-left: 22px; }
.rn-combo { position: relative; }
.rn-client-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border-subtle, #e5e7eb);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: 'Roboto', -apple-system, sans-serif;
  color: var(--text-primary, #333333);
  background: var(--bg-surface, #fff);
}
.rn-client-input:focus { outline: none; border-color: var(--brand-blue, #3a7bc8); }
.rn-combo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 180px;
  overflow-y: auto;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  z-index: 1;
}
.rn-combo-item { padding: 7px 11px; font-size: 13px; color: var(--text-primary, #333333); cursor: pointer; }
.rn-combo-item:hover { background: var(--bg-subtle, #f3f4f6); }

/* ── Ad Platform picker ───────────────────────────────────────────────────── */
.rn-select {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border-subtle, #e5e7eb);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: 'Roboto', -apple-system, sans-serif;
  color: var(--text-primary, #333333);
  background: var(--bg-surface, #fff);
}
.rn-select:focus { outline: none; border-color: var(--brand-blue, #3a7bc8); }
.rn-select:disabled { color: var(--text-muted, #9ca3af); background: var(--bg-surface-alt, #f9fafb); }
.rn-ad-picker { margin-top: 8px; padding-left: 22px; }
.rn-ad-hint { font-size: 12px; color: var(--text-muted, #9ca3af); padding: 4px 0; }
.rn-ad-level-row { margin-top: 8px; }
.rn-ad-level-row:first-child { margin-top: 10px; }

.rn-error { font-size: 12px; color: var(--status-error, #dc2626); min-height: 16px; margin-top: 8px; }

.rn-add-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.rn-btn {
  font-family: 'Roboto', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border: none;
}
.rn-btn-cancel { background: var(--bg-subtle, #f3f4f6); color: var(--text-tertiary, #374151); }
.rn-btn-cancel:hover { background: var(--border-subtle, #e5e7eb); }
.rn-btn-submit { background: var(--brand-blue, #3a7bc8); color: var(--text-on-brand, #fff); }
.rn-btn-submit:hover:not(:disabled) { background: var(--brand-blue-dark, #0b5394); }
.rn-btn-submit:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 700px) {
  #rn-card { width: 96vw; height: 92vh; }
  .rn-card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  #rn-fab { bottom: 70px !important; right: 16px !important; height: 42px; padding: 0 14px; font-size: 12px; }
}
