/**
 * Hatim Computers — AI + Human Live Chat Widget Stylesheet
 * Ultra-Modern SaaS Floating Live Support Design System
 */

/* -------------------------------------------------------------
   FLOATING LAUNCHER BUTTON
   ------------------------------------------------------------- */
.hc-chat-launcher {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #1A56DB 0%, #0F3BA0 100%);
  color: #FFFFFF;
  padding: 12px 20px 12px 16px;
  border-radius: 50px;
  box-shadow: 0 8px 24px -4px rgba(26, 86, 219, 0.4), 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.hc-chat-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 28px -4px rgba(26, 86, 219, 0.5), 0 4px 12px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, #1E40AF 0%, #1A56DB 100%);
}

.hc-chat-launcher-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hc-chat-launcher-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.hc-launcher-status-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  background: #10B981;
  border-radius: 50%;
  border: 2px solid #1A56DB;
  box-shadow: 0 0 6px #10B981;
}

.hc-chat-launcher-text {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.hc-launcher-badge {
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  margin-left: 2px;
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* -------------------------------------------------------------
   MAIN CHAT WINDOW
   ------------------------------------------------------------- */
.hc-chat-window {
  position: fixed;
  bottom: 85px;
  right: 20px;
  width: 390px;
  max-width: calc(100vw - 30px);
  height: 620px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 12px 40px -8px rgba(15, 23, 42, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.hc-chat-window.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* -------------------------------------------------------------
   WINDOW HEADER
   ------------------------------------------------------------- */
.hc-chat-header {
  background: linear-gradient(135deg, #0B192C 0%, #132A4A 100%);
  color: #FFFFFF;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  flex-shrink: 0;
}

.hc-chat-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hc-chat-logo-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1A56DB 0%, #06B6D4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(26, 86, 219, 0.3);
  flex-shrink: 0;
}

.hc-chat-header-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hc-chat-header-subtitle {
  font-size: 0.74rem;
  color: #94A3B8;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.hc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #10B981;
}
.hc-status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

.hc-chat-header-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hc-header-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.hc-header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

/* -------------------------------------------------------------
   CONTAINER SCREENS
   ------------------------------------------------------------- */
.hc-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* -------------------------------------------------------------
   FIRST SCREEN: CHOICE CARDS (ASK AI vs ASK AGENT)
   ------------------------------------------------------------- */
.hc-welcome-screen {
  padding: 24px 20px;
  overflow-y: auto;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hc-welcome-hero {
  text-align: center;
  margin-bottom: 8px;
}

.hc-welcome-badge {
  display: inline-block;
  background: #EFF6FF;
  color: #1A56DB;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.hc-welcome-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 4px;
}

.hc-welcome-sub {
  font-size: 0.84rem;
  color: #64748B;
  line-height: 1.4;
}

/* Option Cards */
.hc-choice-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.hc-choice-card:hover {
  border-color: #1A56DB;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(26, 86, 219, 0.15);
}

.hc-choice-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hc-choice-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hc-choice-icon.ai {
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  color: #FFFFFF;
}
.hc-choice-icon.agent {
  background: linear-gradient(135deg, #1A56DB 0%, #4338CA 100%);
  color: #FFFFFF;
}

.hc-choice-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0F172A;
}

.hc-choice-card-desc {
  font-size: 0.8rem;
  color: #64748B;
  line-height: 1.45;
}

.hc-choice-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.hc-choice-btn.ai {
  background: #0284C7;
  color: #FFFFFF;
}
.hc-choice-btn.ai:hover {
  background: #0369A1;
}

.hc-choice-btn.agent {
  background: #1A56DB;
  color: #FFFFFF;
}
.hc-choice-btn.agent:hover {
  background: #1E40AF;
}

/* -------------------------------------------------------------
   CUSTOMER INFORMATION FORM
   ------------------------------------------------------------- */
.hc-form-screen {
  padding: 20px;
  overflow-y: auto;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
}

.hc-form-back-btn {
  background: none;
  border: none;
  color: #64748B;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  padding: 0;
}
.hc-form-back-btn:hover {
  color: #0F172A;
}

.hc-form-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 4px;
}
.hc-form-subtitle {
  font-size: 0.8rem;
  color: #64748B;
  margin-bottom: 16px;
  line-height: 1.4;
}

.hc-field-group {
  margin-bottom: 12px;
}

.hc-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}
.hc-label .required {
  color: #EF4444;
}

.hc-input, .hc-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  font-size: 0.86rem;
  font-family: inherit;
  color: #0F172A;
  background: #FFFFFF;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.hc-input:focus, .hc-select:focus {
  border-color: #1A56DB;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.hc-form-submit-btn {
  width: 100%;
  padding: 12px;
  background: #1A56DB;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s ease;
}
.hc-form-submit-btn:hover {
  background: #1E40AF;
}

/* -------------------------------------------------------------
   ACTIVE CHAT STREAM & MESSAGES
   ------------------------------------------------------------- */
.hc-chat-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #FAFAFA;
  overflow: hidden;
}

/* Mode Banner */
.hc-chat-mode-banner {
  padding: 8px 14px;
  background: #EFF6FF;
  border-bottom: 1px solid #DBEAFE;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #1E40AF;
  font-weight: 600;
  flex-shrink: 0;
}

.hc-banner-handover-btn {
  background: #FFFFFF;
  border: 1px solid #BFDBFE;
  color: #1A56DB;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.hc-banner-handover-btn:hover {
  background: #1A56DB;
  color: #FFFFFF;
}

/* Messages Scrollable Area */
.hc-chat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hc-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: msgFadeIn 0.2s ease-out;
}

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

.hc-msg.customer {
  align-self: flex-end;
}
.hc-msg.ai, .hc-msg.agent {
  align-self: flex-start;
}
.hc-msg.system {
  align-self: center;
  max-width: 90%;
  text-align: center;
  margin: 6px 0;
}

.hc-msg-author {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748B;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hc-msg.customer .hc-msg-author {
  justify-content: flex-end;
}
.hc-msg.ai .hc-msg-author {
  color: #0284C7;
}

.hc-msg-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
}

.hc-msg.customer .hc-msg-bubble {
  background: #1A56DB;
  color: #FFFFFF;
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 6px rgba(26, 86, 219, 0.25);
}

.hc-msg.agent .hc-msg-bubble {
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.hc-msg.ai .hc-msg-bubble {
  background: #F0F9FF;
  color: #0369A1;
  border: 1px solid #BAE6FD;
  border-bottom-left-radius: 3px;
}

.hc-msg.system .hc-msg-bubble {
  background: #F1F5F9;
  color: #475569;
  font-size: 0.75rem;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px dashed #CBD5E1;
}

.hc-msg-meta {
  font-size: 0.68rem;
  color: #94A3B8;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hc-msg.customer .hc-msg-meta {
  justify-content: flex-end;
}

/* Handover Interactive Action Card */
.hc-handover-prompt-box {
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  border-radius: 12px;
  padding: 12px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hc-handover-prompt-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1E40AF;
}
.hc-handover-btn-row {
  display: flex;
  gap: 6px;
}
.hc-handover-action-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.hc-handover-action-btn.primary {
  background: #1A56DB;
  color: #FFFFFF;
}
.hc-handover-action-btn.secondary {
  background: #FFFFFF;
  color: #475569;
  border: 1px solid #CBD5E1;
}

/* Typing Indicator */
.hc-typing-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  font-size: 0.75rem;
  color: #64748B;
  background: #FAFAFA;
}
.hc-typing-dots {
  display: inline-flex;
  gap: 3px;
}
.hc-typing-dots span {
  width: 5px;
  height: 5px;
  background: #94A3B8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.hc-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.hc-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

/* -------------------------------------------------------------
   INPUT COMPOSER
   ------------------------------------------------------------- */
.hc-chat-footer {
  padding: 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  flex-shrink: 0;
}

.hc-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: relative;
}

.hc-textarea {
  flex: 1;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  outline: none;
  line-height: 1.4;
  box-sizing: border-box;
  color: #0F172A;
  transition: border-color 0.15s ease;
}
.hc-textarea:focus {
  border-color: #1A56DB;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.08);
}

.hc-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid #E2E8F0;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.hc-icon-btn:hover {
  background: #F8FAFC;
  color: #0F172A;
  border-color: #CBD5E1;
}

.hc-send-btn {
  background: #1A56DB;
  color: #FFFFFF;
  border: none;
}
.hc-send-btn:hover {
  background: #1E40AF;
  color: #FFFFFF;
}

/* -------------------------------------------------------------
   MOBILE FULL SCREEN EXPERIENCE (< 640px)
   ------------------------------------------------------------- */
@media (max-width: 640px) {
  .hc-chat-launcher {
    bottom: 132px;
    right: 16px;
    padding: 10px 16px 10px 14px;
  }
  .hc-chat-launcher-text {
    font-size: 0.86rem;
  }

  .hc-chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
}
