/* ═══════════════════════════════════════════
   SKYARC CHATBOT — CINEMATIC HORIZON THEME
   ═══════════════════════════════════════════ */

/* ---------- CSS Variables ---------- */
:root {
  --cb-primary: #0066FF;
  --cb-primary-glow: rgba(0, 102, 255, 0.35);
  --cb-bg: #0a0e1a;
  --cb-bg-secondary: #111827;
  --cb-bg-tertiary: #1a2035;
  --cb-surface: rgba(255, 255, 255, 0.04);
  --cb-border: rgba(255, 255, 255, 0.08);
  --cb-text: #e4e8f1;
  --cb-text-dim: #8892a8;
  --cb-text-bright: #ffffff;
  --cb-accent-cyan: #00d4ff;
  --cb-accent-green: #00c853;
  --cb-user-bubble: linear-gradient(135deg, #0055dd 0%, #0077ff 100%);
  --cb-bot-bubble: rgba(255, 255, 255, 0.06);
  --cb-radius: 16px;
  --cb-radius-sm: 10px;
  --cb-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 102, 255, 0.08);
  --cb-transition: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Toggle Button ---------- */
.chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0055dd, #0088ff);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 28px rgba(0, 102, 255, 0.4), 0 0 0 0 rgba(0, 102, 255, 0.3);
  transition: transform 0.35s var(--cb-transition), box-shadow 0.35s var(--cb-transition);
  animation: cb-pulse-ring 2.5s ease-out infinite;
}

.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 36px rgba(0, 102, 255, 0.55), 0 0 0 0 rgba(0, 102, 255, 0.3);
}

.chatbot-toggle svg,
.chatbot-toggle img {
  width: 28px;
  height: 28px;
  transition: transform 0.35s var(--cb-transition), opacity 0.25s ease;
}

.chatbot-toggle .cb-icon-chat {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: contain;
}

.chatbot-toggle .cb-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.chatbot-toggle.active .cb-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.chatbot-toggle.active .cb-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.chatbot-toggle.active {
  animation: none;
}

@keyframes cb-pulse-ring {
  0% { box-shadow: 0 6px 28px rgba(0, 102, 255, 0.4), 0 0 0 0 rgba(0, 102, 255, 0.35); }
  70% { box-shadow: 0 6px 28px rgba(0, 102, 255, 0.4), 0 0 0 18px rgba(0, 102, 255, 0); }
  100% { box-shadow: 0 6px 28px rgba(0, 102, 255, 0.4), 0 0 0 0 rgba(0, 102, 255, 0); }
}

/* Notification badge */
.chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #ff3d57;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--cb-bg);
  animation: cb-badge-pop 0.4s var(--cb-transition);
}

@keyframes cb-badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ---------- Chat Window ---------- */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9999;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 140px);
  border-radius: var(--cb-radius);
  background: var(--cb-bg);
  border: 1px solid var(--cb-border);
  box-shadow: var(--cb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.4s var(--cb-transition), transform 0.4s var(--cb-transition);
}

.chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header ---------- */
.chatbot-header {
  padding: 18px 20px;
  background: var(--cb-bg-secondary);
  border-bottom: 1px solid var(--cb-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chatbot-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0055dd, #00d4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.chatbot-header-avatar svg {
  width: 22px;
  height: 22px;
  color: #fff;
}

.chatbot-header-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: var(--cb-accent-green);
  border-radius: 50%;
  border: 2px solid var(--cb-bg-secondary);
}

.chatbot-header-info {
  flex: 1;
}

.chatbot-header-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--cb-text-bright);
  letter-spacing: 0.01em;
}

.chatbot-header-status {
  font-size: 12px;
  color: var(--cb-accent-green);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.chatbot-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--cb-accent-green);
  border-radius: 50%;
  animation: cb-status-blink 2s ease infinite;
}

@keyframes cb-status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chatbot-header-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--cb-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.chatbot-header-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cb-text-bright);
}

/* ---------- Messages Area ---------- */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* ---------- Message Bubbles ---------- */
.cb-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: cb-msg-in 0.35s var(--cb-transition);
}

@keyframes cb-msg-in {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.cb-msg.bot {
  align-self: flex-start;
}

.cb-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.cb-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0055dd, #00d4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.cb-msg-avatar svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

.cb-msg.user .cb-msg-avatar {
  background: linear-gradient(135deg, #374151, #4b5563);
}

.cb-msg-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--cb-text);
  word-break: break-word;
}

.cb-msg.bot .cb-msg-bubble {
  background: var(--cb-bot-bubble);
  border: 1px solid var(--cb-border);
  border-top-left-radius: 4px;
}

.cb-msg.user .cb-msg-bubble {
  background: var(--cb-user-bubble);
  color: #fff;
  border-top-right-radius: 4px;
  border: none;
}

.cb-msg-bubble a {
  color: var(--cb-accent-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cb-msg.user .cb-msg-bubble a {
  color: #b3d9ff;
}

/* Time stamps */
.cb-msg-time {
  font-size: 10px;
  color: var(--cb-text-dim);
  margin-top: 4px;
  padding: 0 4px;
}

.cb-msg.user .cb-msg-time {
  text-align: right;
}

/* ---------- Quick Reply Chips ---------- */
.cb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  animation: cb-msg-in 0.4s var(--cb-transition);
}

.cb-quick-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(0, 102, 255, 0.4);
  background: rgba(0, 102, 255, 0.08);
  color: var(--cb-accent-cyan);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.cb-quick-btn:hover {
  background: rgba(0, 102, 255, 0.2);
  border-color: var(--cb-primary);
  transform: translateY(-1px);
}

/* ---------- Typing Indicator ---------- */
.cb-typing {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  max-width: 88%;
  animation: cb-msg-in 0.3s var(--cb-transition);
}

.cb-typing-bubble {
  padding: 14px 20px;
  background: var(--cb-bot-bubble);
  border: 1px solid var(--cb-border);
  border-radius: 14px;
  border-top-left-radius: 4px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.cb-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--cb-text-dim);
  border-radius: 50%;
  animation: cb-typing-bounce 1.4s ease infinite;
}

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

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

/* ---------- Input Area ---------- */
.chatbot-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--cb-border);
  background: var(--cb-bg-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  padding: 11px 16px;
  border-radius: 24px;
  border: 1px solid var(--cb-border);
  background: var(--cb-surface);
  color: var(--cb-text-bright);
  font-size: 14px;
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease;
  font-family: inherit;
}

.chatbot-input::placeholder {
  color: var(--cb-text-dim);
}

.chatbot-input:focus {
  border-color: rgba(0, 102, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.chatbot-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0055dd, #0077ff);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-send:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.4);
}

.chatbot-send:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
}

/* ---------- Booking Form Steps ---------- */
.cb-booking-card {
  background: var(--cb-bg-tertiary);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
  padding: 16px;
  margin-top: 8px;
  animation: cb-msg-in 0.4s var(--cb-transition);
}

.cb-booking-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-accent-cyan);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cb-booking-card .cb-form-group {
  margin-bottom: 10px;
}

.cb-booking-card .cb-form-label {
  font-size: 12px;
  color: var(--cb-text-dim);
  margin-bottom: 4px;
  display: block;
}

.cb-booking-card .cb-form-input,
.cb-booking-card .cb-form-select,
.cb-booking-card .cb-form-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--cb-border);
  background: var(--cb-surface);
  color: var(--cb-text-bright);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.cb-booking-card .cb-form-input:focus,
.cb-booking-card .cb-form-select:focus,
.cb-booking-card .cb-form-textarea:focus {
  border-color: rgba(0, 102, 255, 0.5);
}

.cb-booking-card .cb-form-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='%238892a8' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.cb-booking-card .cb-form-select option {
  background: var(--cb-bg-secondary);
  color: var(--cb-text);
}

.cb-booking-card .cb-form-textarea {
  resize: vertical;
  min-height: 60px;
}

.cb-booking-submit {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #0055dd, #0077ff);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.cb-booking-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.35);
}

/* ---------- Service Cards in Chat ---------- */
.cb-services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.cb-service-card {
  padding: 12px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
  background: var(--cb-surface);
  cursor: pointer;
  text-align: center;
  transition: all 0.25s ease;
}

.cb-service-card:hover {
  border-color: var(--cb-primary);
  background: rgba(0, 102, 255, 0.08);
  transform: translateY(-2px);
}

.cb-service-card-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.cb-service-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--cb-text);
  line-height: 1.3;
}

/* ---------- Confirmation Card ---------- */
.cb-confirmation {
  background: linear-gradient(135deg, rgba(0, 200, 83, 0.1), rgba(0, 102, 255, 0.08));
  border: 1px solid rgba(0, 200, 83, 0.25);
  border-radius: var(--cb-radius-sm);
  padding: 18px 16px;
  text-align: center;
  margin-top: 8px;
}

.cb-confirmation-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.cb-confirmation-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--cb-accent-green);
  margin-bottom: 6px;
}

.cb-confirmation-text {
  font-size: 13px;
  color: var(--cb-text-dim);
  line-height: 1.5;
}

/* ---------- Powered-by ---------- */
.chatbot-powered {
  padding: 6px;
  text-align: center;
  font-size: 10px;
  color: var(--cb-text-dim);
  background: var(--cb-bg-secondary);
  letter-spacing: 0.03em;
  opacity: 0.6;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
  .chatbot-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .chatbot-toggle {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .cb-services-grid {
    grid-template-columns: 1fr;
  }
}
