/* LiteChat: Advanced UI / Glassmorphism Styles */
:root {
  --lc-primary-color: #007AFF;
  --lc-secondary-color: #5856D6;
  --lc-bg-glass: rgba(255, 255, 255, 1);
  --lc-bg-dark-glass: rgba(30, 30, 30, 0.85);
  --lc-text-color: #1c1c1e;
  --lc-text-light: #8e8e93;
  --lc-border-radius: 20px;
  --lc-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --lc-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --lc-z-index: 9999;
}

/* Base Container */
#chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  font-family: var(--lc-font-family);
  z-index: var(--lc-z-index);
  user-select: none;
}

/* Floating Bubble */
.lc-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-primary-color), var(--lc-secondary-color));
  box-shadow: var(--lc-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.lc-bubble:hover {
  transform: scale(1.1);
}

.lc-bubble svg {
  width: 30px;
  height: 30px;
  fill: white;
}

/* Notification Badge */
.lc-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background: #FF3B30;
  border: 2px solid white;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(255, 59, 48, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

/* Chat Window */
.lc-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  max-width: calc(100vw - 48px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background: var(--lc-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--lc-border-radius);
  box-shadow: var(--lc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: bottom right;
}

.lc-window.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* Header */
.lc-header {
  padding: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.lc-header-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--lc-text-color);
}

.lc-header-status {
  width: 8px;
  height: 8px;
  background: #34C759;
  border-radius: 50%;
}

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

/* Message Bubble */
.lc-msg {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
}

.lc-msg.bot {
  align-self: flex-start;
  background: white;
  color: var(--lc-text-color);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

/* Options Wrapper */
.lc-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  animation: fadeIn 0.5s ease both;
}

.lc-btn {
  background: rgba(0, 122, 255, 0.1);
  color: var(--lc-primary-color);
  border: 1px solid rgba(0, 122, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.lc-btn:hover {
  background: var(--lc-primary-color);
  color: white;
}

/* CTA Button */
.lc-cta {
  width: 100%;
  background: linear-gradient(135deg, var(--lc-primary-color), var(--lc-secondary-color));
  color: white;
  border: none;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  margin-top: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-sizing: border-box;
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* Typing Indicator */
.lc-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 18px;
  width: fit-content;
  border-bottom-left-radius: 4px;
  margin-bottom: 12px;
}

.lc-dot {
  width: 6px;
  height: 6px;
  background: #d1d1d6;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.lc-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.lc-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbar Customization */
.lc-messages::-webkit-scrollbar {
  width: 6px;
}

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

.lc-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

/* Dark Mode Overrides (Optional) */
@media (prefers-color-scheme: dark) {
  .lc-window {
    background: var(--lc-bg-dark-glass);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .lc-header-title {
    color: white;
  }

  .lc-msg.bot {
    background: #3a3a3c;
    color: white;
  }

  .lc-typing {
    background: #3a3a3c;
  }
}