/* GorbaTech Custom Live Chat Widget Styles */

:root {
  --gt-chat-primary: #0284c7;
  --gt-chat-primary-hover: #0369a1;
  --gt-chat-primary-gradient: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  --gt-chat-bg: #0b0f19;
  --gt-chat-surface: #111827;
  --gt-chat-surface-hover: #1f2937;
  --gt-chat-border: rgba(56, 189, 248, 0.2);
  --gt-chat-text: #f8fafc;
  --gt-chat-text-muted: #94a3b8;
  --gt-chat-online: #10b981;
  --gt-chat-offline: #f59e0b;
  --gt-chat-radius: 18px;
  --gt-chat-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 20px rgba(2, 132, 199, 0.2);
}

/* Floating Launcher Trigger */
#gt-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gt-chat-primary-gradient);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
  cursor: pointer;
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  padding: 0;
  user-select: none;
}

#gt-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(2, 132, 199, 0.6);
}

#gt-chat-launcher:active {
  transform: scale(0.96);
}

/* Pulsing aura */
#gt-chat-launcher::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--gt-chat-primary);
  opacity: 0.6;
  animation: gt-pulse 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

@keyframes gt-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

#gt-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

#gt-chat-launcher .gt-icon-close {
  display: none;
}

#gt-chat-launcher.is-open .gt-icon-chat {
  display: none;
}

#gt-chat-launcher.is-open .gt-icon-close {
  display: block;
}

/* Unread Badge */
.gt-chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  animation: gt-bounce 0.5s ease;
}

@keyframes gt-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* Main Chat Container */
#gt-chat-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: var(--gt-chat-bg);
  border: 1px solid var(--gt-chat-border);
  border-radius: var(--gt-chat-radius);
  box-shadow: var(--gt-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--gt-chat-text);
  box-sizing: border-box;
}

#gt-chat-widget * {
  box-sizing: border-box;
}

#gt-chat-widget.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.gt-chat-header {
  background: linear-gradient(180deg, #131b2e 0%, var(--gt-chat-surface) 100%);
  border-bottom: 1px solid var(--gt-chat-border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.gt-chat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.gt-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gt-chat-primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.gt-chat-avatar svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

.gt-chat-brand-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gt-chat-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gt-chat-status {
  font-size: 11px;
  color: var(--gt-chat-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.gt-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gt-chat-online);
  box-shadow: 0 0 8px var(--gt-chat-online);
}

.gt-status-dot.offline {
  background: var(--gt-chat-offline);
  box-shadow: 0 0 8px var(--gt-chat-offline);
}

.gt-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.gt-chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.gt-chat-btn-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Chat Body / Messages Stream */
.gt-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(circle at top right, rgba(2, 132, 199, 0.04), transparent 60%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.gt-chat-body::-webkit-scrollbar {
  width: 6px;
}

.gt-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Messages */
.gt-message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: gt-msg-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gt-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.gt-message.visitor {
  align-self: flex-end;
  align-items: flex-end;
}

.gt-message.agent {
  align-self: flex-start;
  align-items: flex-start;
}

.gt-message.system {
  align-self: center;
  max-width: 95%;
  align-items: center;
}

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

.gt-message.visitor .gt-msg-bubble {
  background: var(--gt-chat-primary-gradient);
  color: #ffffff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.gt-message.agent .gt-msg-bubble {
  background: var(--gt-chat-surface);
  color: var(--gt-chat-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 3px;
}

.gt-message.system .gt-msg-bubble {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #cbd5e1;
  font-size: 12.5px;
  text-align: center;
  border-radius: 12px;
}

.gt-msg-meta {
  font-size: 10px;
  color: var(--gt-chat-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* Fallback / Offline Contact Card */
.gt-fallback-card {
  background: #111827;
  border: 1px solid var(--gt-chat-primary);
  border-radius: 14px;
  padding: 14px;
  margin-top: 8px;
  width: 100%;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.gt-fallback-title {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gt-fallback-desc {
  font-size: 12px;
  color: var(--gt-chat-text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.gt-fallback-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gt-form-input, .gt-form-textarea {
  width: 100%;
  background: #0b0f19;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: #ffffff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.gt-form-input:focus, .gt-form-textarea:focus {
  border-color: var(--gt-chat-primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.gt-form-textarea {
  resize: none;
  height: 54px;
}

.gt-form-submit {
  background: var(--gt-chat-primary-gradient);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gt-form-submit:hover {
  opacity: 0.95;
}

.gt-form-submit:active {
  transform: scale(0.98);
}

.gt-form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Appointment Prompt Card */
.gt-appointment-card {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.15) 0%, rgba(14, 165, 233, 0.08) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.gt-appointment-title {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gt-btn-appointment {
  background: var(--gt-chat-primary-gradient);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.gt-btn-appointment:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
  opacity: 0.96;
}

.gt-btn-appointment:active {
  transform: translateY(1px);
}

.gt-btn-appointment svg {
  width: 16px;
  height: 16px;
  fill: #ffffff;
  flex-shrink: 0;
}

/* Typing Indicator */
.gt-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--gt-chat-surface);
  border-radius: 14px;
  border-bottom-left-radius: 3px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gt-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gt-chat-text-muted);
  animation: gt-wave 1.4s infinite ease-in-out;
}

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

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

/* Footer / Input Area */
.gt-chat-footer {
  border-top: 1px solid var(--gt-chat-border);
  background: var(--gt-chat-surface);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.gt-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.gt-chat-textarea {
  flex: 1;
  background: #0b0f19;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: #ffffff;
  outline: none;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  height: 38px;
  line-height: 1.4;
  transition: border-color 0.2s ease;
}

.gt-chat-textarea:focus {
  border-color: var(--gt-chat-primary);
}

.gt-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gt-chat-primary-gradient);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
  outline: none;
  padding: 0;
}

.gt-chat-send:hover {
  transform: scale(1.05);
}

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

.gt-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.gt-chat-send svg {
  width: 17px;
  height: 17px;
  fill: #ffffff;
}

.gt-chat-branding {
  font-size: 10px;
  color: var(--gt-chat-text-muted);
  text-align: center;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #gt-chat-widget {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  #gt-chat-launcher {
    bottom: 16px;
    right: 16px;
  }

  .gt-chat-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}
