/* ==========================================================================
   SUPPORT WIDGET COMPONENT (Floating FAB & Popup Chat Window)
   ========================================================================== */

.support-widget-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: inherit;
}

/* Floating Action Button (FAB) */
.support-fab {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-pink, #ec4899), #8b5cf6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.4), 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  position: relative;
  outline: none;
}

.support-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(236, 72, 153, 0.55), 0 4px 10px rgba(0, 0, 0, 0.5);
}

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

.support-fab-icon {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.support-fab.is-active .support-fab-icon {
  transform: rotate(180deg);
}

/* Unread Badge */
.support-fab-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d0f17;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

.support-fab-badge.has-unread {
  display: flex;
}

/* Popup Widget Window */
.support-popup-window {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 380px;
  height: 540px;
  max-height: calc(100vh - 120px);
  background: rgba(18, 20, 31, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
}

.support-popup-window.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Popup Header */
.support-popup-header {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.support-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(236, 72, 153, 0.35);
  color: var(--accent-pink, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.support-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main, #ffffff);
  line-height: 1.2;
}

.support-header-status {
  font-size: 0.76rem;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.status-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: supportDotPulse 2s infinite;
}

@keyframes supportDotPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.support-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.support-btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.support-btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main, #ffffff);
}

/* Popup Body */
.support-popup-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Guest View */
.support-guest-view {
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.support-guest-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: var(--accent-pink, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 16px;
}

.support-guest-title {
  margin: 0 0 10px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main, #ffffff);
}

.support-guest-text {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.45;
  margin: 0 0 12px 0;
}

.support-guest-subtext {
  font-size: 0.8rem;
  color: var(--text-dim, #64748b);
  margin: 0 0 20px 0;
}

.support-guest-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
}

.support-guest-faq {
  font-size: 0.78rem;
  color: var(--text-dim, #64748b);
}

.support-guest-faq a {
  color: var(--accent-pink, #ec4899);
  text-decoration: underline;
}

/* Views Management */
.support-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: inherit;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.support-view-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
}

/* 1. List View */
.support-list-top {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.support-tickets-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-ticket-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.support-ticket-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.support-ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.support-ticket-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
}

.support-ticket-subject {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main, #ffffff);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.support-ticket-preview {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.support-ticket-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
}

.support-ticket-unread-badge {
  background: #ec4899;
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-weight: 700;
  font-size: 0.7rem;
}

.support-ticket-user-pill {
  font-size: 0.72rem;
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 999px;
  padding: 1px 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
}

/* 2. Create Ticket View */
.support-view-header-bar {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.support-back-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.support-back-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main, #ffffff);
}

.support-view-subtitle {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main, #ffffff);
}

.support-form {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.support-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.support-form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
}

.support-input,
.support-select,
.support-textarea {
  width: 100%;
  font-size: 0.88rem;
  padding: 10px 14px;
  background-color: #151824;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.support-input:focus,
.support-select:focus,
.support-textarea:focus {
  border-color: var(--accent-pink, #ec4899);
  background-color: #1a1e2e;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.25);
}

.support-input::placeholder,
.support-textarea::placeholder {
  color: #64748b;
}

.support-input:-webkit-autofill,
.support-input:-webkit-autofill:hover, 
.support-input:-webkit-autofill:focus, 
.support-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #151824 inset !important;
  -webkit-text-fill-color: #ffffff !important;
  transition: background-color 5000s ease-in-out 0s;
}

.support-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ec4899' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.support-select option {
  background-color: #151824;
  color: #f8fafc;
  padding: 10px 14px;
}

.support-select option:hover,
.support-select option:focus,
.support-select option:checked {
  background-color: #24293d;
  color: var(--accent-pink, #ec4899);
}

/* 3. Chat Thread View */
.support-chat-header-bar {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.support-chat-ticket-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.support-chat-ticket-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
}

.support-chat-ticket-status {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.support-chat-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #34d399;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.support-chat-close-btn:hover {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.35);
}

.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-bubble {
  max-width: 82%;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
}

.support-bubble.user-msg {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-pink, #ec4899), #db2777);
  color: #ffffff;
  border-radius: 14px 14px 3px 14px;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.25);
}

.support-bubble.support-msg {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
  border-radius: 14px 14px 14px 3px;
}

.support-bubble-sender {
  font-size: 0.68rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 2px;
}

.support-bubble-time {
  font-size: 0.65rem;
  opacity: 0.7;
  text-align: right;
  margin-top: 4px;
}

/* Chat Input Bar */
.support-chat-input-bar {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.support-chat-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 0.85rem;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.35;
}

.support-chat-textarea:focus {
  border-color: var(--accent-pink, #ec4899);
}

.support-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-pink, #ec4899);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.support-chat-send-btn:hover {
  background: #f43f5e;
  transform: scale(1.05);
}

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

.support-loading-state,
.support-empty-state {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-dim, #64748b);
  font-size: 0.82rem;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .support-widget-root {
    bottom: 16px;
    right: 16px;
  }

  .support-popup-window {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 70px;
    height: 480px;
  }
}
