/* ═══════════════════════════════════════════════════════════════════
   DLS Tech Chat Widget — Styles
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --dls-primary: #0052A5;
  --dls-primary-dark: #003D7A;
  --dls-primary-light: #E8F0FE;
  --dls-accent: #00BFA5;
  --dls-bg: #FFFFFF;
  --dls-text: #1A1A2E;
  --dls-text-light: #6B7280;
  --dls-border: #E5E7EB;
  --dls-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --dls-radius: 16px;
  --dls-radius-sm: 10px;
  --dls-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --dls-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Widget Container ─────────────────────────────────────── */

.dls-chat-widget {
  font-family: var(--dls-font);
  line-height: 1.5;
}

/* ─── Floating Chat Bubble ──────────────────────────────────── */

.dls-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dls-chat-bubble-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--dls-primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 82, 165, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--dls-transition);
  position: relative;
}

.dls-chat-bubble-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 82, 165, 0.45);
}

.dls-chat-bubble-btn svg {
  width: 28px;
  height: 28px;
  transition: var(--dls-transition);
}

.dls-chat-bubble-btn.open svg {
  transform: rotate(90deg);
}

.dls-chat-bubble-label {
  background: white;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  font-size: 14px;
  color: var(--dls-text);
  white-space: nowrap;
  animation: dlsFadeIn 0.3s ease;
  display: none;
}

.dls-chat-bubble-label.visible {
  display: block;
}

/* ─── Chat Window ───────────────────────────────────────────── */

.dls-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 999998;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 140px);
  background: var(--dls-bg);
  border-radius: var(--dls-radius);
  box-shadow: var(--dls-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dlsSlideUp 0.3s ease;
}

.dls-chat-window.open {
  display: flex;
}

/* ─── Header ────────────────────────────────────────────────── */

.dls-chat-header {
  background: linear-gradient(135deg, var(--dls-primary), var(--dls-primary-dark));
  color: white;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.dls-chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.dls-chat-header-info {
  flex: 1;
}

.dls-chat-header-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.dls-chat-header-subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin: 2px 0 0;
}

.dls-chat-header-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: var(--dls-transition);
}

.dls-chat-header-close:hover {
  opacity: 1;
}

/* ─── Messages ──────────────────────────────────────────────── */

.dls-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F9FAFB;
}

.dls-chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--dls-radius-sm);
  font-size: 14px;
  line-height: 1.5;
  animation: dlsFadeIn 0.3s ease;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.dls-chat-message.user {
  align-self: flex-end;
  background: var(--dls-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.dls-chat-message.assistant {
  align-self: flex-start;
  background: white;
  color: var(--dls-text);
  border: 1px solid var(--dls-border);
  border-bottom-left-radius: 4px;
}

.dls-chat-message.typing {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--dls-border);
  padding: 14px 18px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.dls-chat-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dls-text-light);
  animation: dlsBounce 1.4s infinite ease-in-out;
}

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

/* ─── Input Area ────────────────────────────────────────────── */

.dls-chat-input-area {
  padding: 14px;
  border-top: 1px solid var(--dls-border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: white;
  flex-shrink: 0;
}

.dls-chat-input {
  flex: 1;
  border: 1px solid var(--dls-border);
  border-radius: var(--dls-radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--dls-font);
  resize: none;
  outline: none;
  transition: var(--dls-transition);
  min-height: 20px;
  max-height: 120px;
  line-height: 1.4;
}

.dls-chat-input:focus {
  border-color: var(--dls-primary);
  box-shadow: 0 0 0 3px rgba(0, 82, 165, 0.1);
}

.dls-chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--dls-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--dls-transition);
  flex-shrink: 0;
}

.dls-chat-send-btn:hover:not(:disabled) {
  background: var(--dls-primary-dark);
  transform: scale(1.05);
}

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

.dls-chat-send-btn svg {
  width: 20px;
  height: 20px;
}

/* ─── Footer ────────────────────────────────────────────────── */

.dls-chat-footer {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: var(--dls-text-light);
  background: white;
  border-top: 1px solid var(--dls-border);
  flex-shrink: 0;
}

.dls-chat-footer a {
  color: var(--dls-primary);
  text-decoration: none;
  font-weight: 500;
}

/* ─── Inline Embed Mode ─────────────────────────────────────── */

.dls-chat-inline {
  width: 100%;
  max-width: 600px;
  height: 500px;
  border-radius: var(--dls-radius);
  box-shadow: var(--dls-shadow);
  background: var(--dls-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
}

/* ─── Animations ────────────────────────────────────────────── */

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

@keyframes dlsSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dlsBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ─── Mobile Responsive ─────────────────────────────────────── */

@media (max-width: 480px) {
  .dls-chat-window {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .dls-chat-bubble {
    bottom: 16px;
    right: 16px;
  }

  .dls-chat-bubble-label {
    display: none !important;
  }
}

/* ─── Scrollbar ─────────────────────────────────────────────── */

.dls-chat-messages::-webkit-scrollbar {
  width: 5px;
}

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

.dls-chat-messages::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

.dls-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* ─── Error State ───────────────────────────────────────────── */

.dls-chat-error {
  align-self: center;
  text-align: center;
  padding: 12px;
  color: #DC2626;
  font-size: 13px;
  background: #FEF2F2;
  border-radius: var(--dls-radius-sm);
  width: 100%;
}

/* ─── Suggestion Chips ──────────────────────────────────────── */

.dls-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 12px;
  background: #F9FAFB;
}

.dls-chat-suggestion-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--dls-primary);
  background: white;
  color: var(--dls-primary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--dls-transition);
  font-family: var(--dls-font);
}

.dls-chat-suggestion-chip:hover {
  background: var(--dls-primary-light);
}
