/* Normality Support Ticket System - Luxury Dark Theme */
:root {
  --nm-support-accent: #3E6BFF;
  --nm-support-accent-hover: #2955EE;
  --nm-support-accent-glow: rgba(62, 107, 255, 0.35);
  --nm-support-bg: #0F1015;
  --nm-support-surface: #151822;
  --nm-support-surface-alt: #1A1E2B;
  --nm-support-border: rgba(255, 255, 255, 0.08);
  --nm-support-border-focus: rgba(62, 107, 255, 0.6);
  --nm-support-text: #FFFFFF;
  --nm-support-text-muted: #9CA3AF;
  --nm-support-text-dim: #6B7280;
  --nm-support-green: #10B981;
  --nm-support-green-glow: rgba(16, 185, 129, 0.4);
}

/* Floating Launcher Button */
#nm-support-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3E6BFF 0%, #2045cc 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px var(--nm-support-accent-glow), 0 4px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99990;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  outline: none;
  user-select: none;
}

#nm-support-launcher:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 30px rgba(62, 107, 255, 0.5), 0 6px 16px rgba(0, 0, 0, 0.6);
}

#nm-support-launcher:active {
  transform: scale(0.95);
}

#nm-support-launcher .nm-icon-open,
#nm-support-launcher .nm-icon-close {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#nm-support-launcher.is-active .nm-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

#nm-support-launcher .nm-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

#nm-support-launcher.is-active .nm-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Unread Badge */
.nm-support-unread-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #EF4444;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  height: 20px;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0F1015;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
  animation: nmBadgePop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nmBadgePop {
  0% { transform: scale(0); }
  80% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Chat Widget Container */
#nm-support-modal {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--nm-support-bg);
  border: 1px solid var(--nm-support-border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99990;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
  backdrop-filter: blur(16px);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--nm-support-text);
}

#nm-support-modal.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Modal Header */
.nm-support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--nm-support-surface);
  border-bottom: 1px solid var(--nm-support-border);
  flex-shrink: 0;
}

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

.nm-support-avatar-wrap {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(62, 107, 255, 0.12);
  border: 1px solid rgba(62, 107, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nm-support-accent);
  flex-shrink: 0;
}

.nm-support-title-group h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
  line-height: 1.2;
}

.nm-support-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.nm-support-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nm-support-green);
  box-shadow: 0 0 8px var(--nm-support-green-glow);
  animation: nmDotPulse 2s infinite ease-in-out;
}

@keyframes nmDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.nm-support-status-text {
  font-size: 11px;
  color: var(--nm-support-text-muted);
  font-weight: 400;
}

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

.nm-support-btn-icon {
  background: transparent;
  border: none;
  color: var(--nm-support-text-muted);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.nm-support-btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

/* SLA Banner / Subheader */
.nm-support-sla-banner {
  background: rgba(62, 107, 255, 0.08);
  border-bottom: 1px solid rgba(62, 107, 255, 0.15);
  padding: 8px 16px;
  font-size: 11.5px;
  color: #C7D2FE;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.nm-support-sla-banner .nm-sla-badge {
  font-weight: 600;
  color: #FFFFFF;
  background: rgba(62, 107, 255, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Body / View Containers */
.nm-support-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.nm-support-view.is-active {
  display: flex;
}

/* View 1: Intake Form */
.nm-support-form-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nm-support-notice-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--nm-support-border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
}

.nm-support-notice-title {
  font-size: 12px;
  font-weight: 600;
  color: #FFFFFF;
  margin: 0 0 4px 0;
}

.nm-support-notice-p {
  font-size: 11px;
  color: var(--nm-support-text-muted);
  line-height: 1.5;
  margin: 0 0 6px 0;
}

.nm-support-notice-p:last-child {
  margin-bottom: 0;
}

.nm-support-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nm-support-field label {
  font-size: 11.5px;
  font-weight: 500;
  color: #D1D5DB;
}

.nm-support-input,
.nm-support-textarea,
.nm-support-select {
  width: 100%;
  box-sizing: border-box;
  background: var(--nm-support-surface);
  border: 1px solid var(--nm-support-border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: #FFFFFF;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nm-support-input::placeholder,
.nm-support-textarea::placeholder {
  color: var(--nm-support-text-dim);
}

.nm-support-input:focus,
.nm-support-textarea:focus,
.nm-support-select:focus {
  border-color: var(--nm-support-accent);
  box-shadow: 0 0 0 2px rgba(62, 107, 255, 0.2);
}

.nm-support-textarea {
  resize: none;
  min-height: 72px;
  line-height: 1.4;
}

.nm-support-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' 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: 32px;
}

.nm-support-submit-btn {
  background: linear-gradient(135deg, #3E6BFF 0%, #2045cc 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  margin-top: 4px;
}

.nm-support-submit-btn:hover:not(:disabled) {
  opacity: 0.95;
  box-shadow: 0 4px 14px var(--nm-support-accent-glow);
}

.nm-support-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nm-support-form-footer {
  text-align: center;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nm-support-link-btn {
  background: none;
  border: none;
  color: var(--nm-support-accent);
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  font-family: inherit;
}

.nm-support-link-btn:hover {
  color: #7094FF;
}

.nm-support-powered {
  font-size: 10px;
  color: var(--nm-support-text-dim);
  margin: 0;
}

/* Honeypot Offscreen */
.nm-hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* View 2: 2FA Login / Resume Screen */
.nm-support-auth-content {
  flex: 1;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
}

.nm-support-auth-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(62, 107, 255, 0.1);
  border: 1px solid rgba(62, 107, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nm-support-accent);
  margin: 0 auto;
}

.nm-support-auth-title {
  font-size: 15px;
  font-weight: 600;
  color: #FFFFFF;
  text-align: center;
  margin: 0;
}

.nm-support-auth-desc {
  font-size: 12px;
  color: var(--nm-support-text-muted);
  text-align: center;
  line-height: 1.5;
  margin: 0;
}

.nm-support-otp-input {
  text-align: center;
  letter-spacing: 0.35em;
  font-family: monospace;
  font-size: 20px;
  font-weight: 700;
  padding: 10px;
}

/* View 3: Active Conversation */
.nm-support-chat-header-bar {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--nm-support-border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.nm-support-ticket-tag {
  font-weight: 600;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nm-support-status-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nm-support-status-pill.is-open {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.nm-support-status-pill.is-waiting {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.nm-support-status-pill.is-closed {
  background: rgba(107, 114, 128, 0.2);
  color: #9CA3AF;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Message List */
.nm-support-messages-stream {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nm-support-msg-item {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: nmMsgFade 0.2s ease-out;
}

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

.nm-support-msg-item.is-user {
  align-self: flex-end;
  align-items: flex-end;
}

.nm-support-msg-item.is-support {
  align-self: flex-start;
  align-items: flex-start;
}

.nm-support-msg-item.is-system {
  align-self: center;
  align-items: center;
  max-width: 90%;
  margin: 4px 0;
}

.nm-support-msg-author {
  font-size: 10px;
  color: var(--nm-support-text-dim);
  margin-bottom: 3px;
  padding: 0 4px;
}

.nm-support-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.nm-support-msg-item.is-user .nm-support-msg-bubble {
  background: var(--nm-support-accent);
  color: #FFFFFF;
  border-bottom-right-radius: 3px;
  box-shadow: 0 4px 12px var(--nm-support-accent-glow);
}

.nm-support-msg-item.is-support .nm-support-msg-bubble {
  background: var(--nm-support-surface-alt);
  color: #F3F4F6;
  border: 1px solid var(--nm-support-border);
  border-bottom-left-radius: 3px;
}

.nm-support-msg-item.is-system .nm-support-msg-bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--nm-support-text-muted);
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 16px;
  text-align: center;
}

.nm-support-msg-time {
  font-size: 9.5px;
  color: var(--nm-support-text-dim);
  margin-top: 3px;
  padding: 0 4px;
}

/* Chat Input Bar */
.nm-support-chat-input-bar {
  padding: 10px 14px;
  background: var(--nm-support-surface);
  border-top: 1px solid var(--nm-support-border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nm-support-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--nm-support-border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: #FFFFFF;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.nm-support-chat-input:focus {
  border-color: var(--nm-support-accent);
}

.nm-support-chat-input:disabled {
  background: rgba(255, 255, 255, 0.02);
  color: var(--nm-support-text-dim);
  cursor: not-allowed;
}

.nm-support-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--nm-support-accent);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.nm-support-chat-send-btn:hover:not(:disabled) {
  transform: scale(1.06);
}

.nm-support-chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Alert / Banner notices inside widget */
.nm-support-alert {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.nm-support-alert.is-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
}

.nm-support-alert.is-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6EE7B7;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #nm-support-modal {
    bottom: 84px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: calc(100vh - 100px);
  }

  #nm-support-launcher {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}
