/* ==========================================================
   ACERSMP SUPPORT PAGE
   Loads after nav.css / icons.css / light-theme.css.
   ========================================================== */

/*
 * border-box for this page only.
 *
 * Without it a field is width:100% PLUS its padding, because the
 * default is content-box: 100% of the card plus 42px of icon space and
 * 14px of breathing room, so every input hangs 56px out past the card
 * edge. nav.css sets this for .site-header alone, which does not cover
 * anything down here.
 *
 * .support is listed FIRST on purpose: a `.foo *` rule matches
 * descendants, never the element itself, so the wrapper stayed
 * content-box and its padding was added on top of its width.
 */
.support,
.support *,
.support *::before,
.support *::after {
  box-sizing: border-box;
}

:root {
  --panel: rgba(12, 23, 39, .82);
  --panel-solid: #0c1727;
  --line: rgba(138, 207, 255, .13);
  --blue: #59caff;
  --blue-bright: #8be0ff;
  --text: #eff8ff;
  --muted: #91a7bd;
  --green: #50dfa0;
  --amber: #ffc46b;
  --rose: #ff8f99;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.support {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 70px;
}

/*
 * Any rule that sets `display` beats the browser default for the
 * [hidden] attribute, so every toggle below needs its own line or the
 * sign-in gate would never actually hide.
 */
.support [hidden],
.support-body[hidden] { display: none !important; }

/* ---------- Sign-in gate ---------- */

.gate {
  display: grid;
  place-items: center;
  min-height: 62vh;
}

.gate-card {
  width: min(100%, 430px);
  padding: 40px 36px;
  text-align: center;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;

  box-shadow: 0 28px 70px rgba(0, 0, 0, .45);
  backdrop-filter: blur(16px);
}

.gate-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 22px;

  border-radius: 18px;
  background: rgba(88, 101, 242, .16);
  border: 1px solid rgba(124, 133, 255, .4);
  color: #a5abf8;
}

.gate-icon .ic { width: 28px; height: 28px; }

.gate-card h1 {
  margin: 0 0 12px;
  font-size: clamp(23px, 4vw, 28px);
  font-weight: 900;
  letter-spacing: -1px;
}

.gate-card p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.gate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;

  width: 100%;
  min-height: 48px;
  padding: 0 18px;

  border-radius: 11px;
  background: linear-gradient(120deg, #5865f2, #4752c4);
  border: 1px solid rgba(124, 133, 255, .55);
  color: #fff;

  font-size: 13px;
  font-weight: 800;

  box-shadow: 0 8px 26px rgba(88, 101, 242, .3);

  transition: transform .2s var(--ease), filter .2s ease;
}

.gate-button img { border-radius: 6px; }

.gate-button:hover { transform: translateY(-2px); filter: brightness(1.08); }

.gate-back {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  transition: color .2s ease;
}

.gate-back:hover { color: var(--blue); }

/* ---------- Heading ---------- */

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;

  margin-bottom: 30px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: -1.6px;
}

.page-heading h1 span { color: var(--blue); }

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  max-width: 52ch;
}

.subtitle strong { color: var(--blue-bright); }

.new-ticket-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  min-height: 42px;
  padding: 0 18px;

  border-radius: 11px;
  background: linear-gradient(120deg, #91e4ff, #49b9ff);
  border: 1px solid transparent;
  color: #04111d;

  font-size: 12px;
  font-weight: 800;

  cursor: pointer;

  box-shadow: 0 6px 20px rgba(54, 170, 255, .22);

  transition: transform .2s var(--ease), filter .2s ease;
}

.new-ticket-button .ic { width: 16px; height: 16px; }

.new-ticket-button:hover { transform: translateY(-2px); filter: brightness(1.05); }

/* ---------- Composer ---------- */

.composer {
  padding: 26px;

  margin-bottom: 26px;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.composer[hidden] { display: none; }

.composer h2 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.4px;
}

.field-row {
  display: grid;

  /*
   * minmax(0, 1fr), not 1fr. A bare 1fr is minmax(auto, 1fr), and the
   * auto minimum is the widest the content wants to be, so the Subject
   * input's own size forced the track wider than the card.
   */
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
}

.field { margin-bottom: 16px; min-width: 0; }

.field label {
  display: block;
  margin-bottom: 8px;
  color: #dbe6f5;
  font-size: 12px;
  font-weight: 700;
}

.input-wrap,
.select-wrap {
  position: relative;
  display: block;

  /* Lets the wrapper shrink inside its grid or flex parent. */
  min-width: 0;
}

.field-icon {
  position: absolute;
  top: 50%;
  left: 14px;

  width: 16px;
  height: 16px;

  transform: translateY(-50%);
  pointer-events: none;

  color: #6f8299;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;

  transition: color .2s ease;
}

.input-wrap input,
.input-wrap textarea,
.select-wrap select {
  width: 100%;

  padding: 0 14px 0 42px;

  color: var(--text);
  background: #081321;

  border: 1px solid rgba(135, 180, 220, .17);
  border-radius: 10px;

  font-size: 13px;

  transition: border-color .2s ease, box-shadow .2s ease;
}

.input-wrap input,
.select-wrap select { height: 46px; }

.textarea-wrap .field-icon { display: none; }

.input-wrap textarea {
  min-height: 110px;
  padding: 12px 14px;
  line-height: 1.65;
  resize: vertical;
  font-family: inherit;
}

.select-wrap select {
  appearance: none;
  cursor: pointer;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 15px;

  width: 7px;
  height: 7px;

  border-right: 2px solid #6f8299;
  border-bottom: 2px solid #6f8299;

  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.input-wrap input:hover,
.input-wrap textarea:hover,
.select-wrap select:hover { border-color: rgba(89, 202, 255, .45); }

.input-wrap input:focus,
.input-wrap textarea:focus,
.select-wrap select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(89, 202, 255, .12);
}

.input-wrap:focus-within .field-icon { color: var(--blue); }

.field-note {
  margin: 7px 0 0;
  color: #64748b;
  font-size: 10.5px;
  text-align: right;
}

.form-message {
  margin: 0 0 14px;
  color: var(--rose);
  font-size: 12px;
  line-height: 1.6;
}

.form-message:empty { display: none; }
.form-message.success { color: var(--green); }

.composer-actions,
.reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  min-height: 44px;
  padding: 0 20px;

  border: 0;
  border-radius: 10px;

  background: linear-gradient(120deg, #91e4ff, #49b9ff);
  color: #04111d;

  font-size: 12px;
  font-weight: 800;

  cursor: pointer;

  transition: transform .2s var(--ease), filter .2s ease;
}

.submit-button .ic { width: 15px; height: 15px; }

.submit-button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); }

.submit-button:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.ghost-button {
  min-height: 44px;
  padding: 0 18px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: transparent;
  color: var(--muted);

  font-size: 12px;
  font-weight: 700;

  cursor: pointer;

  transition: color .2s ease, border-color .2s ease;
}

.ghost-button:hover { color: var(--blue); border-color: rgba(89, 202, 255, .4); }

/* ---------- Layout ---------- */

.columns {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.thread[hidden] { display: none; }

/* ---------- Ticket list ---------- */

.list-head {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-bottom: 14px;
}

.list-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.2px;
}

.list-count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;

  border-radius: 999px;

  background: rgba(89, 202, 255, .12);
  border: 1px solid rgba(89, 202, 255, .25);

  color: var(--blue-bright);
  font-size: 11px;
  font-weight: 800;
}

.list { display: grid; gap: 9px; }

.list-empty {
  padding: 30px 18px;
  text-align: center;

  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;

  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.ticket-card {
  display: block;
  width: 100%;
  padding: 14px 15px;
  text-align: left;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;

  color: inherit;
  cursor: pointer;

  transition: border-color .2s ease, transform .2s var(--ease), background .2s ease;
}

.ticket-card:hover {
  border-color: rgba(89, 202, 255, .4);
  transform: translateY(-2px);
}

.ticket-card.active {
  border-color: rgba(89, 202, 255, .55);
  background: rgba(89, 202, 255, .07);
}

.ticket-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.ticket-ref {
  color: var(--blue);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
}

.ticket-card-subject {
  margin: 0 0 8px;

  /* Long subjects wrap instead of stretching the card. */
  min-width: 0;
  overflow-wrap: anywhere;

  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;

  min-width: 0;

  color: #64748b;
  font-size: 10.5px;
}

/* A long category name wraps instead of widening the card. */
.ticket-card-foot > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  min-width: 0;
  overflow-wrap: anywhere;
}

/*
 * A dot rather than a word, so the card stays one line. The title
 * carries the full label for anyone hovering it.
 */
.priority-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.priority-dot.high {
  background: var(--rose);
  box-shadow: 0 0 8px rgba(255, 143, 153, .55);
}

.priority-dot.low {
  background: #475569;
}

/* ---------- Status pill ---------- */

.status-pill {
  flex: 0 0 auto;

  padding: 4px 10px;

  border-radius: 999px;

  font-size: 10px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;

  white-space: nowrap;
}

.status-pill.open {
  background: rgba(80, 223, 160, .13);
  border: 1px solid rgba(80, 223, 160, .32);
  color: var(--green);
}

.status-pill.wait {
  background: rgba(255, 196, 107, .13);
  border: 1px solid rgba(255, 196, 107, .32);
  color: var(--amber);
}

.status-pill.closed {
  background: rgba(148, 163, 184, .12);
  border: 1px solid rgba(148, 163, 184, .28);
  color: #94a3b8;
}

/* ---------- Thread ---------- */

.thread {
  padding: 24px;

  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;

  padding-bottom: 18px;
  margin-bottom: 18px;

  border-bottom: 1px solid var(--line);
}

.back-button {
  display: none;
  align-items: center;
  gap: 6px;

  padding: 0;
  border: 0;
  background: transparent;

  color: var(--muted);
  font-size: 12px;
  font-weight: 700;

  cursor: pointer;

  transition: color .2s ease;
}

.back-button .ic { width: 15px; height: 15px; }
.back-button:hover { color: var(--blue); }

.thread-titles { flex: 1 1 220px; min-width: 0; }

.thread-titles h2 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;

  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.3px;
}

.thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;

  margin: 6px 0 0;
  min-width: 0;

  color: var(--muted);
  font-size: 11px;
}

.thread-meta > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.thread-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #475569;
}

/* ---------- Messages ---------- */

.messages {
  display: grid;
  gap: 12px;

  max-height: 52vh;
  overflow-y: auto;

  padding-right: 4px;
  margin-bottom: 20px;

  scrollbar-width: thin;
  scrollbar-color: rgba(89, 202, 255, .3) transparent;
}

.messages::-webkit-scrollbar { width: 7px; }
.messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(89, 202, 255, .25);
}

.message {
  max-width: 84%;
  padding: 12px 15px;

  border-radius: 14px;
  border: 1px solid var(--line);

  background: rgba(4, 9, 20, .35);
}

.message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;

  margin-bottom: 7px;

  /*
   * The author name here is the member's own display name, which they
   * can set to anything up to 32 characters. Without the shrink guard
   * the flex row refuses to narrow below it and pushes the whole
   * bubble - and then the card - past the edge of the panel.
   */
  min-width: 0;
}

.message-author {
  min-width: 0;
  overflow-wrap: anywhere;

  color: var(--text);
  font-size: 11.5px;
  font-weight: 800;
}

.message-time {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 10.5px;
}

.badge {
  padding: 2px 7px;
  border-radius: 999px;

  font-size: 9px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;

  white-space: nowrap;
}

.badge.staff {
  background: rgba(88, 101, 242, .16);
  border: 1px solid rgba(124, 133, 255, .4);
  color: #a5abf8;
}

.badge.owner {
  background: rgba(255, 196, 107, .14);
  border: 1px solid rgba(255, 196, 107, .38);
  color: var(--amber);
}

.badge.you {
  background: rgba(89, 202, 255, .12);
  border: 1px solid rgba(89, 202, 255, .3);
  color: var(--blue-bright);
}

/* Long lines and pasted links must never widen the thread. */
.message-body {
  margin: 0;
  min-width: 0;

  color: #cfe0f2;
  font-size: 13px;
  line-height: 1.72;

  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message.staff {
  margin-left: auto;
  border-color: rgba(124, 133, 255, .28);
  background: rgba(88, 101, 242, .08);
}

/* ---------- Reply box ---------- */

.reply-box textarea {
  width: 100%;
  min-height: 90px;

  padding: 12px 14px;

  color: var(--text);
  background: #081321;

  border: 1px solid rgba(135, 180, 220, .17);
  border-radius: 10px;

  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;

  resize: vertical;
}

.reply-box textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(89, 202, 255, .12);
}

.reply-box .form-message { margin-top: 10px; }

.reply-actions { margin-top: 12px; }

/* ---------- Light theme ---------- */

body.light-theme {
  --panel: rgba(255, 255, 255, .9);
  --panel-solid: #ffffff;
  --line: rgba(15, 40, 70, .12);
  --text: #0b1b2c;
  --muted: #4a5f75;
}

body.light-theme .input-wrap input,
body.light-theme .input-wrap textarea,
body.light-theme .select-wrap select,
body.light-theme .reply-box textarea { background: #fff; }

body.light-theme .message { background: rgba(15, 40, 70, .035); }
body.light-theme .message-body { color: #1d3346; }
body.light-theme .message.staff { background: rgba(88, 101, 242, .06); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }

  .back-button { display: inline-flex; }

  /* On a phone the list and the thread take turns instead of stacking. */
  .thread[hidden] { display: none; }
}

@media (max-width: 640px) {
  .support { padding: 26px 15px 50px; }

  .page-heading { margin-bottom: 22px; }

  .new-ticket-button { width: 100%; justify-content: center; }

  .composer,
  .thread { padding: 18px 15px; }

  .field-row { grid-template-columns: 1fr; gap: 0; }

  .message { max-width: 94%; }

  .composer-actions,
  .reply-actions { flex-direction: column-reverse; }

  .composer-actions > *,
  .reply-actions > * { width: 100%; }

  .thread-head { gap: 10px; }

  .thread-head .status-pill { order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}