/* ============================================================================
   AMAC Suite — Bug / Error Reporter widget v1.0.0  (shared)
   Pairs with amac-bug-report-v1.js. Scoped to .amac-bugreport-* so it cannot
   collide with any app's styles. Navy suite palette (#022544).
   ========================================================================= */

:root {
  --amac-bugreport-navy: #022544;
  --amac-bugreport-navy-2: #0a3a63;
  --amac-bugreport-accent: #1d6fb8;
}

/* ---- launcher button (fixed bottom-right) -------------------------------- */
.amac-bugreport-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2147482000;            /* above app chrome + the mobile hamburger */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: var(--amac-bugreport-navy);
  color: #fff;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(2, 37, 68, 0.35);
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
.amac-bugreport-btn:hover { background: var(--amac-bugreport-navy-2); transform: translateY(-1px); }
.amac-bugreport-btn:active { transform: translateY(0); }
.amac-bugreport-btn:focus-visible { outline: 3px solid var(--amac-bugreport-accent); outline-offset: 2px; }
.amac-bugreport-btn svg { flex: 0 0 auto; }

/* Icon-only on small screens so it never crowds the layout. */
@media (max-width: 600px) {
  .amac-bugreport-btn { padding: 12px; right: 12px; bottom: 12px; }
  .amac-bugreport-btn-label { display: none; }
}

/* Print: hide the launcher. */
@media print { .amac-bugreport-btn { display: none !important; } }

/* ---- modal --------------------------------------------------------------- */
.amac-bugreport-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 12, 24, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
body.amac-bugreport-open { overflow: hidden; }

.amac-bugreport-modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  font: 400 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #14242f;
  animation: amac-bugreport-pop .14s ease-out;
}
@keyframes amac-bugreport-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.amac-bugreport-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--amac-bugreport-navy);
  color: #fff;
  border-radius: 12px 12px 0 0;
}
.amac-bugreport-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.amac-bugreport-x {
  border: 0; background: transparent; color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.amac-bugreport-x:hover { color: #cfe3f5; }

.amac-bugreport-form { padding: 16px 18px 18px; }
.amac-bugreport-row { margin-bottom: 12px; }
.amac-bugreport-row label {
  display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; color: #2b3b46;
}
.amac-bugreport-req { color: #c0392b; }
.amac-bugreport-row input[type="text"],
.amac-bugreport-row textarea,
.amac-bugreport-row select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid #c7d2db;
  border-radius: 8px;
  font: inherit;
  color: #14242f;
  background: #fff;
}
.amac-bugreport-row textarea { resize: vertical; min-height: 78px; }
.amac-bugreport-row input:focus,
.amac-bugreport-row textarea:focus,
.amac-bugreport-row select:focus {
  outline: none; border-color: var(--amac-bugreport-accent);
  box-shadow: 0 0 0 3px rgba(29, 111, 184, 0.18);
}

.amac-bugreport-tech {
  margin: 6px 0 12px;
  padding: 10px 12px;
  background: #f4f7fa;
  border: 1px solid #e1e8ef;
  border-radius: 8px;
}
.amac-bugreport-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.amac-bugreport-check input { width: 16px; height: 16px; }
.amac-bugreport-techpre {
  margin: 8px 0 0;
  max-height: 96px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 400 11.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #56697a;
}

.amac-bugreport-msg {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
}
.amac-bugreport-msg.is-error   { background: #fdecea; color: #a82315; border: 1px solid #f5c6c0; }
.amac-bugreport-msg.is-success { background: #e8f6ec; color: #1d7a35; border: 1px solid #bfe3c8; }

.amac-bugreport-foot { display: flex; justify-content: flex-end; gap: 10px; }
.amac-bugreport-cancel,
.amac-bugreport-submit {
  padding: 9px 16px; border-radius: 8px; font: 600 13px/1 inherit; cursor: pointer;
}
.amac-bugreport-cancel { background: #fff; border: 1px solid #c7d2db; color: #2b3b46; }
.amac-bugreport-cancel:hover { background: #f1f5f9; }
.amac-bugreport-submit { background: var(--amac-bugreport-navy); border: 1px solid var(--amac-bugreport-navy); color: #fff; }
.amac-bugreport-submit:hover:not(:disabled) { background: var(--amac-bugreport-navy-2); }
.amac-bugreport-submit:disabled { opacity: .6; cursor: default; }

/* ---- popup menu (v2.0.0 combined launcher) ------------------------------ */
/* One button opens this two-item menu (Report a bug / Request a feature). */
.amac-feedback-menu {
  position: fixed;
  right: 18px;
  bottom: 64px;             /* just above the launcher button */
  z-index: 2147482001;      /* above the button, below the modal backdrop */
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 248px;
  padding: 6px;
  background: #fff;
  border: 1px solid #e1e8ef;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(2, 37, 68, 0.28);
  font: 400 14px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  animation: amac-bugreport-pop .12s ease-out;
}
.amac-feedback-menu[hidden] { display: none; }
/* The items are <button>s, so the suite-shell rule
   `body.suite-shell button` (0,1,2) sets a brand-red (--ss-red #840d0d)
   background + white text on them, which (a) clashed with the white dropdown
   and (b) made `.amac-feedback-title` inherit white → unreadable. Scope every
   item rule under `.amac-feedback-menu` (>= 0,2,x) + !important so the menu
   stays a clean light surface with dark, high-contrast text on every
   suite-shell page. (Red-button-leak guard — CSS-8 / SF-7 pattern.) */
.amac-feedback-menu .amac-feedback-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent !important;
  color: #14242f !important;
  font: inherit;
  cursor: pointer;
}
.amac-feedback-menu .amac-feedback-item:hover,
.amac-feedback-menu .amac-feedback-item:focus-visible {
  background: #eef3f8 !important;
  color: #14242f !important;
}
.amac-feedback-menu .amac-feedback-item:focus-visible { outline: 3px solid var(--amac-bugreport-accent); outline-offset: -2px; }
.amac-feedback-menu .amac-feedback-ico { flex: 0 0 auto; font-size: 18px; line-height: 1; }
.amac-feedback-menu .amac-feedback-text { display: flex; flex-direction: column; }
.amac-feedback-menu .amac-feedback-title { font-weight: 600; font-size: 14px; color: #14242f !important; }
.amac-feedback-menu .amac-feedback-sub { font-size: 12px; color: #5a6b78 !important; }

@media (max-width: 600px) {
  .amac-feedback-menu { right: 12px; bottom: 58px; min-width: 220px; }
}
@media print { .amac-feedback-menu { display: none !important; } }

/* ---- feature modal extras (v2.0.0) -------------------------------------- */
/* The feature form reuses .amac-bugreport-row/label/select/textarea; these add
   the intro line + a 2-up row for Importance + Frequency. */
.amac-feature-intro { margin: 0 0 12px; font-size: 13px; color: #56697a; }
.amac-feature-2col { display: flex; gap: 12px; }
.amac-feature-2col .amac-feature-col { flex: 1 1 0; min-width: 0; }
@media (max-width: 480px) { .amac-feature-2col { flex-direction: column; } }

/* ---- dark mode (v2.0.2) ------------------------------------------------- */
/* The suite sets data-theme="dark" on <html> on themed pages. The widget
   hardcodes a light palette, so without this the dark page kept the menu's
   dark surface but the menu's dark text → unreadable. These rules repaint the
   popup menu (and the modal) as a proper dark surface with light text. Keyed
   off [data-theme="dark"] so un-themed / light pages are completely unaffected
   (the selectors simply don't match). !important to beat both the light-mode
   widget rules and any theme surface rule. */
[data-theme="dark"] .amac-feedback-menu {
  background: #122b43 !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55) !important;
}
[data-theme="dark"] .amac-feedback-menu .amac-feedback-item { color: #e6eef5 !important; }
[data-theme="dark"] .amac-feedback-menu .amac-feedback-item:hover,
[data-theme="dark"] .amac-feedback-menu .amac-feedback-item:focus-visible {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
}
[data-theme="dark"] .amac-feedback-menu .amac-feedback-title { color: #f2f7fb !important; }
[data-theme="dark"] .amac-feedback-menu .amac-feedback-sub { color: #9fb6cc !important; }

/* Modal in dark mode: keep the navy header, darken the body + fields so the
   bug/feature forms aren't a blinding white sheet on a dark app. */
[data-theme="dark"] .amac-bugreport-modal { background: #0f2236 !important; color: #e6eef5 !important; }
[data-theme="dark"] .amac-bugreport-row label { color: #cdd9e5 !important; }
[data-theme="dark"] .amac-bugreport-row input[type="text"],
[data-theme="dark"] .amac-bugreport-row textarea,
[data-theme="dark"] .amac-bugreport-row select,
[data-theme="dark"] .amac-feature-2col .amac-feature-col select {
  background: #16314b !important;
  color: #e6eef5 !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}
[data-theme="dark"] .amac-bugreport-tech { background: #16314b !important; border-color: rgba(255, 255, 255, 0.12) !important; }
[data-theme="dark"] .amac-bugreport-techpre { color: #9fb6cc !important; }
[data-theme="dark"] .amac-feature-intro { color: #9fb6cc !important; }
[data-theme="dark"] .amac-bugreport-cancel { background: #16314b !important; color: #e6eef5 !important; border-color: rgba(255, 255, 255, 0.18) !important; }

/* ---- document attachments + mandatory-screenshot note (v2.1.0) --------- */
.amac-feedback-optional { font-weight: 400; color: #6b7c8a; }
.amac-feedback-files {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 13px;
  padding: 7px 8px; border: 1px dashed #c7d2db; border-radius: 8px; background: #f7fafc; color: #2b3b46;
}
.amac-feedback-files::file-selector-button {
  font: inherit; font-size: 12px; font-weight: 600; margin-right: 10px;
  padding: 6px 10px; border: 1px solid #c7d2db; border-radius: 6px; background: #fff; color: #14242f; cursor: pointer;
}
.amac-feedback-filelist { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.amac-feedback-filelist[hidden] { display: none; }
.amac-feedback-file {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  font-size: 12.5px; padding: 5px 9px; border-radius: 6px; background: #eef3f8; color: #2b3b46;
}
.amac-feedback-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amac-feedback-file-size { flex: 0 0 auto; color: #6b7c8a; }
.amac-feedback-file.is-bad { background: #fdecea; color: #a82315; }
.amac-feedback-file.is-bad .amac-feedback-file-size { color: #a82315; }
.amac-feedback-file-warn { font-size: 12px; color: #8a6100; margin-top: 2px; }
.amac-feedback-shotnote { margin: 0 0 8px; font-size: 12.5px; color: #2b3b46; font-weight: 600; }

[data-theme="dark"] .amac-feedback-optional { color: #9fb6cc; }
[data-theme="dark"] .amac-feedback-files { background: #16314b !important; border-color: rgba(255, 255, 255, 0.22) !important; color: #e6eef5 !important; }
[data-theme="dark"] .amac-feedback-files::file-selector-button { background: #1d3b58 !important; border-color: rgba(255, 255, 255, 0.22) !important; color: #e6eef5 !important; }
[data-theme="dark"] .amac-feedback-file { background: rgba(255, 255, 255, 0.08); color: #e6eef5; }
[data-theme="dark"] .amac-feedback-file-size { color: #9fb6cc; }
[data-theme="dark"] .amac-feedback-shotnote { color: #cdd9e5; }
