/* ========================================
   INDEX PAGE - Filter Pills & Table Card
   ======================================== */

/* Filter pill row */
.ticket-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ticket-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: white;
  text-decoration: none;
}

.ticket-filter-pill:hover {
  border-color: #d1d5db;
}

[data-theme="dark"] .ticket-filter-pill {
  background: #1f2937;
  border-color: #374151;
}

[data-theme="dark"] .ticket-filter-pill:hover {
  border-color: #4b5563;
}

.ticket-filter-pill .stat-count {
  font-weight: 700;
}

.ticket-filter-pill .stat-label {
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .ticket-filter-pill .stat-label {
  color: #9ca3af;
}

/* Pill color variants */
.ticket-filter-pill.is-open .stat-count, .ticket-filter-pill.is-open .fas { color: #3b82f6; }
.ticket-filter-pill.is-closed .stat-count, .ticket-filter-pill.is-closed .fas { color: #10b981; }
.ticket-filter-pill.is-all .stat-count, .ticket-filter-pill.is-all .fas { color: #8b5cf6; }

[data-theme="dark"] .ticket-filter-pill.is-open .stat-count, [data-theme="dark"] .ticket-filter-pill.is-open .fas { color: #60a5fa; }
[data-theme="dark"] .ticket-filter-pill.is-closed .stat-count, [data-theme="dark"] .ticket-filter-pill.is-closed .fas { color: #34d399; }
[data-theme="dark"] .ticket-filter-pill.is-all .stat-count, [data-theme="dark"] .ticket-filter-pill.is-all .fas { color: #a78bfa; }

/* Active pill (selected filter) */
.ticket-filter-pill.is-active { border-width: 2px; }
.ticket-filter-pill.is-active.is-open { border-color: #3b82f6; }
.ticket-filter-pill.is-active.is-closed { border-color: #10b981; }
.ticket-filter-pill.is-active.is-all { border-color: #8b5cf6; }

[data-theme="dark"] .ticket-filter-pill.is-active.is-open { border-color: #60a5fa; }
[data-theme="dark"] .ticket-filter-pill.is-active.is-closed { border-color: #34d399; }
[data-theme="dark"] .ticket-filter-pill.is-active.is-all { border-color: #a78bfa; }

/* Table card wrapper */
.ticket-table-card {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

[data-theme="dark"] .ticket-table-card {
  background: #1f2937;
  border-color: #374151;
}

.ticket-table-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
}

[data-theme="dark"] .ticket-table-card-header {
  border-color: #374151;
}

.ticket-table-card-body {
  padding: 0 1.25rem 1.25rem;
}

.ticket-table-card-body .table-container {
  margin-top: 1rem;
}

.ticket-table-card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}

[data-theme="dark"] .ticket-table-card-footer {
  border-color: #374151;
  background: #1a1f2e;
}

@media screen and (max-width: 768px) {
  .ticket-filter-row {
    gap: 0.375rem;
  }
}

/* ========================================
   SHOW PAGE - Hero Banner
   ======================================== */

.ticket-hero {
  border-radius: 12px;
  padding: 1.75rem 2rem;
  color: white;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* Status gradients */
.ticket-hero.is-submitted {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.ticket-hero.is-open {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.ticket-hero.is-pending {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.ticket-hero.is-on-hold {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  box-shadow: 0 4px 12px rgba(100, 116, 139, 0.25);
}

.ticket-hero.is-resolved {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.ticket-hero.is-closed {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.25);
}

.ticket-hero.is-new {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Dark mode hero gradients */
[data-theme="dark"] .ticket-hero.is-new {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ticket-hero.is-submitted {
  background: linear-gradient(135deg, #1e3a5f 0%, #172554 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ticket-hero.is-open {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
  border: 1px solid rgba(102, 126, 234, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ticket-hero.is-pending {
  background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ticket-hero.is-on-hold {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border: 1px solid rgba(100, 116, 139, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ticket-hero.is-resolved {
  background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ticket-hero.is-closed {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border: 1px solid rgba(107, 114, 128, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ticket-hero-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.ticket-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--bulma-size-large);
  flex-shrink: 0;
}

.ticket-hero-text h2 {
  font-size: var(--bulma-size-large);
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: white;
}

.ticket-hero-subtitle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  opacity: 0.9;
  font-size: var(--bulma-size-normal);
  flex-wrap: wrap;
}

.ticket-hero-subtitle code {
  background: rgba(0, 0, 0, 0.2);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: var(--bulma-size-small);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] .ticket-hero-subtitle code {
  background: rgba(255, 255, 255, 0.15);
}

.ticket-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button.ticket-hero-btn {
  --bulma-duration: 0ms;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: var(--bulma-size-normal);
}

.button.ticket-hero-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.button.ticket-hero-btn.is-danger {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  opacity: 0.8;
}

.button.ticket-hero-btn.is-danger:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  opacity: 1;
}

/* ========================================
   SHOW PAGE - Detail Card
   ======================================== */

.ticket-detail-card {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

[data-theme="dark"] .ticket-detail-card {
  background: #1f2937;
  border-color: #374151;
}

.ticket-detail-card-body {
  padding: 1.25rem;
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.ticket-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ticket-detail-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  font-weight: 500;
  font-size: var(--bulma-size-small);
}

[data-theme="dark"] .ticket-detail-label {
  color: #6b7280;
}

.ticket-detail-value {
  color: #374151;
}

[data-theme="dark"] .ticket-detail-value {
  color: #d1d5db;
}

.ticket-detail-secondary {
  display: block;
  color: #9ca3af;
  font-size: var(--bulma-size-small);
}

[data-theme="dark"] .ticket-detail-secondary {
  color: #6b7280;
}

.ticket-detail-card-footer {
  padding: 0.625rem 1.25rem;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: #6b7280;
  font-size: var(--bulma-size-small);
}

.ticket-detail-card-footer i {
  margin-right: 0.35rem;
}

[data-theme="dark"] .ticket-detail-card-footer {
  background: #1a2332;
  border-color: #374151;
  color: #9ca3af;
}

/* ========================================
   SHOW PAGE - Generic Card
   ======================================== */

.ticket-card {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

[data-theme="dark"] .ticket-card {
  background: #1f2937;
  border-color: #374151;
}

.ticket-card-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f3f4f6;
}

[data-theme="dark"] .ticket-card-header {
  border-color: #374151;
}

.ticket-card-header-title {
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--bulma-size-medium);
}

[data-theme="dark"] .ticket-card-header-title {
  color: #f3f4f6;
}

.ticket-card-header-title .icon {
  color: #6b7280;
}

[data-theme="dark"] .ticket-card-header-title .icon {
  color: #9ca3af;
}

.ticket-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 600;
  font-size: var(--bulma-size-small);
}

[data-theme="dark"] .ticket-count-badge {
  background: #374151;
  color: #9ca3af;
}

.ticket-card-body {
  padding: 1.25rem;
}

/* ========================================
   SHOW PAGE - Messages
   ======================================== */

.ticket-messages {
  max-height: none;
}

a.ticket-avatar-link {
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.ticket-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--bulma-size-small);
  color: #6b7280;
  flex-shrink: 0;
}

[data-theme="dark"] .ticket-avatar {
  background-color: #374151;
  color: #9ca3af;
}

.ticket-avatar.is-staff {
  background-color: #dbeafe;
  color: #2563eb;
}

[data-theme="dark"] .ticket-avatar.is-staff {
  background-color: #1e3a5f;
  color: #60a5fa;
}

.ticket-message {
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
}

.ticket-message:last-child {
  margin-bottom: 0;
}

.ticket-message:hover {
  background-color: #f9fafb;
}

[data-theme="dark"] .ticket-message:hover {
  background-color: #263044;
}

.ticket-message.is-staff {
  border-color: #e0e7ff;
  background-color: #f5f7ff;
}

[data-theme="dark"] .ticket-message.is-staff {
  border-color: #312e81;
  background-color: rgba(99, 102, 241, 0.08);
}

.ticket-message.is-staff:hover {
  background-color: #eef1ff;
}

[data-theme="dark"] .ticket-message.is-staff:hover {
  background-color: rgba(99, 102, 241, 0.14);
}

.ticket-message-row {
  display: flex;
  gap: 1rem;
}

.ticket-message-main {
  flex: 1;
  min-width: 0;
}

.ticket-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticket-message-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ticket-message-meta strong {
  color: #1f2937;
}

[data-theme="dark"] .ticket-message-meta strong {
  color: #f3f4f6;
}

.ticket-staff-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #2563eb;
  font-size: var(--bulma-size-small);
  font-weight: 500;
}

[data-theme="dark"] .ticket-staff-badge {
  background: #1e3a5f;
  color: #60a5fa;
}

.ticket-internal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: var(--bulma-size-small);
  font-weight: 500;
}

[data-theme="dark"] .ticket-internal-badge {
  background: #451a03;
  color: #fcd34d;
}

.ticket-message-time {
  color: #9ca3af;
  font-size: var(--bulma-size-small);
}

[data-theme="dark"] .ticket-message-time {
  color: #6b7280;
}

.ticket-message-body {
  padding: 0.75rem 0 0;
  color: #374151;
  line-height: 1.65;
}

[data-theme="dark"] .ticket-message-body {
  color: #d1d5db;
}

.ticket-message-body p:last-child {
  margin-bottom: 0;
}

.ticket-message.is-internal .ticket-message-body {
  background-color: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-top: 0.75rem;
}

[data-theme="dark"] .ticket-message.is-internal .ticket-message-body {
  background-color: #292524;
  border-left-color: #d97706;
}

.ticket-message-attachments {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ticket-attachment-preview img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 6px;
  margin-bottom: 0.25rem;
}

/* ========================================
   SHOW PAGE - Responsive
   ======================================== */

@media screen and (max-width: 768px) {
  .ticket-hero {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem;
  }

  .ticket-hero-content {
    flex-direction: column;
  }

  .ticket-hero-subtitle {
    justify-content: center;
  }

  .ticket-hero-actions {
    width: 100%;
    justify-content: center;
  }

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

/* ========================================
   NEW PAGE - Email CTA Card
   ======================================== */

.ticket-email-cta {
  padding: 1rem 0;
}

.ticket-email-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #dbeafe;
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--bulma-size-large);
  margin: 0 auto 1rem;
}

[data-theme="dark"] .ticket-email-icon {
  background: #1e3a5f;
  color: #60a5fa;
}

.ticket-email-hint {
  color: #9ca3af;
  font-size: var(--bulma-size-small);
}

[data-theme="dark"] .ticket-email-hint {
  color: #6b7280;
}

/* New ticket description textarea - fill remaining viewport */
.ticket-new-description textarea.textarea {
  min-height: max(200px, calc(80vh - 520px));
}

/* Reply textarea - generous fixed height regardless of conversation length */
textarea.ticket-reply-textarea {
  min-height: 250px;
}
