/* ==================== CHAT INTERFACE ==================== */

.chat-container {
  background: linear-gradient(180deg, #0a0a0a 0%, #000000 100%);
  min-height: 100vh;
  padding: var(--space-xl) var(--space-md);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.chat-wrapper {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(30, 30, 30, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.chat-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--black-primary);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  border: 2px solid var(--gray-border);
  overflow: hidden;
}

.chat-avatar img,
.chat-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.chat-name {
  font-size: var(--text-h3);
  color: var(--white-primary);
  margin: 0;
}

.chat-tagline {
  font-size: var(--text-small);
  color: var(--cream-text);
  margin: 0;
  opacity: 0.7;
}

/* Chat Messages */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--space-lg);
  background: rgba(20, 20, 20, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top: none;
  border-radius: 0 0 16px 16px;
  box-shadow: none;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--black-primary);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--gray-border);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--gray-text);
}

/* Message Structure */
.message {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  opacity: 0;
  transform: translateY(20px);
  animation: messageSlideIn 0.3s ease forwards;
}

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

.message-bot {
  flex-direction: row;
}

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

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--black-primary);
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--gray-border);
  overflow: hidden;
}

.message-avatar img,
.message-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.message-avatar-user {
  background: var(--gray-border);
  color: var(--white-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-width: 80%;
}

.message-user .message-content {
  align-items: flex-end;
  max-width: 70%;
}

.message-label {
  font-size: var(--text-tiny);
  color: var(--gray-text);
  padding-right: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.message-bubble {
  background: rgba(26, 26, 26, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--white-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: 16px;
  border-top-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.message-user .message-bubble {
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.9) 0%, rgba(204, 0, 0, 0.9) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  border-top-right-radius: 4px;
  border-top-left-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 15px rgba(255, 0, 0, 0.3);
}

.message-bubble p {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.6;
  white-space: pre-line;
}

.message-time {
  font-size: var(--text-tiny);
  color: var(--gray-text);
  padding-left: var(--space-sm);
}

/* Message Image */
.message-image {
  margin-top: var(--space-sm);
}

.message-image img {
  width: 100%;
  max-width: 500px;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--gray-border);
}

.image-caption {
  margin-top: var(--space-xs);
  font-size: var(--text-small);
  color: var(--white-secondary);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-sm);
  background: var(--gray-border);
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
}

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

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

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

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Chat CTA Button */
.btn-chat-cta {
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.9) 0%, rgba(204, 0, 0, 0.9) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--white-primary);
  font-size: 16px;
  font-weight: 600;
  padding: 14px 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: var(--space-sm);
  display: inline-block;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

.btn-chat-cta:hover {
  background: linear-gradient(135deg, rgba(255, 26, 26, 0.95) 0%, rgba(230, 0, 0, 0.95) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
}

/* Chat Form */
.chat-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  width: 100%;
  max-width: 100%;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: var(--space-lg);
  box-shadow: none;
}

.form-input,
.form-textarea {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white-primary);
  font-size: var(--text-body);
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: rgba(255, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--gray-text);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.btn-form-submit {
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.9) 0%, rgba(204, 0, 0, 0.9) 100%);
  color: var(--white-primary);
  font-size: 16px;
  font-weight: 600;
  padding: 14px 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
}

.btn-form-submit:hover {
  background: linear-gradient(135deg, rgba(255, 26, 26, 0.95) 0%, rgba(230, 0, 0, 0.95) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
}

.btn-form-submit.loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-form-submit.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--white-primary);
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  margin-left: 8px;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Restart Button */
.btn-restart {
  background: transparent;
  color: var(--gray-text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border: 1px solid var(--gray-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: var(--space-lg);
}

.btn-restart:hover {
  border-color: rgba(255, 0, 0, 0.8);
  color: var(--white-primary);
  background: rgba(255, 0, 0, 0.1);
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.2);
}

/* ==================== RESPONSIVE: MOBILE ==================== */
@media (max-width: 767px) {
  .chat-container {
    padding: 24px 16px;
  }

  .chat-messages {
    max-height: 60vh;
  }

  .message-content {
    max-width: 85%;
  }

  .message-user .message-content {
    max-width: 85%;
  }

  .message-image img {
    max-width: 100%;
  }

  .chat-form {
    max-width: 100%;
  }

  .form-input,
  .form-textarea,
  .btn-form-submit {
    width: 100%;
  }

  .btn-chat-cta {
    width: 100%;
    text-align: center;
  }
}

/* ==================== FLOATING CONTACT BUTTON ==================== */
.floating-contact-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
  color: var(--white-primary);
  border: none;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(255, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  z-index: 999;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-contact-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 6px 30px rgba(255, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.floating-contact-btn:active {
  transform: translateY(-1px) scale(1.02);
}

/* ==================== CONTACT MODAL ==================== */
.contact-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.contact-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.contact-modal-content {
  position: relative;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(245, 242, 232, 0.1);
  border-radius: 24px;
  padding: var(--space-xl);
  max-width: 500px;
  width: 90%;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(245, 242, 232, 0.05) inset;
  animation: slideUp 0.3s ease;
}

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

.contact-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--cream-text);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-modal-close:hover {
  opacity: 1;
}

.contact-modal-title {
  font-size: var(--text-h2);
  color: var(--white-primary);
  margin-bottom: var(--space-xs);
  text-align: center;
}

.contact-modal-subtitle {
  font-size: var(--text-body);
  color: var(--cream-text);
  opacity: 0.7;
  text-align: center;
  margin-bottom: var(--space-lg);
}

.contact-modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ==================== RESPONSIVE: TABLET ==================== */
@media (min-width: 768px) and (max-width: 1023px) {
  .chat-wrapper {
    max-width: 700px;
  }
}

/* ==================== RESPONSIVE: MOBILE ==================== */
@media (max-width: 767px) {
  .floating-contact-btn {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .contact-modal-content {
    padding: var(--space-lg);
    width: 95%;
  }

  .contact-modal-title {
    font-size: var(--text-h3);
  }
}
