/* ===== Support Page ===== */

/* Contact Cards */
.sup-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.sup-contact-card {
  background: var(--app-surface-2);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  transition: border-color 0.2s;
}
.sup-contact-card:hover {
  border-color: rgba(92, 184, 230, 0.3);
}
.sup-contact-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.sup-contact-icon.blue { background: rgba(92, 184, 230, 0.12); color: var(--app-primary); }
.sup-contact-icon.green { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.sup-contact-icon.purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

.sup-contact-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--app-text-strong);
  margin-bottom: 4px;
}
.sup-contact-detail {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}
.sup-contact-btn {
  display: inline-block;
  background: transparent;
  border: 1px solid #1e293b;
  color: #94a3b8;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.sup-contact-btn:hover {
  border-color: var(--app-primary);
  color: var(--app-primary);
}

/* Section */
.sup-section {
  margin-bottom: 24px;
}
.sup-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--app-text-strong);
  margin: 0 0 16px;
}

/* FAQ */
.sup-faq-list {
  background: var(--app-surface-2);
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
}
/* BUG #317: previously support-faq-render.js inserted <h3 class="sup-faq-category">
   per FAQ group but no CSS rule targeted it — the browser applied default h3
   styling (~21px font, ~1.55em top/bottom margin) producing inconsistent
   vertical spacing between categories and left-aligning the heading to 0
   padding while sibling .sup-faq-question rows have padding: 16px 20px (visible
   indent mismatch). This rule normalizes the heading into a uniform category
   band. No border-top — the prior .sup-faq-item border-bottom already draws
   the upper separator, so a top border here would double the 1px line. */
.sup-faq-category {
  margin: 0;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  background: #0d131e;
  border-bottom: 1px solid #1e293b;
}
.sup-faq-item {
  border-bottom: 1px solid #1e293b;
}
.sup-faq-item:last-child {
  border-bottom: none;
}
.sup-faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--app-text-strong);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}
.sup-faq-question:hover {
  background: rgba(92, 184, 230, 0.03);
}
.sup-faq-question svg {
  flex-shrink: 0;
  color: #64748b;
  transition: transform 0.2s;
}
.sup-faq-item.open .sup-faq-question svg {
  transform: rotate(180deg);
}
.sup-faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.3s ease, padding 0.3s ease;
}
.sup-faq-answer > * {
  overflow: hidden;
}
.sup-faq-item.open .sup-faq-answer {
  grid-template-rows: 1fr;
  padding: 0 20px 16px;
}
.sup-faq-answer p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.7;
  margin: 0;
}

/* Two Column Layout */
.sup-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* Panel */
.sup-panel {
  background: var(--app-surface-2);
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
}
.sup-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #1e293b;
}
.sup-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--app-text-strong);
  margin: 0;
}

/* Ticket Form */
.sup-ticket-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sup-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sup-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sup-field-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sup-input,
.sup-select,
.sup-textarea {
  background: #0a0e17;
  border: 1px solid #1e293b;
  color: var(--app-text-strong);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.sup-input:focus,
.sup-select:focus,
.sup-textarea:focus {
  border-color: var(--app-primary);
}
.sup-input::placeholder,
.sup-textarea::placeholder {
  color: #475569;
}
.sup-textarea {
  resize: vertical;
  min-height: 80px;
}
.sup-select {
  cursor: pointer;
}

/* File Upload */
.sup-file-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #0a0e17;
  border: 1px dashed #1e293b;
  border-radius: 6px;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s;
}
.sup-file-upload:hover {
  border-color: var(--app-primary);
  color: #94a3b8;
}
.sup-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Submit Button */
.sup-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--app-primary);
  color: #0a0e17;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
}
.sup-submit-btn:hover {
  background: #7dcbf0;
}

/* Tickets Table */
.sup-tickets-table-wrap {
  overflow-x: auto;
}
.sup-tickets-table {
  width: 100%;
  border-collapse: collapse;
}
.sup-tickets-table thead th {
  background: #0d1320;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid #1e293b;
}
.sup-tickets-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}
.sup-tickets-table tbody tr:last-child td {
  border-bottom: none;
}
.sup-tickets-table tbody tr:hover {
  background: rgba(92, 184, 230, 0.03);
}
.ticket-id {
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--app-primary);
  font-size: 12px;
}

/* Ticket Status */
.ticket-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ticket-status.open {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.ticket-status.in-progress {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.ticket-status.resolved {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* ---- Fast-render boot (ticket pages) ----
   The ticket pages (New Request / My Requests) always redirect logged-out users,
   so they boot straight into the app chrome + a spinner instead of the blank
   public-mode gap while auth + bootstrap resolve. `support-booting` hides the
   public marketing chrome; the spinner shows immediately and is removed the
   moment the ticket UI is revealed. */
body.support-booting .public-header,
body.support-booting .public-footer,
body.support-booting .public-footer-bottom,
body.support-booting .mobile-nav-overlay { display: none !important; }
.sup-boot-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 80px 20px; min-height: 200px;
}
.sup-boot-loading[hidden] { display: none !important; }
.sup-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(var(--app-content-overlay-rgb, 127,127,127), 0.18);
  border-top-color: var(--app-primary, #e0a050);
  animation: sup-spin 0.7s linear infinite;
}
@keyframes sup-spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 1024px) {
  .sup-two-col {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .sup-contact-grid {
    grid-template-columns: 1fr;
  }
  .sup-form-row {
    grid-template-columns: 1fr;
  }
  .sup-tickets-table {
    min-width: 500px;
  }
}

/* ===== Ultimo light overrides — Support (audit 2026-06-25) =====
   Page was full VESTEX dark: FAQ category band (#0d131e), faint #94a3b8 answers/labels,
   ticket-form inputs on dark #0a0e17 (dark text → invisible), recent-tickets table dark
   header + faint #cbd5e1 rows. Flip to light surfaces + dark/readable text. Scoped → vestex zero-diff. */
html[data-brand="ultimo"] .sup-faq-category { background: var(--app-surface-2); color: var(--app-text-strong); }
html[data-brand="ultimo"] .sup-faq-answer p,
html[data-brand="ultimo"] .sup-field-label { color: var(--app-text-muted); }
html[data-brand="ultimo"] .sup-faq-item,
html[data-brand="ultimo"] .sup-panel,
html[data-brand="ultimo"] .sup-panel-header { border-color: var(--app-border); }
html[data-brand="ultimo"] .sup-input,
html[data-brand="ultimo"] .sup-select,
html[data-brand="ultimo"] .sup-textarea,
html[data-brand="ultimo"] .sup-file-upload {
  background-color: var(--app-surface-1);
  border-color: var(--app-border);
}
html[data-brand="ultimo"] .sup-submit-btn:hover { background: var(--app-primary-hover); }
html[data-brand="ultimo"] .sup-tickets-table thead th { background: var(--app-surface-2); border-bottom-color: var(--app-border); }
html[data-brand="ultimo"] .sup-tickets-table tbody td { color: var(--app-text-1); border-bottom-color: var(--app-border); }

/* ===== Support Tickets (Zendesk, per-whitelabel) ===== */
/* Scoped to the #supTickets block + .sup-modal-* / .sup-toast — does NOT touch
   the existing .sup-contact-* / .sup-faq-* rules (#317 alignment preserved). */

#supTickets[hidden], #supModal[hidden] { display: none !important; }

.sup-ticket-panel {
  background: var(--app-surface-card);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
}
.sup-ticket-intro { color: var(--app-text-muted); font-size: 14px; margin-bottom: 18px; }

.sup-ticket-userinfo { margin-bottom: 20px; }
.sup-uinfo-title { font-size: 12px; color: var(--app-text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.sup-uinfo-row { display: flex; gap: 12px; padding: 6px 0; font-size: 14px; }

/* Multi-card: "Which card is this about?" (optional radio, nothing preselected) */
.sup-field[hidden] { display: none; }
.sup-radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sup-radio { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--app-text-1); cursor: pointer; }
.sup-radio input { accent-color: var(--app-primary); width: 16px; height: 16px; margin: 0; }
.sup-uinfo-label { width: 180px; flex: 0 0 auto; color: var(--app-text-muted); }
.sup-uinfo-value { color: var(--app-text-1); word-break: break-all; }

.sup-ticket-form .sup-field { margin-bottom: 16px; }
.sup-ticket-form .sup-input,
.sup-ticket-form .sup-select,
.sup-ticket-form .sup-textarea,
.sup-req-toolbar .sup-input,
.sup-req-toolbar .sup-select,
.sup-modal-footer .sup-input,
.sup-modal-footer .sup-textarea {
  width: 100%;
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  color: var(--app-text-1);
  font-size: 14px;
  padding: 10px 12px;
}
.sup-textarea { resize: vertical; }

.sup-req-toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.sup-req-search { flex: 1 1 auto; }
.sup-req-status { flex: 0 0 160px; }

.sup-req-table-wrap { overflow-x: auto; }
.sup-req-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sup-req-table th {
  text-align: left; padding: 10px 12px; color: var(--app-text-muted);
  font-weight: 600; border-bottom: 1px solid var(--app-border); white-space: nowrap;
}
.sup-req-table td { padding: 12px; border-bottom: 1px solid var(--app-border); color: var(--app-text-1); }
.sup-req-id { white-space: nowrap; font-weight: 600; }
.sup-req-subject { word-break: break-word; }
.sup-req-empty { text-align: center; color: var(--app-text-muted); padding: 24px 12px; }

.sup-detail-btn {
  background: var(--app-surface-2); border: 1px solid var(--app-border);
  color: var(--app-text-1); border-radius: 8px; padding: 6px 16px;
  font-size: 13px; cursor: pointer;
}
.sup-detail-btn:hover { border-color: var(--app-primary); color: var(--app-primary); }

.sup-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: #fff;
}
.sup-badge-open { background: #dc3545; }
.sup-badge-pending { background: #4a7dbd; }
.sup-badge-answered { background: #2f80ed; }
.sup-badge-solved { background: #6c757d; }
.sup-badge-other { background: #b58a2c; }

/* Modal */
.sup-modal-overlay {
  /* z-index above the app sidebar (--z-sidebar 1110) and the AI-chat FAB (9998)
     so the request-detail modal + its backdrop cover them, not the reverse. */
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(var(--app-content-overlay-rgb), 0.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
body.sup-modal-open { overflow: hidden; }
.sup-modal {
  background: var(--app-surface-card); border: 1px solid var(--app-border);
  border-radius: 12px; width: 100%; max-width: 900px; max-height: 90vh;
  display: flex; flex-direction: column;
}
.sup-modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px; border-bottom: 1px solid var(--app-border);
}
.sup-modal-subject { font-size: 16px; font-weight: 700; color: var(--app-text-strong); word-break: break-word; }
.sup-modal-meta { margin-top: 4px; font-size: 13px; color: var(--app-text-muted); display: flex; gap: 10px; align-items: center; }
.sup-modal-close {
  background: none; border: none; color: var(--app-text-muted);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.sup-modal-close:hover { color: var(--app-text-1); }
.sup-modal-body { display: flex; gap: 20px; padding: 20px; overflow-y: auto; flex: 1 1 auto; }
.sup-modal-fields { flex: 0 0 32%; border-right: 1px solid var(--app-border); padding-right: 16px; }
.sup-modal-field { margin-bottom: 12px; }
.sup-modal-field-label { font-size: 12px; color: var(--app-text-muted); font-weight: 600; }
.sup-modal-field-value { font-size: 14px; color: var(--app-text-1); word-break: break-all; }
.sup-modal-thread { flex: 1 1 auto; min-width: 0; }

.sup-cmt { display: flex; gap: 10px; margin-bottom: 16px; }
.sup-cmt-avatar { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; object-fit: cover; }
.sup-cmt-main { min-width: 0; flex: 1 1 auto; }
.sup-cmt-head { font-size: 13px; font-weight: 600; color: var(--app-text-muted); margin-bottom: 4px; }
.sup-cmt.mine .sup-cmt-head { color: var(--app-text-1); }
.sup-cmt-time { font-weight: 400; font-size: 12px; margin-left: 6px; }
.sup-cmt-body {
  background: var(--app-surface-2); border: 1px solid var(--app-border);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--app-text-1);
  word-break: break-word; overflow-wrap: anywhere;
}
.sup-cmt.mine .sup-cmt-body { background: rgba(92, 184, 230, 0.10); }
.sup-cmt-body img { max-width: 100%; }
.sup-att {
  display: block; margin-top: 10px; max-width: 200px; text-decoration: none;
  border: 1px solid var(--app-border); border-radius: 8px; overflow: hidden;
  color: var(--app-text-muted); font-size: 12px;
}
.sup-att img { display: block; width: 100%; }
.sup-att span { display: block; padding: 6px 8px; word-break: break-all; }
.sup-att-noimg .sup-att-ph {
  display: block; padding: 18px 8px; text-align: center;
  background: var(--app-surface-2, rgba(127,127,127,0.08)); color: var(--app-text-muted); font-style: italic;
}
/* Non-image attachment (PDF etc.) → a compact download row. */
.sup-att-file {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  color: var(--app-text-strong); cursor: pointer;
}
.sup-att-file:hover { background: rgba(var(--app-content-overlay-rgb, 127,127,127), 0.06); }
.sup-att-file span { display: inline; padding: 0; }
.sup-att-file .sup-att-fileicon {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--app-primary, #e0a050); color: #fff; font-weight: 700; font-size: 12px;
}

.sup-modal-footer {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 20px; border-top: 1px solid var(--app-border);
}
.sup-reply-file { flex: 0 0 30%; }
.sup-reply-text { flex: 1 1 auto; }
.sup-reply-btn { flex: 0 0 auto; width: auto; padding: 10px 22px; }

/* Toasts */
/* Toasts sit ABOVE the AI-chat FAB (bottom:24px right:24px, ~52px, z-index 9998):
   raise bottom past the FAB and z-index above it so a submit toast is not hidden. */
#supToastHost { position: fixed; right: 20px; bottom: 92px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 480px) { #supToastHost { bottom: 84px; right: 12px; left: 12px; } }
.sup-toast {
  background: var(--app-surface-card); color: var(--app-text-1);
  border: 1px solid var(--app-border); border-left: 4px solid var(--app-primary);
  border-radius: 8px; padding: 10px 16px; font-size: 13px; max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); transition: opacity 0.4s ease;
}
.sup-toast-err { border-left-color: #dc3545; }
.sup-toast-warn { border-left-color: #e0a050; }
.sup-toast-ok { border-left-color: #10b981; }
.sup-toast.out { opacity: 0; }

/* My Requests header row (title + New Request shortcut) */
.sup-req-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
/* Title provides its own bottom margin normally; inside the head row the row's
   margin-bottom handles the gap to the search card, so zero the title's. */
.sup-req-head .sup-section-title { margin: 0; }
.sup-new-req-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
  .sup-modal-body { flex-direction: column; }
  .sup-modal-fields { flex: none; border-right: none; border-bottom: 1px solid var(--app-border); padding-right: 0; padding-bottom: 12px; }
  .sup-modal-footer { flex-wrap: wrap; }
  .sup-reply-file { flex: 1 1 100%; }
  .sup-uinfo-label { width: 140px; }
  .sup-req-head { align-items: flex-start; }
}
