/* ═══════════════════════════════════════════════════
   Contact Support Page Styles
   ═══════════════════════════════════════════════════ */

/* ── Top Bar ────────────────────────────────────── */
.support-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.support-back-link {
  color: var(--clr-primary-teal, #12b3b3);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.2s;
}

.support-back-link:hover {
  opacity: 0.7;
}

.support-logo {
  height: 28px;
  width: auto;
}

/* ── Container ──────────────────────────────────── */
.support-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Header ─────────────────────────────────────── */
.support-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.support-header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--clr-text-primary, #1a1a2e);
}

.support-header p {
  color: #666;
  font-size: 1rem;
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Quick Options Grid ─────────────────────────── */
.support-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.support-option-card {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: inherit;
  font-size: inherit;
}

.support-option-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-color: var(--clr-primary-teal, #12b3b3);
}

.option-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #f0f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #555;
  margin-bottom: 0.75rem;
}

.option-icon--primary {
  background: rgba(18, 179, 179, 0.1);
  color: var(--clr-primary-teal, #12b3b3);
}

.support-option-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.support-option-card p {
  font-size: 0.82rem;
  color: #888;
  margin: 0;
}

/* ── Sections ───────────────────────────────────── */
.support-section {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.section-header h2 i {
  color: var(--clr-primary-teal, #12b3b3);
}

.btn-close-section {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 1.1rem;
  padding: 0.25rem;
  transition: color 0.2s;
}

.btn-close-section:hover {
  color: #333;
}

/* ── Ticket Form ────────────────────────────────── */
.ticket-form .form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.ticket-form .form-group {
  margin-bottom: 1rem;
  position: relative;
}

.ticket-form label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  color: #333;
}

.ticket-form input,
.ticket-form select,
.ticket-form textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
  box-sizing: border-box;
}

.ticket-form input:focus,
.ticket-form select:focus,
.ticket-form textarea:focus {
  outline: none;
  border-color: var(--clr-primary-teal, #12b3b3);
  box-shadow: 0 0 0 3px rgba(18, 179, 179, 0.12);
  background: white;
}

.ticket-form textarea {
  resize: vertical;
  min-height: 100px;
}

.char-count {
  position: absolute;
  right: 8px;
  bottom: -18px;
  font-size: 0.75rem;
  color: #aaa;
}

.form-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.75rem;
}

.form-actions .btn {
  padding: 0.65rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.2s, transform 0.15s;
}

.form-actions .btn:active {
  transform: scale(0.97);
}

.form-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-actions .btn-primary {
  background: var(--clr-primary-teal, #12b3b3);
  color: white;
}

.form-actions .btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

/* ── AI Response Card ───────────────────────────── */
.ai-response-card {
  background: linear-gradient(135deg, rgba(18, 179, 179, 0.04), rgba(18, 179, 179, 0.01));
  border: 1px solid rgba(18, 179, 179, 0.15);
  border-radius: 12px;
  padding: 1.25rem;
}

.ai-response-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 0.75rem;
}

.ai-response-status.status-resolved {
  background: rgba(46, 204, 113, 0.12);
  color: #27ae60;
}

.ai-response-status.status-escalated {
  background: rgba(241, 196, 15, 0.12);
  color: #f39c12;
}

.ai-response-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #333;
  white-space: pre-wrap;
}

.ai-response-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-response-actions .btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #ddd;
  background: white;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}

.ai-response-actions .btn:hover {
  border-color: var(--clr-primary-teal, #12b3b3);
  color: var(--clr-primary-teal, #12b3b3);
}

.ai-response-actions .btn-outline-danger {
  border-color: #e74c3c;
  color: #e74c3c;
}

.ai-response-actions .btn-outline-danger:hover {
  background: rgba(231, 76, 60, 0.06);
}

/* ── Follow-up Thread ───────────────────────────── */
.ticket-thread {
  margin-top: 1.25rem;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.thread-message {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  max-width: 85%;
  font-size: 0.9rem;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.thread-message.msg-user {
  background: var(--clr-primary-teal, #12b3b3);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.thread-message.msg-ai {
  background: #f0f4f8;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.thread-message.msg-admin {
  background: rgba(155, 89, 182, 0.1);
  color: #333;
  align-self: flex-start;
  border-left: 3px solid #9b59b6;
  border-bottom-left-radius: 4px;
}

.thread-message .msg-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  margin-bottom: 0.2rem;
}

.thread-message .msg-time {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-top: 0.3rem;
}

.followup-input-area {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: flex-end;
}

.followup-input-area textarea {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.followup-input-area textarea:focus {
  outline: none;
  border-color: var(--clr-primary-teal, #12b3b3);
}

.followup-input-area .btn {
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.followup-input-area .btn-primary {
  background: var(--clr-primary-teal, #12b3b3);
  color: white;
}

.followup-input-area .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Tickets List ───────────────────────────────── */
.tickets-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tickets-loading {
  text-align: center;
  padding: 2rem;
  color: #888;
}

.tickets-empty {
  text-align: center;
  padding: 2rem;
  color: #999;
}

.tickets-empty i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
  opacity: 0.4;
}

.ticket-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #eee;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ticket-row:hover {
  background: #f8fafb;
  border-color: var(--clr-primary-teal, #12b3b3);
}

.ticket-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f0f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #666;
  flex-shrink: 0;
}

.ticket-row-body {
  flex: 1;
  min-width: 0;
}

.ticket-row-subject {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-row-meta {
  font-size: 0.78rem;
  color: #999;
  margin-top: 0.15rem;
}

.ticket-status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-open, .badge-escalated {
  background: rgba(241, 196, 15, 0.12);
  color: #d4a017;
}

.badge-ai_resolved {
  background: rgba(46, 204, 113, 0.12);
  color: #27ae60;
}

.badge-in_progress {
  background: rgba(52, 152, 219, 0.12);
  color: #2980b9;
}

.badge-resolved, .badge-closed {
  background: rgba(149, 165, 166, 0.15);
  color: #7f8c8d;
}

/* ── Ticket Detail ──────────────────────────────── */
.ticket-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.detail-meta-item {
  font-size: 0.85rem;
}

.detail-meta-item .meta-label {
  font-weight: 600;
  color: #888;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.detail-meta-item .meta-value {
  color: #333;
}

/* ── FAQ ────────────────────────────────────────── */
.support-faq {
  margin-top: 2.5rem;
}

.support-faq h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: center;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item[open] {
  border-color: var(--clr-primary-teal, #12b3b3);
}

.faq-item summary {
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.7rem;
  color: #aaa;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(180deg);
}

.faq-item p {
  padding: 0 1rem 0.85rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #555;
  margin: 0;
}

.faq-item a {
  color: var(--clr-primary-teal, #12b3b3);
}

/* ── Loading spinner for AI ─────────────────────── */
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  color: #888;
  font-size: 0.9rem;
}

.ai-thinking i {
  color: var(--clr-primary-teal, #12b3b3);
}

/* ── Mobile ─────────────────────────────────────── */
@media (max-width: 600px) {
  .support-options-grid {
    grid-template-columns: 1fr;
  }

  .support-container {
    padding: 1.25rem 1rem 3rem;
  }

  .support-header {
    margin-bottom: 1.5rem;
  }

  .ai-response-actions {
    flex-direction: column;
  }

  .ai-response-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .ticket-detail-meta {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Dark Mode ──────────────────────────────────── */
[data-theme="dark"] .support-topbar,
.dark-mode .support-topbar {
  background: rgba(30, 30, 50, 0.96);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .support-option-card,
.dark-mode .support-option-card {
  background: #1e1e32;
  border-color: #2a2a45;
  color: #e0e0e0;
}

[data-theme="dark"] .support-section,
.dark-mode .support-section {
  background: #1e1e32;
  border-color: #2a2a45;
}

[data-theme="dark"] .option-icon,
.dark-mode .option-icon {
  background: rgba(255, 255, 255, 0.06);
  color: #aaa;
}

[data-theme="dark"] .ticket-form input,
[data-theme="dark"] .ticket-form select,
[data-theme="dark"] .ticket-form textarea,
.dark-mode .ticket-form input,
.dark-mode .ticket-form select,
.dark-mode .ticket-form textarea {
  background: #16162a;
  border-color: #2a2a45;
  color: #e0e0e0;
}

[data-theme="dark"] .ai-response-card,
.dark-mode .ai-response-card {
  background: rgba(18, 179, 179, 0.06);
  border-color: rgba(18, 179, 179, 0.2);
}

[data-theme="dark"] .ai-response-body,
.dark-mode .ai-response-body {
  color: #d0d0d0;
}

[data-theme="dark"] .thread-message.msg-ai,
.dark-mode .thread-message.msg-ai {
  background: #2a2a45;
  color: #d0d0d0;
}

[data-theme="dark"] .ticket-row,
.dark-mode .ticket-row {
  border-color: #2a2a45;
}

[data-theme="dark"] .ticket-row:hover,
.dark-mode .ticket-row:hover {
  background: #16162a;
}

[data-theme="dark"] .faq-item,
.dark-mode .faq-item {
  border-color: #2a2a45;
}

[data-theme="dark"] .faq-item p,
.dark-mode .faq-item p {
  color: #aaa;
}

[data-theme="dark"] .followup-input-area textarea,
.dark-mode .followup-input-area textarea {
  background: #16162a;
  border-color: #2a2a45;
  color: #e0e0e0;
}
