/* ============================================================
   TRAKITA - Hybrid AI + Human Handoff Support System
   Native Full-Page Styles (inside #page-support > .main-content)
   MODULAR: Isolated from main app styles
   ============================================================ */

/* ==================== SUPPORT PAGE ==================== */
.support-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(100vh - 140px); /* Account for header + bottom nav */
  background: #ffffff;
}

/* ==================== PAGE HEADER ==================== */
.support-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  flex-shrink: 0;
}

.support-page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.support-page-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.support-page-title {
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
}

.support-page-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  margin: 2px 0 0 0;
}

.support-page-ticket-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  color: white;
}

/* ==================== STATUS BAR ==================== */
.support-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: #fff7ed;
  border-bottom: 1px solid #ffedd5;
  flex-shrink: 0;
}

.support-status-content {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #ea580c;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ==================== MESSAGES CONTAINER ==================== */
.support-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.support-messages::-webkit-scrollbar { width: 4px; }
.support-messages::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
.support-messages::-webkit-scrollbar-track { background: transparent; }

/* ==================== EMPTY STATE ==================== */
.support-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  flex: 1;
}

.support-empty-icon {
  margin-bottom: 12px;
  opacity: 0.6;
}

.support-empty-state h4 {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.support-empty-state p {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 16px;
  line-height: 1.4;
}

.support-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 300px;
}

.support-quick-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #4b5563;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.support-quick-btn:hover {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #16a34a;
}

.support-quick-btn:active {
  transform: scale(0.95);
}

.support-quick-btn-admin {
  background: #fff7ed;
  border-color: #f97316;
  color: #ea580c;
}

.support-quick-btn-admin:hover {
  background: #ffedd5;
  border-color: #f97316;
  color: #ea580c;
}

/* ==================== MESSAGE BUBBLES ==================== */
.support-message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: msgIn 0.25s ease;
}

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

/* Message row: avatar + bubble side by side */
.support-message-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.support-message-user .support-message-row {
  justify-content: flex-end;
}

.support-message-user {
  align-self: flex-end;
  align-items: flex-end;
}

.support-message-ai {
  align-self: flex-start;
  align-items: flex-start;
}

.support-message-admin {
  align-self: flex-start;
  align-items: flex-start;
}

/* ==================== MESSAGE AVATARS ==================== */
.support-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.support-msg-avatar-user {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.support-msg-avatar-ai {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.support-msg-avatar-admin {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

/* ==================== BUBBLE VARIANTS ==================== */
.support-message-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.support-bubble-user {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border-bottom-right-radius: 4px;
}

.support-bubble-ai {
  background: #f3f4f6;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

.support-bubble-admin {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: #1f2937;
  border: 1.5px solid #fed7aa;
  border-bottom-left-radius: 4px;
}

/* ==================== MESSAGE METADATA ==================== */
.support-message-time {
  font-size: 9px;
  color: #9ca3af;
  font-weight: 600;
  margin-top: 3px;
  padding: 0 4px;
}

.support-message-sender-label {
  font-size: 10px;
  font-weight: 700;
  color: #f97316;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ==================== SYSTEM MESSAGE ==================== */
.support-system-message {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  font-weight: 600;
  padding: 6px 12px;
  background: #f9fafb;
  border-radius: 999px;
  align-self: center;
}

/* ==================== DATE SEPARATOR ==================== */
.support-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
}

.support-date-separator span {
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  background: #f9fafb;
  padding: 3px 12px;
  border-radius: 999px;
}

/* ==================== TYPING INDICATOR ==================== */
.support-typing {
  padding: 4px 16px 8px;
  align-self: flex-start;
}

.support-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f3f4f6;
  padding: 10px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.support-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.support-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.support-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ==================== INPUT AREA ==================== */
.support-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 14px;
  background: white;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.support-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  font-size: 13px;
  color: #1f2937;
  background: #f9fafb;
  outline: none;
  transition: all 0.2s;
}

.support-input:focus {
  border-color: #22c55e;
  background: white;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.support-input::placeholder {
  color: #9ca3af;
}

.support-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
  transition: all 0.2s;
}

.support-send-btn:hover {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  transform: scale(1.05);
}

.support-send-btn:active {
  transform: scale(0.92);
}

/* ==================== TAB TOGGLE (Chat | FAQ) ==================== */
.support-tab-toggle {
  display: flex;
  gap: 0;
  padding: 0 16px;
  background: #f3f4f6;
  flex-shrink: 0;
}

.support-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: #9ca3af;
  background: transparent;
  border: none;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: all 0.2s;
}

.support-tab-btn.active {
  color: #16a34a;
  border-bottom-color: #22c55e;
  background: white;
}

.support-tab-btn svg {
  flex-shrink: 0;
}

/* ==================== VIEW CONTAINER ==================== */
.support-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ==================== FAQ SECTION ==================== */
.support-faq-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.support-faq-section-title {
  font-size: 16px;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

/* ==================== FAQ CHIPS ==================== */
.support-faq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.support-faq-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.support-faq-chip:hover {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #16a34a;
}

.support-faq-chip:active {
  transform: scale(0.95);
}

.support-faq-chip svg {
  flex-shrink: 0;
  color: #6b7280;
}

.support-faq-chip-admin {
  background: #fff7ed;
  border-color: #f97316;
  color: #ea580c;
}

.support-faq-chip-admin:hover {
  background: #ffedd5;
  border-color: #ea580c;
}

/* ==================== FAQ ACCORDION ==================== */
.support-faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f9fafb;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.support-faq-acc-item {
  background: white;
  cursor: pointer;
  transition: background 0.2s;
}

.support-faq-acc-item:hover {
  background: #f9fafb;
}

.support-faq-acc-item.open {
  background: #f0fdf4;
}

.support-faq-acc-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  gap: 12px;
}

.support-faq-acc-q span {
  flex: 1;
}

.support-faq-acc-arrow {
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.25s ease;
}

.support-faq-acc-item.open .support-faq-acc-arrow {
  transform: rotate(180deg);
  color: #22c55e;
}

.support-faq-acc-a {
  display: none;
  padding: 0 16px 14px;
  font-size: 12.5px;
  color: #6b7280;
  line-height: 1.7;
}

.support-faq-acc-item.open .support-faq-acc-a {
  display: block;
}

/* ==================== FAQ HELP CTA ==================== */
.support-faq-help-cta {
  text-align: center;
  padding: 8px 0 16px;
}

.support-faq-help-cta p {
  font-size: 13px;
  color: #9ca3af;
  margin: 0 0 12px;
  font-weight: 500;
}

.support-faq-help-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
  transition: all 0.2s;
}

.support-faq-help-btn:hover {
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
}

.support-faq-help-btn:active {
  transform: scale(0.97);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 360px) {
  .support-page-header {
    padding: 12px;
  }

  .support-page-avatar {
    width: 34px;
    height: 34px;
  }

  .support-page-title {
    font-size: 14px;
  }

  .support-page-subtitle {
    font-size: 11px;
  }

  .support-page-ticket-badge {
    font-size: 10px;
    padding: 3px 10px;
  }

  .support-message-bubble {
    font-size: 12px;
    padding: 8px 12px;
  }

  .support-quick-btn {
    font-size: 10px;
    padding: 5px 10px;
  }

  .support-input {
    font-size: 12px;
    padding: 8px 12px;
  }

  .support-send-btn {
    width: 36px;
    height: 36px;
  }
}

/* ==================== DARK MODE SAFE ==================== */
@media (prefers-color-scheme: dark) {
  /* Keep light theme for consistency with main app */
  /* If main app adds dark mode later, styles can be extended here */
}
