/* ============================================
   Service Ticket Plugin — Fare Co-op Dark Theme
   Matches global design system exactly
============================================ */

:root {
  --stp-bg:        #070c18;
  --stp-surface:   #0c1424;
  --stp-surface2:  #111d33;
  --stp-surface3:  #162035;
  --stp-border:    rgba(255,255,255,0.07);
  --stp-border-a:  rgba(30,214,255,0.25);
  --stp-text:      #e8f1ff;
  --stp-muted:     #6a82a8;
  --stp-cyan:      #1ed6ff;
  --stp-green:     #6eeb7a;
  --stp-red:       #ff6b7a;
  --stp-grad:      linear-gradient(120deg,#1ed6ff,#6eeb7a);
  --stp-r:         12px;
  --stp-font:      'Plus Jakarta Sans', sans-serif;
  --stp-head:      'Syne', sans-serif;
}

/* ── Base container ── */
.stp-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  color: var(--stp-text);
  font-family: var(--stp-font);
}

/* ── Email gate form ── */
.stp-email-form-wrapper {
  background: var(--stp-surface);
  border: 0.5px solid var(--stp-border);
  padding: 40px 36px;
  border-radius: 20px;
  max-width: 480px;
  margin: 40px auto;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.stp-email-form-wrapper h2 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-family: var(--stp-head);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--stp-text);
  letter-spacing: -0.02em;
}

.stp-email-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Form groups ── */
.stp-form-group {
  margin-bottom: 14px;
  text-align: left;
}

.stp-form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stp-muted);
  font-family: var(--stp-head);
}

.stp-required { color: var(--stp-red); }

.stp-form-group input,
.stp-form-group textarea,
.stp-form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 0.5px solid var(--stp-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--stp-font);
  box-sizing: border-box;
  background: var(--stp-surface2);
  color: var(--stp-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.stp-form-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.stp-form-group input:focus,
.stp-form-group textarea:focus,
.stp-form-group select:focus {
  border-color: var(--stp-border-a);
  box-shadow: 0 0 0 3px rgba(30,214,255,0.08);
}

.stp-form-group input::placeholder,
.stp-form-group textarea::placeholder {
  color: var(--stp-muted);
  opacity: 0.6;
}

.stp-form-group select option {
  background: var(--stp-surface2);
  color: var(--stp-text);
}

.stp-form-group small {
  display: block;
  margin-top: 5px;
  color: var(--stp-muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ── Buttons ── */
.stp-btn {
  display: inline-block;
  padding: 10px 22px;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--stp-head);
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  text-align: center;
  white-space: nowrap;
}
.stp-btn:hover { opacity: 0.85; transform: translateY(-1px); }

.stp-btn-primary {
  background: var(--stp-grad);
  color: #070c18 !important;
}

.stp-btn-secondary {
  background: var(--stp-surface2);
  color: var(--stp-text);
  border: 0.5px solid var(--stp-border);
}
.stp-btn-secondary:hover {
  border-color: var(--stp-border-a);
  color: var(--stp-cyan);
}

.stp-link-btn {
  color: var(--stp-cyan);
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.2s;
}
.stp-link-btn:hover { color: var(--stp-green); text-decoration: underline; }

/* ── Alerts ── */
.stp-alert {
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: var(--stp-r);
  border-left: 3px solid var(--stp-border);
  font-size: 14px;
  line-height: 1.55;
}

.stp-alert-success {
  background: rgba(110,235,122,0.08);
  color: var(--stp-green);
  border-left-color: var(--stp-green);
}

.stp-alert-error {
  background: rgba(255,107,122,0.08);
  color: var(--stp-red);
  border-left-color: var(--stp-red);
}

.stp-alert-warning {
  background: rgba(255,193,7,0.08);
  color: #ffc107;
  border-left-color: #ffc107;
}

.stp-alert-info {
  background: rgba(30,214,255,0.06);
  color: var(--stp-cyan);
  border-left-color: var(--stp-cyan);
}

/* ── Header ── */
.stp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 20px;
}

.stp-header h2 {
  margin: 0;
  flex: 1;
  font-family: var(--stp-head);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--stp-text);
  letter-spacing: -0.02em;
}

/* ── Tickets grid ── */
.stp-tickets-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.stp-ticket-item {
  border: 0.5px solid var(--stp-border);
  border-radius: 16px;
  padding: 20px;
  background: var(--stp-surface);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.stp-ticket-item:hover {
  transform: translateY(-3px);
  border-color: var(--stp-border-a);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.stp-ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 10px;
}

.stp-ticket-title-section h3 {
  margin: 0 0 6px 0;
  font-family: var(--stp-head);
  font-weight: 700;
  font-size: 15px;
  color: var(--stp-text);
  line-height: 1.3;
}

.stp-ticket-id {
  display: inline-block;
  font-size: 11px;
  color: var(--stp-muted);
  background: var(--stp-surface2);
  padding: 2px 8px;
  border-radius: 100px;
  font-family: monospace;
  border: 0.5px solid var(--stp-border);
}

/* ── Status badges ── */
.stp-status-badge,
.stp-status-badge-large {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 100px;
  color: #070c18;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--stp-head);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--stp-grad);
}

.stp-status-badge-large {
  font-size: 13px;
  padding: 7px 16px;
}

/* Status colour overrides */
.stp-status-badge[data-status="open"],
.stp-status-badge-large[data-status="open"] {
  background: linear-gradient(120deg,#1ed6ff,#6eeb7a);
  color: #070c18;
}
.stp-status-badge[data-status="closed"],
.stp-status-badge-large[data-status="closed"] {
  background: var(--stp-surface2);
  color: var(--stp-muted);
  border: 0.5px solid var(--stp-border);
}
.stp-status-badge[data-status="pending"],
.stp-status-badge-large[data-status="pending"] {
  background: rgba(255,193,7,0.15);
  color: #ffc107;
  border: 0.5px solid rgba(255,193,7,0.3);
}
.stp-status-badge[data-status="in-progress"],
.stp-status-badge-large[data-status="in-progress"] {
  background: rgba(167,139,250,0.15);
  color: #a78bfa;
  border: 0.5px solid rgba(167,139,250,0.3);
}

/* ── Ticket meta ── */
.stp-ticket-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--stp-muted);
  flex-wrap: wrap;
  align-items: center;
}

.stp-ticket-category {
  background: var(--stp-surface2);
  padding: 3px 10px;
  border-radius: 100px;
  border: 0.5px solid var(--stp-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--stp-muted);
}

.stp-ticket-preview {
  color: var(--stp-muted);
  margin: 10px 0;
  line-height: 1.55;
  font-size: 14px;
}

/* ── Ticket detail ── */
.stp-ticket-detail {
  background: transparent;
  padding: 0;
}

.stp-ticket-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 0.5px solid var(--stp-border);
  gap: 20px;
}

.stp-ticket-detail-header h2 {
  margin: 0 0 8px 0;
  font-family: var(--stp-head);
  font-weight: 700;
  font-size: clamp(1.2rem,3vw,1.6rem);
  color: var(--stp-text);
  letter-spacing: -0.02em;
}

.stp-ticket-id-large {
  font-size: 13px;
  color: var(--stp-muted);
  margin: 0;
  font-family: monospace;
}

.stp-ticket-meta-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
  padding: 16px 20px;
  background: var(--stp-surface2);
  border-radius: var(--stp-r);
  border: 0.5px solid var(--stp-border);
}

.stp-meta-item { font-size: 14px; }

.stp-meta-item strong {
  color: var(--stp-cyan);
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--stp-head);
}

/* ── Ticket content ── */
.stp-ticket-content { margin-bottom: 28px; }

.stp-ticket-content h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--stp-text);
  font-family: var(--stp-head);
  font-weight: 700;
}

.stp-ticket-body {
  background: var(--stp-surface2);
  padding: 16px 20px;
  border-radius: var(--stp-r);
  border: 0.5px solid var(--stp-border);
  line-height: 1.7;
  color: var(--stp-muted);
  font-size: 14px;
}

/* ── Replies ── */
.stp-replies-section { margin-bottom: 28px; }

.stp-replies-section h3 {
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--stp-text);
  font-family: var(--stp-head);
  font-weight: 700;
}

.stp-replies-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.stp-reply {
  border: 0.5px solid var(--stp-border);
  border-radius: var(--stp-r);
  padding: 16px 18px;
  background: var(--stp-surface2);
}

.stp-reply-admin {
  border-left: 3px solid var(--stp-green);
  background: rgba(110,235,122,0.04);
}

.stp-reply-user {
  border-left: 3px solid var(--stp-cyan);
  background: rgba(30,214,255,0.04);
}

.stp-reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.stp-reply-author {
  font-size: 14px;
  color: var(--stp-text);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.stp-admin-badge {
  display: inline-block;
  background: var(--stp-green);
  color: #070c18;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--stp-head);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stp-reply-date {
  font-size: 12px;
  color: var(--stp-muted);
}

.stp-reply-content {
  color: var(--stp-muted);
  line-height: 1.65;
  margin-bottom: 8px;
  font-size: 14px;
}

.stp-reply-attachments {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--stp-border);
}

.stp-reply-attachments strong {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stp-muted);
  font-family: var(--stp-head);
}

.stp-reply-attachments ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stp-reply-attachments li { margin-bottom: 4px; }

.stp-reply-attachments a {
  color: var(--stp-cyan);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}
.stp-reply-attachments a:hover { color: var(--stp-green); }

/* ── Reply form section ── */
.stp-reply-form-section {
  background: var(--stp-surface2);
  padding: 20px;
  border-radius: var(--stp-r);
  border: 0.5px solid var(--stp-border);
}

.stp-reply-form { margin-top: 14px; }

.stp-reply-form .stp-form-group:last-child { margin-bottom: 0; }

/* ── Form actions ── */
.stp-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ── Modal ── */
.stp-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6,10,20,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9998;
}

.stp-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--stp-surface);
  border: 0.5px solid var(--stp-border-a);
  border-radius: 20px;
  padding: 28px 32px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  color: var(--stp-text);
}

.stp-modal::-webkit-scrollbar { width: 4px; }
.stp-modal::-webkit-scrollbar-track { background: var(--stp-surface); }
.stp-modal::-webkit-scrollbar-thumb { background: rgba(30,214,255,0.2); border-radius: 2px; }

.stp-modal h3 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-family: var(--stp-head);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--stp-text);
}

.stp-modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: var(--stp-surface2);
  border: 0.5px solid var(--stp-border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  color: var(--stp-muted);
  line-height: 1;
  padding: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.stp-modal-close:hover {
  background: rgba(255,107,122,0.12);
  border-color: rgba(255,107,122,0.3);
  color: var(--stp-red);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .stp-container { padding: 16px; }
  .stp-tickets-list { grid-template-columns: 1fr; }
  .stp-ticket-detail-header { flex-direction: column; }
  .stp-header { flex-direction: column; align-items: stretch; }
  .stp-header .stp-btn { width: 100%; }
  .stp-modal { width: 95%; padding: 22px 18px; }
  .stp-form-actions { flex-direction: column; }
  .stp-form-actions .stp-btn { width: 100%; }
  .stp-email-form-wrapper { padding: 28px 20px; }
}

/* ── Zero Tolerance / CPUC (California) safety notice ── */
.stp-zero-tolerance-box {
  margin: 18px 0 24px;
  padding: 18px 20px;
  background: rgba(255,193,7,0.08);
  border: 0.5px solid rgba(255,193,7,0.32);
  border-left: 4px solid #ffc107;
  border-radius: 14px;
  color: var(--stp-text);
}

.stp-email-form-wrapper .stp-zero-tolerance-box {
  text-align: left;
}

.stp-zero-tolerance-compact {
  margin: 16px 0;
  padding: 14px 16px;
}

.stp-zero-tolerance-box h3 {
  margin: 0 0 8px;
  font-family: var(--stp-head);
  font-size: 15px;
  color: #ffc107;
  letter-spacing: -0.01em;
}

.stp-zero-tolerance-box p {
  margin: 0 0 12px;
  line-height: 1.6;
  color: var(--stp-text);
  font-size: 14px;
}

.stp-zero-tolerance-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.stp-zero-tolerance-contacts {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid rgba(255,255,255,0.10);
  color: var(--stp-muted);
  font-size: 13px;
  line-height: 1.7;
}

.stp-zero-tolerance-contacts strong {
  color: var(--stp-text);
}

.stp-zero-tolerance-contacts a {
  color: var(--stp-cyan);
  text-decoration: none;
}

.stp-zero-tolerance-contacts a:hover {
  color: var(--stp-green);
  text-decoration: underline;
}

