/* Feedback dialog + support-ticket lists.
 * Loaded globally from base.html (the app shell's hx-boost body swap never
 * re-injects <head>, so per-page <link>s wouldn't apply on boosted nav). */

/* ---- Dialog --------------------------------------------------------- */
.feedback-modal__body {
  padding-top: 1rem;
}

.feedback-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .feedback-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}

/* Prominent, card-style screenshot toggle (selected by default). */
.feedback-shot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface-1, #fff);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.feedback-shot:hover {
  border-color: var(--primary, #4f46e5);
}
.feedback-shot:has(.feedback-shot__input:checked) {
  border-color: var(--primary, #4f46e5);
  background: color-mix(in srgb, var(--primary, #4f46e5) 6%, transparent);
  box-shadow: inset 0 0 0 1px var(--primary, #4f46e5);
}
.feedback-shot__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-subtle, #64748b);
}
.feedback-shot:has(.feedback-shot__input:checked) .feedback-shot__icon {
  background: var(--primary, #4f46e5);
  color: #fff;
}
.feedback-shot__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.feedback-shot__title {
  font-weight: 600;
  line-height: 1.3;
}
.feedback-shot__hint {
  display: block;
}
.feedback-shot__input {
  flex: none;
  margin: 0 0.1rem 0 auto;
  width: 1.15rem;
  height: 1.15rem;
}

.feedback-shot-status.is-busy {
  opacity: 0.75;
}

/* ---- "What you're sending" preview ---------------------------------- */
.feedback-preview {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface-2, #f8fafc);
  padding: 1rem;
  font-size: 0.875rem;
  height: 100%;
}
.feedback-preview__head {
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.feedback-preview__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  margin: 0 0 0.75rem;
}
.feedback-preview__meta dt {
  color: var(--text-subtle, #64748b);
  font-weight: 500;
}
.feedback-preview__meta dd {
  margin: 0;
  word-break: break-word;
}
.feedback-preview__url {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8em;
}
.feedback-preview__subject {
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.feedback-preview__message {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 9rem;
  overflow: auto;
}
.feedback-preview__shot {
  margin: 0.75rem 0 0;
}
.feedback-preview__shot img {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  display: block;
}

/* ---- Success state (animated tick) ---------------------------------- */
.feedback-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  padding: 2.25rem 1rem 1.75rem;
}
.feedback-success__tick {
  display: block;
  width: 78px;
  height: 78px;
  margin-bottom: 0.85rem;
}
.feedback-success__tick svg {
  display: block;
  width: 100%;
  height: 100%;
  animation: fb-tick-pop 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.feedback-success__tick-circle,
.feedback-success__tick-check {
  fill: none;
  stroke: var(--success, #16a34a);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feedback-success__tick-circle {
  stroke-dasharray: 151;   /* ≈ 2πr, r=24 */
  stroke-dashoffset: 151;
  animation: fb-tick-draw 0.5s ease-out forwards;
}
.feedback-success__tick-check {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: fb-tick-draw 0.28s 0.44s ease-out forwards;
}
@keyframes fb-tick-draw { to { stroke-dashoffset: 0; } }
@keyframes fb-tick-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.feedback-success__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text, #0f172a);
}
.feedback-success__text {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--text-subtle, #64748b);
}
.feedback-success__link {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  .feedback-success__tick svg { animation: none; }
  .feedback-success__tick-circle,
  .feedback-success__tick-check {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* ---- Ticket lists --------------------------------------------------- */
.ticket-table {
  width: 100%;
  border-collapse: collapse;
}
.ticket-table th,
.ticket-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  vertical-align: top;
}
.ticket-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-subtle, #64748b);
}
.ticket-table tr:last-child td {
  border-bottom: none;
}
.ticket-table__num {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.85rem;
  white-space: nowrap;
}
.ticket-table__subject {
  font-weight: 600;
}
.ticket-table__excerpt {
  color: var(--text-subtle, #64748b);
  font-size: 0.85rem;
}

.ticket-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  text-transform: capitalize;
}
.ticket-badge--new { background: #e0f2fe; color: #075985; }
.ticket-badge--open { background: #e0e7ff; color: #3730a3; }
.ticket-badge--pending { background: #fef3c7; color: #92400e; }
.ticket-badge--hold { background: #fee2e2; color: #991b1b; }
.ticket-badge--solved,
.ticket-badge--closed { background: #dcfce7; color: #166534; }

/* ---- Filter + sort controls --------------------------------------- */
.ticket-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.ticket-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ticket-filter {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: box-shadow 0.12s ease, filter 0.12s ease;
}
.ticket-filter:hover { filter: brightness(0.97); }
/* Each pill carries the same colour as its status badge in the table. */
.ticket-filter--all     { background: var(--surface-2, #f1f5f9); color: var(--text-subtle, #475569); }
.ticket-filter--open    { background: #e0e7ff; color: #3730a3; }
.ticket-filter--pending { background: #fef3c7; color: #92400e; }
.ticket-filter--closed  { background: #dcfce7; color: #166534; }
/* Active pill: a ring in its own colour + slightly bolder. */
.ticket-filter.is-active {
  box-shadow: inset 0 0 0 2px currentColor;
  font-weight: 700;
}
.ticket-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ticket-sort .form-select {
  width: auto;
  min-width: 9.5rem;
}

.ticket-pager {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.ticket-pager .disabled {
  opacity: 0.5;
  pointer-events: none;
}

.ticket-kind {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-subtle, #475569);
  text-transform: capitalize;
}

/* ---- NPS survey modal ------------------------------------------------ */
.nps-modal .modal-content,
.nps-modal__content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .35);
  overflow: hidden;
}
.nps-modal .modal-dialog { max-width: 460px; }

.nps-modal__head {
  position: relative;
  padding: 1.5rem 1.5rem .25rem;
}
.nps-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  opacity: .45;
}
.nps-modal__close:hover { opacity: .8; }
.nps-modal__title {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -.01em;
  margin: 0 1.5rem 0 0;
  color: var(--text, #0f172a);
}
.nps-modal__sub {
  margin: .4rem 0 0;
  font-size: .82rem;
  color: var(--text-subtle, #64748b);
}
.nps-modal__body { padding: 1.25rem 1.5rem .5rem; }

.nps-scale {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 5px;
}
.nps-scale__btn {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 9px;
  background: var(--surface-1, #fff);
  color: var(--text, #334155);
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .06s ease;
}
.nps-scale__btn:hover {
  border-color: var(--primary, #4f46e5);
  background: color-mix(in srgb, var(--primary, #4f46e5) 7%, transparent);
}
.nps-scale__btn:active { transform: translateY(1px); }
.nps-scale__btn.is-selected {
  background: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--primary, #4f46e5) 60%, transparent);
}
.nps-scale__labels {
  display: flex;
  justify-content: space-between;
  margin-top: .5rem;
  font-size: .72rem;
  letter-spacing: .01em;
  color: var(--text-subtle, #94a3b8);
}
.nps-modal__comment { margin-top: 1rem; }
.nps-modal__comment textarea { border-radius: 10px; resize: none; }

.nps-modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: .75rem 1.5rem 1.25rem;
}
.nps-modal__skip {
  color: var(--text-subtle, #64748b);
  text-decoration: none;
  font-weight: 500;
}
.nps-modal__skip:hover { color: var(--text, #334155); }
.nps-modal__submit {
  border-radius: 9px;
  padding-inline: 1.4rem;
  font-weight: 600;
}
.nps-modal__submit:disabled { opacity: .5; }
