/* CHAT - MODERN LIGHT THEME */
.chat-container {
  width: 100%;
  max-width: 600px;
  min-height: 200px;
  max-height: 500px;
  resize: vertical;
  border-radius: 18px;
  margin: 0 auto;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #3b82f6;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.12);
  /* Enable internal scroll areas (e.g., .chat-div) to size correctly */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
}

.chat-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 18px 18px 0 0;
}

.chat-container::after {
  content: 'forum';
  font-family: 'Material Icons';
  position: absolute;
  top: 14px;
  right: 22px;
  font-size: 18px;
  color: #1e40af;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 10px;
  border-radius: 50%;
  border: 2px solid #1e40af;
  box-shadow: 0 0 0 1px #dbeafe;
  z-index: 10;
}

.chat-container:hover {
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.18);
  transform: translateY(-3px);
}

/* Chat wrapper to ensure proper centering and spacing */
.chat-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  padding: 0 24px;
  box-sizing: border-box;
  margin: 24px 0;
}

/* media query for mobile and tablet screens to adjust chat-container width */
@media (max-width: 768px) {
  .chat-container {
    width: 100%;
    max-width: 100%;
    max-height: 400px;
    margin: 24px auto;
    border-radius: 16px;
  }
  
  .chat-wrapper {
    padding: 0 16px;
    margin: 20px 0;
  }
}

.correction-attachment {
background-color: #126792;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}

.chat-div {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 50%, #f1f5f9 100%);
  padding: 24px;
  overflow-y: auto;
  /* Allow this section to take the remaining height and scroll */
  flex: 1 1 auto;
  min-height: 0; /* critical for flex items to allow internal scrolling */
  width: 100%;
  border-radius: inherit;
  -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
}

.text-area {
  border-radius: 12px;
  margin-bottom: 16px;
  color: #374151;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 14px 16px;
  font-size: 15px;
  min-height: 80px;
  resize: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
}

.text-area:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
  background-color: #ffffff;
}

.text-area::placeholder {
  color: #9ca3af;
  font-style: italic;
}
.chat-button,
.archive-button {
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 16px 32px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  text-transform: none !important;
  letter-spacing: 0.5px !important;
  min-width: 180px !important;
  position: relative;
  overflow: hidden;
  margin-top: 16px;
  min-height: 48px;
}

.chat-button {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3) !important;
}

.archive-button {
  background: linear-gradient(135deg, #9ca3af 0%, #374151 100%) !important;
  box-shadow: 0 4px 16px rgba(55, 65, 81, 0.22) !important;
  margin-left: 10px;
}

.chat-button::before,
.archive-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.chat-button:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4) !important;
}

.archive-button:hover {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(55, 65, 81, 0.28) !important;
}

.chat-button:hover::before,
.archive-button:hover::before {
  left: 100%;
}

.chat-button:active {
  transform: translateY(0) !important;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3) !important;
}

.archive-button:active {
  transform: translateY(0) !important;
  box-shadow: 0 4px 16px rgba(55, 65, 81, 0.22) !important;
}

.chat-button-2 {
  /* New-message attention style (red/rose) */
  background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 16px 32px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  text-transform: none !important;
  letter-spacing: 0.5px !important;
  min-width: 180px !important;
  box-shadow: 0 6px 18px rgba(225, 29, 72, 0.32) !important;
  position: relative;
  overflow: hidden;
  margin-top: 16px;
  min-height: 48px;

  /* Draw attention without being too loud */
  animation: chatButtonAttentionPulse 1.2s ease-in-out infinite;
}

.chat-button-2::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.chat-button-2:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 10px 28px rgba(225, 29, 72, 0.42) !important;
}

.chat-button-2:hover::before {
  left: 100%;
}

.chat-button-2:active {
  transform: translateY(0) !important;
  box-shadow: 0 6px 18px rgba(225, 29, 72, 0.32) !important;
}

@keyframes chatButtonAttentionPulse {
  0% {
    transform: translateY(0);
    box-shadow: 0 6px 18px rgba(225, 29, 72, 0.32);
    filter: saturate(1);
  }
  50% {
    transform: translateY(-1px);
    box-shadow:
      0 10px 28px rgba(225, 29, 72, 0.45),
      0 0 0 4px rgba(244, 63, 94, 0.22);
    filter: saturate(1.08);
  }
  100% {
    transform: translateY(0);
    box-shadow: 0 6px 18px rgba(225, 29, 72, 0.32);
    filter: saturate(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-button-2 {
    animation: none !important;
  }
}

.chat-button-close {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 16px 32px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  text-transform: none !important;
  letter-spacing: 0.5px !important;
  min-width: 180px !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3) !important;
  position: relative;
  overflow: hidden;
  margin: 16px 0 20px 0;
  min-height: 48px;
}

.chat-button-close::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.chat-button-close:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4) !important;
}

.chat-button-close:hover::before {
  left: 100%;
}

.chat-button-close:active {
  transform: translateY(0) !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3) !important;
}

.send-button {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 16px 32px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  text-transform: none !important;
  letter-spacing: 0.5px !important;
  min-width: 180px !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3) !important;
  position: relative;
  overflow: hidden;
  min-height: 48px;
}

.send-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.send-button:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4) !important;
}

.send-button:hover::before {
  left: 100%;
}

.send-button:active {
  transform: translateY(0) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3) !important;
}
.message-bubble {
  display: flex;
  flex-direction: column;
  text-align: left !important;
  justify-content: flex-start;
  align-items: flex-start;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 18px 18px 4px 18px;
  padding: 16px 20px;
  margin: 8px 0;
  max-width: 80%;
  align-self: flex-end;
  box-shadow: 0 3px 15px rgba(102, 126, 234, 0.2);
  position: relative;
  animation: slideInRight 0.3s ease-out;
}

.message-bubble p {
  color: #ffffff !important;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-bubble-admin {
  display: flex;
  flex-direction: column;
  text-align: left !important;
  justify-content: flex-start;
  align-items: flex-start;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 18px 18px 18px 4px;
  padding: 16px 20px;
  margin: 8px 0;
  max-width: 80%;
  align-self: flex-start;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
  position: relative;
  animation: slideInLeft 0.3s ease-out;
}

.message-bubble-admin p {
  color: #374151 !important;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-bubble-translator {
  display: flex;
  flex-direction: column;
  text-align: left !important;
  justify-content: flex-start;
  align-items: flex-start;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border: 1px solid #d1d5db;
  border-radius: 18px 18px 18px 4px;
  padding: 16px 20px;
  margin: 8px 0;
  max-width: 80%;
  align-self: flex-start;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.06);
  position: relative;
  animation: slideInLeft 0.3s ease-out;
}
.message-bubble-translator p {
  color: #1f2937 !important;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.message-sender {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message-timestamp {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 6px;
  font-style: italic;
}

.message-status {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 4px;
  font-weight: 500;
}

.correction-attachments-list {
  color: #374151;
  font-size: 14px;
}

.main-chat-div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 32px 24px;
  margin: 24px 0;
  background: transparent;
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.chat-attachments-container {
  display: none;
  margin-top: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 16px !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
  transition: all 0.3s ease !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-attachments-container:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
  transform: translateY(-1px);
}

.chat-attachments-container ol {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #374151;
  width: 100%;
}

.attachment-file,
.message-attachment-container {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.3s ease !important;
  margin-bottom: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.attachment-file:hover,
.message-attachment-container:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-1px);
  border-color: #cbd5e1 !important;
}

.message-attachment-input {
  display: none;
}

/* ===== CHAT RESPONSIVE MEDIA QUERIES ===== */

/* Large Desktop Screens (1440px and up) */
@media (min-width: 1440px) {
  .chat-container {
    max-width: 700px;
    min-height: 250px;
    max-height: 600px;
    border-radius: 20px;
    margin: 32px auto;
  }
  
  .chat-wrapper {
    padding: 0 24px;
  }
  
  .chat-div {
    padding: 32px;
  }
  
  .text-area {
    padding: 18px 20px;
    font-size: 16px;
    min-height: 100px;
    border-radius: 14px;
    margin-bottom: 20px;
  }
  
  .message-bubble,
  .message-bubble-admin {
    padding: 20px 24px;
    margin: 12px 0;
    border-radius: 20px 20px 6px 20px;
  }
  
  .message-bubble-admin {
    border-radius: 20px 20px 20px 6px;
  }
  
  .message-bubble p,
  .message-bubble-admin p {
    font-size: 16px;
    line-height: 1.6;
  }
}

/* Desktop Screens (1025px to 1439px) */
@media (min-width: 1025px) and (max-width: 1439px) {
  .chat-container {
    max-width: 650px;
    min-height: 220px;
    max-height: 550px;
    border-radius: 18px;
    margin: 28px auto;
  }
  
  .chat-wrapper {
    padding: 0 22px;
  }
  
  .chat-div {
    padding: 28px;
  }
  
  .text-area {
    padding: 16px 18px;
    font-size: 15px;
    min-height: 90px;
    border-radius: 13px;
    margin-bottom: 18px;
  }
  
  .message-bubble,
  .message-bubble-admin {
    padding: 18px 22px;
    margin: 10px 0;
    border-radius: 19px 19px 5px 19px;
  }
  
  .message-bubble-admin {
    border-radius: 19px 19px 19px 5px;
  }
}

/* Large Tablets (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .chat-container {
    max-width: 90%;
    min-height: 200px;
    max-height: 450px;
    border-radius: 16px;
    margin: 20px auto;
  }
  
  .chat-wrapper {
    padding: 0 20px;
  }
  
  .chat-div {
    padding: 24px;
  }
  
  .text-area {
    padding: 14px 16px;
    font-size: 15px;
    min-height: 80px;
    margin-bottom: 16px;
  }
  
  .message-bubble,
  .message-bubble-admin {
    padding: 16px 20px;
    margin: 8px 0;
    max-width: 85%;
  }
  
  .chat-button,
  .archive-button,
  .chat-button-2,
  .chat-button-close,
  .send-button {
    padding: 14px 20px;
    font-size: 15px;
    min-height: 50px;
  }
}

/* Small Tablets and Large Mobile (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .chat-container {
    max-width: 95%;
    min-height: 180px;
    max-height: 400px;
    border-radius: 14px;
    margin: 16px auto;
  }
  
  .chat-wrapper {
    padding: 0 12px;
  }
  
  .chat-div {
    padding: 20px;
  }
  
  .text-area {
    padding: 12px 14px;
    font-size: 16px;
    min-height: 70px;
    margin-bottom: 14px;
    border-radius: 10px;
  }
  
  .message-bubble,
  .message-bubble-admin {
    padding: 14px 18px;
    margin: 6px 0;
    max-width: 90%;
    border-radius: 16px 16px 4px 16px;
  }
  
  .message-bubble-admin {
    border-radius: 16px 16px 16px 4px;
  }
  
  .message-bubble p,
  .message-bubble-admin p {
    font-size: 15px;
  }
  
  .chat-button,
  .archive-button,
  .chat-button-2,
  .chat-button-close,
  .send-button {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    min-height: 52px;
    margin-top: 12px;
    border-radius: 12px;
  }

  .archive-button {
    margin-left: 0;
  }
}

/* Mobile Screens (320px to 480px) */
@media (max-width: 480px) {
  .chat-container {
    width: 100%;
    max-width: 100%;
    min-height: 160px;
    max-height: 350px;
    border-radius: 12px;
    margin: 12px auto;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.06);
  }
  
  .chat-wrapper {
    padding: 0 8px;
  }
  
  .chat-div {
    padding: 16px;
  }
  
  .text-area {
    padding: 14px 16px;
    font-size: 16px;
    min-height: 60px;
    margin-bottom: 12px;
    border-radius: 8px;
    /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }
  
  .message-bubble,
  .message-bubble-admin {
    padding: 12px 16px;
    margin: 6px 0;
    max-width: 95%;
    border-radius: 14px 14px 4px 14px;
  }
  
  .message-bubble-admin {
    border-radius: 14px 14px 14px 4px;
  }
  
  .message-bubble p,
  .message-bubble-admin p {
    font-size: 15px;
    line-height: 1.4;
  }
  
  .message-sender {
    font-size: 11px;
  }
  
  .message-timestamp {
    font-size: 10px;
  }
  
  .chat-button,
  .archive-button,
  .chat-button-2,
  .chat-button-close,
  .send-button {
    width: calc(100% - 32px) !important;
    min-width: unset !important;
    max-width: calc(100% - 32px) !important;
    padding: 16px 20px !important;
    font-size: 16px !important;
    min-height: 48px !important;
    margin: 12px 16px 12px 16px !important;
    border-radius: 10px !important;
    touch-action: manipulation !important;
    box-sizing: border-box !important;
  }
  
  .main-chat-div {
    padding: 16px 16px !important;
    margin: 12px 16px !important;
    gap: 12px !important;
  }
  
  .chat-attachments-container {
    margin-top: 12px;
    padding: 12px !important;
    border-radius: 10px !important;
  }
}

/* Extra Small Mobile (below 320px) */
@media (max-width: 319px) {
  .chat-container {
    min-height: 140px;
    max-height: 300px;
    border-radius: 10px;
    margin: 10px 0;
  }
  
  .chat-div {
    padding: 12px;
  }
  
  .text-area {
    padding: 12px 14px;
    font-size: 16px;
    min-height: 50px;
    margin-bottom: 10px;
  }
  
  .message-bubble,
  .message-bubble-admin {
    padding: 10px 14px;
    margin: 4px 0;
    border-radius: 12px 12px 3px 12px;
  }
  
  .message-bubble-admin {
    border-radius: 12px 12px 12px 3px;
  }
  
  .message-bubble p,
  .message-bubble-admin p {
    font-size: 14px;
  }
  
  .chat-button,
  .archive-button,
  .chat-button-2,
  .chat-button-close,
  .send-button {
    padding: 14px 16px;
    font-size: 15px;
    min-height: 44px;
    margin-top: 10px;
    border-radius: 8px;
  }
}




