/* Chat Widget Styles */
.chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: none;
  animation: fadeIn 0.2s ease;
}

.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: white;
  transition: transform 0.3s;
}

.chat-toggle.active svg {
  transform: rotate(90deg);
}

.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 520px;
  background: var(--dark);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

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

.chat-window-header {
  padding: 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-avatar svg {
  width: 20px;
  height: 20px;
  stroke: white;
}

.chat-info h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-info span {
  font-size: 0.8rem;
  opacity: 0.9;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #fbbf24;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-messages-container::-webkit-scrollbar {
  width: 6px;
}

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

.chat-messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-message.bot {
  background: rgba(255, 255, 255, 0.1);
  color: var(--light);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-message.bot.typing {
  display: flex;
  gap: 5px;
  padding: 16px 20px;
}

.chat-message.bot.typing span {
  width: 8px;
  height: 8px;
  background: var(--gray);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.chat-message.bot.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-message.bot.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.chat-message .timestamp {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-top: 5px;
  display: block;
}

.chat-message a {
  color: #6c63ff;
  text-decoration: underline;
  font-weight: 600;
  transition: color 0.2s ease;
}

.chat-message a:hover {
  color: #8b83ff;
}

.chat-message.user a {
  color: white;
  text-decoration: underline;
}

.chat-message.user a:hover {
  opacity: 0.9;
}

.chat-input-container {
  padding: 15px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  background: var(--darker);
  color: var(--light);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s;
}

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

.chat-input::placeholder {
  color: var(--gray);
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.2s;
}

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

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send svg {
  width: 20px;
  height: 20px;
  fill: white;
  pointer-events: none;
}

/* Welcome message */
.welcome-message {
  text-align: center;
  padding: 20px;
  color: var(--gray);
}

.welcome-message h5 {
  color: var(--light);
  font-size: 1rem;
  margin-bottom: 10px;
}

.welcome-message p {
  font-size: 0.85rem;
  line-height: 1.6;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
  justify-content: center;
}

.quick-action {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: var(--light);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: var(--primary);
}

/* Tablet responsive */
@media (max-width: 768px) {
  .chat-widget {
    bottom: 20px;
    right: 20px;
  }

  .chat-window {
    width: 360px;
    height: 480px;
  }

  .chat-toggle {
    width: 56px;
    height: 56px;
  }

  .chat-toggle svg {
    width: 26px;
    height: 26px;
  }
}

/* Mobile responsive */
@media (max-width: 640px) {
  .chat-widget {
    bottom: 15px;
    right: 15px;
    left: 15px;
  }

  .chat-toggle {
    width: 54px;
    height: 54px;
    position: fixed;
    right: 15px;
    bottom: 10px;
    left: auto;
  }

  .chat-window {
    width: calc(100vw - 30px);
    height: calc(100vh - 100px);
    max-height: 600px;
    bottom: 75px;
    right: 0;
    left: 0;
    margin: 0 auto;
  }

  .chat-window-header {
    padding: 16px;
  }

  .chat-avatar {
    width: 36px;
    height: 36px;
  }

  .chat-info h4 {
    font-size: 0.95rem;
  }

  .chat-info span {
    font-size: 0.75rem;
  }

  .chat-messages-container {
    padding: 15px;
    gap: 12px;
  }

  .chat-message {
    font-size: 0.85rem;
    padding: 10px 14px;
    max-width: 90%;
  }

  .chat-message .timestamp {
    font-size: 0.65rem;
  }

  .chat-input-container {
    padding: 12px 15px;
  }

  .chat-input {
    font-size: 0.85rem;
    padding: 10px 14px;
  }

  .chat-send {
    width: 40px;
    height: 40px;
  }

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

  .welcome-message {
    padding: 15px;
  }

  .welcome-message h5 {
    font-size: 0.95rem;
  }

  .welcome-message p {
    font-size: 0.8rem;
  }

  .quick-actions {
    gap: 6px;
  }

  .quick-action {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
}

/* Very small mobile devices */
@media (max-width: 380px) {
  .chat-widget {
    bottom: 10px;
    right: 10px;
    left: 10px;
  }

  .chat-toggle {
    width: 50px;
    height: 50px;
    right: 10px;
  }

  .chat-toggle svg {
    width: 24px;
    height: 24px;
  }

  .chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 90px);
    max-height: 500px;
    bottom: 70px;
  }

  .chat-window-header {
    padding: 12px;
  }

  .chat-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-info h4 {
    font-size: 0.9rem;
  }

  .chat-info span {
    font-size: 0.7rem;
  }

  .chat-messages-container {
    padding: 12px;
  }

  .chat-message {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .chat-input {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .quick-action {
    font-size: 0.7rem;
    padding: 5px 10px;
  }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .chat-window {
    height: calc(100vh - 80px);
    max-height: 400px;
  }

  .chat-messages-container {
    padding: 10px;
  }

  .welcome-message {
    padding: 10px;
  }

  .quick-actions {
    margin-top: 10px;
  }
}
