/* Chat Modal Styles - Based on Figma Design */
.chat-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-modal-overlay.active {
  pointer-events: all;
  opacity: 1;
}

.chat-modal-container {
  position: fixed;
  bottom: 80px; /* Position above chat button */
  right: 64px; /* Align with chat button */
  width: 351px;
  height: 510px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  transform: translateY(100%) translateX(50px);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  font-family: 'Alexandria', sans-serif;
  overflow: hidden;
  top: auto;
  left: auto;
}

.chat-modal-overlay.active .chat-modal-container {
  transform: translateY(0) translateX(0);
}

/* Chat Header */
.chat-header {
  height: 59px;
  padding: 8px;
  background: rgba(9.77, 9.47, 9.47, 0.20);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-bottom: 0.5px solid black;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 8px;
}

.chat-logo {
  width: 120px;
  height: 43px;
  object-fit: contain;
}

/* Chat Content */
.chat-content {
  flex: 1;
  background: rgba(0, 0, 0, 0.20);
  overflow: hidden;
  position: relative;
}

/* Welcome Message */
.welcome-message {
  width: 313px;
  height: 72px;
  padding: 16px;
  margin: 14px 0 0 23px;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
}

.welcome-title {
  color: white;
  font-size: 14px;
  font-family: 'Alexandria', sans-serif;
  font-weight: 400;
  line-height: 20px;
  word-wrap: break-word;
}

.welcome-subtitle {
  color: white;
  font-size: 14px;
  font-family: 'Alexandria', sans-serif;
  font-weight: 400;
  line-height: 20px;
  word-wrap: break-word;
}

/* Chat Form */
.chat-form {
  width: 305px;
  margin: 18px 23px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-input {
  height: 40px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid white;
  background: transparent;
  color: #EEEEEE;
  font-size: 12px;
  font-family: 'Alexandria', sans-serif;
  font-weight: 400;
  outline: none;
}

.form-input::placeholder {
  color: #EEEEEE;
  font-size: 12px;
  font-family: 'Alexandria', sans-serif;
  font-weight: 400;
}

.form-textarea {
  height: 146px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid white;
  background: transparent;
  color: white;
  font-size: 12px;
  font-family: 'Alexandria', sans-serif;
  font-weight: 400;
  resize: none;
  outline: none;
}

.form-textarea::placeholder {
  color: white;
  font-size: 12px;
  font-family: 'Alexandria', sans-serif;
  font-weight: 400;
}

/* Chat Footer */
.chat-footer {
  height: 59px;
  padding: 8px;
  background: rgba(15, 163, 4, 0.43);
  border-bottom-right-radius: 24px;
  border-bottom-left-radius: 24px;
  border-top: 0.5px solid #787272;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.send-button {
  background: transparent;
  border: none;
  color: white;
  font-size: 14px;
  font-family: 'Alexandria', sans-serif;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  word-wrap: break-word;
  transition: opacity 0.3s ease;
  min-width: 120px; /* Prevent button size change during loading */
}

.send-button:hover {
  opacity: 0.8;
}

.send-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Close Button */
.chat-close-button {
  position: fixed;
  bottom: 15px; /* Below modal */
  right: 64px; /* Aligned with modal right edge */
  width: 57px;
  height: 57px;
  padding: 8px;
  opacity: 0.25;
  background: white;
  border-radius: 999px;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform: translateY(100%);
}

.chat-modal-overlay.active .chat-close-button {
  transform: translateY(0);
}

.chat-close-button:hover {
  opacity: 0.5;
}

.chat-close-button svg {
  width: 24px;
  height: 24px;
  color: black;
}

/* Hide chat button and partner card when modal is active */
body:has(.chat-modal-overlay.active) .chat-button {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

body:has(.chat-modal-overlay.active) .partner-card {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

/* Additional styles for chat button and partner card hiding */
.chat-button.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.partner-card.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* Responsive Design */
@media (max-width: 1440px) {
  .chat-modal-container {
    right: 4%;
  }
  
  .chat-close-button {
    right: 4%; /* Aligned with modal right edge */
  }
}

@media (max-width: 1024px) {
  .chat-modal-container {
    right: 3%;
    bottom: 100px;
    width: 320px;
    height: 480px;
  }
  
  .welcome-message {
    width: 280px;
    margin-left: 20px;
  }
  
  .chat-form {
    width: 280px;
    margin-left: 20px;
  }
  
  .chat-close-button {
    right: 3%; /* Aligned with modal right edge */
    bottom: 15px;
  }
}

@media (max-width: 768px) {
  .chat-modal-overlay {
    background: rgba(0, 0, 0, 0.5);
  }
  
  .chat-modal-container {
    left: 50%;
    right: auto;
    bottom: 80px;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 450px;
  }
  
  .chat-modal-overlay.active .chat-modal-container {
    transform: translate(-50%, -10%);
  }
  
  .welcome-message {
    width: 260px;
    margin-left: 20px;
    height: 60px;
    padding: 12px;
  }
  
  .chat-form {
    width: 260px;
    margin-left: 20px;
    gap: 18px;
  }
  
  .form-textarea {
    height: 120px;
  }
  
  .chat-close-button {
    left: 50%;
    right: auto;
    bottom: 15px;
    transform: translateX(-50%);
  }
}

@media (max-width: 480px) {
  .chat-modal-overlay {
    background: rgba(0, 0, 0, 0.5);
  }
  
  .chat-modal-container {
    left: 50%;
    right: auto;
    bottom: 70px;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 465px;
  }
  
  .chat-modal-overlay.active .chat-modal-container {
    transform: translate(-50%, -10%);
  }
  
  .welcome-message {
    width: 240px;
    margin-left: 20px;
  }
  
  .chat-form {
    width: 240px;
    margin-left: 20px;
  }
  
  .chat-close-button {
    left: 70%;
    right: auto;
    bottom: 15px;
    transform: translateX(-50%);
  }
  
  /* Arabic version specific positioning */
  html[dir="rtl"] .chat-close-button {
    left: 15%;
  }
}

/* Arabic RTL specific positioning for desktop */
@media (min-width: 769px) {
  html[dir="rtl"] .chat-modal-container {
    right: auto;
    left: 64px; /* Mirror position - left instead of right */
  }
  
  html[dir="rtl"] .chat-close-button {
    right: auto;
    left: 64px; /* Aligned with modal left edge */
  }
}
