/* ============================================================
   DOCTOR CONSULTATION PAGE
   Clean & Professional Design
   ============================================================ */

/* Main Container */
.askdoctor-main {
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.askdoctor-chat-container {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: #ffffff;
}

[data-theme="dark"] .askdoctor-chat-container {
  background: #1f2937;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  flex-wrap: wrap;
}

.page-header-content {
  flex: 1;
  min-width: 0;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

[data-theme="dark"] .page-title {
  color: #f9fafb;
}

.page-subtitle {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  margin: 0;
}

[data-theme="dark"] .page-subtitle {
  color: #9ca3af;
}

.add-query-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Queries Container */
.queries-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .queries-container {
    grid-template-columns: 1fr;
  }
}

/* Query Card */
.query-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .query-card {
  background: #1f2937;
  border-color: #374151;
}

.query-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #7c3aed;
}

[data-theme="dark"] .query-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Notification Badge */
.query-notification-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
  z-index: 10;
}

[data-theme="dark"] .query-notification-badge {
  border-color: #1f2937;
}

.query-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.query-card-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

[data-theme="dark"] .query-card-title {
  color: #f9fafb;
}

.query-card-category {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

[data-theme="dark"] .query-card-category {
  background: #111827;
  border-color: #374151;
  color: #9ca3af;
}

.query-card-description {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  line-height: 1.5;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="dark"] .query-card-description {
  color: #9ca3af;
}

.query-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

[data-theme="dark"] .query-card-footer {
  border-top-color: #374151;
}

.query-card-date {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
}

[data-theme="dark"] .query-card-date {
  color: #6b7280;
}

.query-card-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.query-card-status.pending {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  color: #d97706;
}

[data-theme="dark"] .query-card-status.pending {
  background: #78350f;
  border-color: #fbbf24;
  color: #fbbf24;
}

.query-card-status.replied {
  background: #d1fae5;
  border: 1px solid #10b981;
  color: #059669;
}

[data-theme="dark"] .query-card-status.replied {
  background: #064e3b;
  border-color: #10b981;
  color: #6ee7b7;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #6b7280;
}

[data-theme="dark"] .empty-state {
  color: #9ca3af;
}

.empty-state svg {
  margin: 0 auto 24px;
  color: #d1d5db;
}

[data-theme="dark"] .empty-state svg {
  color: #4b5563;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px;
}

[data-theme="dark"] .empty-state h3 {
  color: #f9fafb;
}

.empty-state p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

[data-theme="dark"] .empty-state p {
  color: #9ca3af;
}

/* Query Popup */
.query-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.query-popup {
  background: #ffffff;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

[data-theme="dark"] .query-popup {
  background: #1f2937;
}

.query-popup-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

[data-theme="dark"] .query-popup-header {
  border-bottom-color: #374151;
}

.query-popup-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

[data-theme="dark"] .query-popup-header h3 {
  color: #f9fafb;
}

.query-popup-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

[data-theme="dark"] .query-popup-close {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.query-popup-close:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}

[data-theme="dark"] .query-popup-close:hover {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fca5a5;
}

.query-popup-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.query-popup-content .form-group {
  margin-bottom: 20px;
}

.query-popup-content .form-group:last-child {
  margin-bottom: 0;
}

.query-popup-content textarea {
  resize: vertical;
  min-height: 120px;
}

/* Attachment Dropzone */
.attachment-dropzone {
  width: 100%;
  min-height: 200px;
  border: 2px dashed #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

[data-theme="dark"] .attachment-dropzone {
  background: #111827;
  border-color: #374151;
}

.attachment-dropzone:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
}

[data-theme="dark"] .attachment-dropzone:hover {
  background: #2d1b4e;
  border-color: #7c3aed;
}

.attachment-dropzone.drag-over {
  border-color: #7c3aed;
  background: #f5f3ff;
  border-style: solid;
}

[data-theme="dark"] .attachment-dropzone.drag-over {
  background: #2d1b4e;
  border-color: #7c3aed;
}

.dropzone-content {
  text-align: center;
  padding: 20px;
}

.dropzone-content svg {
  color: #9ca3af;
  margin-bottom: 12px;
}

[data-theme="dark"] .dropzone-content svg {
  color: #6b7280;
}

.dropzone-text {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px;
}

[data-theme="dark"] .dropzone-text {
  color: #f9fafb;
}

.dropzone-hint {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 8px;
}

[data-theme="dark"] .dropzone-hint {
  color: #9ca3af;
}

.dropzone-link {
  background: none;
  border: none;
  color: #7c3aed;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: 14px;
  padding: 0;
  font-family: inherit;
}

.dropzone-link:hover {
  color: #6d28d9;
}

.dropzone-info {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}

[data-theme="dark"] .dropzone-info {
  color: #6b7280;
}

/* Attachments List */
.attachments-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.attachment-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .attachment-item {
  background: #1f2937;
  border-color: #374151;
}

.attachment-item:hover {
  border-color: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
}

.attachment-item-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-item-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #6b7280;
}

[data-theme="dark"] .attachment-item-icon {
  background: #111827;
  color: #9ca3af;
}

.attachment-item-icon svg {
  width: 32px;
  height: 32px;
}

.attachment-item-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  border: 2px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
}

.attachment-item:hover .attachment-item-remove {
  opacity: 1;
}

.attachment-item-remove:hover {
  background: #ef4444;
  transform: scale(1.1);
}

.attachment-item-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.attachment-item:hover .attachment-item-name {
  opacity: 1;
}

.query-popup-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

[data-theme="dark"] .query-popup-footer {
  border-top-color: #374151;
}

.query-popup-cancel {
  border-color: #e5e7eb;
  background: #ffffff;
  color: #6b7280;
}

[data-theme="dark"] .query-popup-cancel {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.query-popup-cancel:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

[data-theme="dark"] .query-popup-cancel:hover {
  background: #111827;
}

.query-popup-submit {
  border-color: #7c3aed;
  background: #7c3aed;
  color: #ffffff;
}

.query-popup-submit:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}

/* Discussion View */
.discussion-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.discussion-container {
  background: #ffffff;
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

[data-theme="dark"] .discussion-container {
  background: #1f2937;
}

.discussion-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

[data-theme="dark"] .discussion-header {
  border-bottom-color: #374151;
}

.discussion-header-content {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.discussion-back-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="dark"] .discussion-back-btn {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.discussion-back-btn:hover {
  border-color: #7c3aed;
  background: #f9fafb;
  color: #7c3aed;
}

[data-theme="dark"] .discussion-back-btn:hover {
  background: #111827;
}

.discussion-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
  line-height: 1.3;
}

[data-theme="dark"] .discussion-title {
  color: #f9fafb;
}

.discussion-subtitle {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  margin: 0;
}

[data-theme="dark"] .discussion-subtitle {
  color: #9ca3af;
}

.discussion-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="dark"] .discussion-close-btn {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.discussion-close-btn:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}

[data-theme="dark"] .discussion-close-btn:hover {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fca5a5;
}

.discussion-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.discussion-content::-webkit-scrollbar {
  width: 6px;
}

.discussion-content::-webkit-scrollbar-track {
  background: transparent;
}

.discussion-content::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

[data-theme="dark"] .discussion-content::-webkit-scrollbar-thumb {
  background: #374151;
}

/* Query Details Card */
.query-details-card {
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

[data-theme="dark"] .query-details-card {
  background: #111827;
  border-bottom-color: #374151;
}

.query-details-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 12px;
  line-height: 1.3;
}

[data-theme="dark"] .query-details-title {
  color: #f9fafb;
}

.query-details-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.query-details-category {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

[data-theme="dark"] .query-details-category {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.query-details-date {
  font-size: 13px;
  color: #9ca3af;
  font-weight: 500;
}

[data-theme="dark"] .query-details-date {
  color: #6b7280;
}

.query-details-description {
  font-size: 15px;
  color: #111827;
  font-weight: 500;
  line-height: 1.6;
  margin: 0 0 16px;
}

[data-theme="dark"] .query-details-description {
  color: #f9fafb;
}

.query-details-attachment {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
}

[data-theme="dark"] .query-details-attachment {
  background: #1f2937;
  border-color: #374151;
}

.query-details-attachment img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.query-details-attachment-info {
  flex: 1;
  min-width: 0;
}

.query-details-attachment-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

[data-theme="dark"] .query-details-attachment-name {
  color: #f9fafb;
}

.query-details-attachment-meta {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .query-details-attachment-meta {
  color: #9ca3af;
}

/* Discussion Thread */
.discussion-thread {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
}

.discussion-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.discussion-message.admin {
  flex-direction: row-reverse;
}

.discussion-message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 16px;
  color: #111827;
  overflow: hidden;
}

[data-theme="dark"] .discussion-message-avatar {
  background: #111827;
  border-color: #374151;
  color: #f9fafb;
}

.discussion-message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discussion-message-avatar .avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.discussion-message-content {
  flex: 1;
  min-width: 0;
}

.discussion-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.discussion-message-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

[data-theme="dark"] .discussion-message-name {
  color: #f9fafb;
}

.discussion-message-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 10px;
  font-weight: 700;
  color: #8b5cf6;
  text-transform: uppercase;
}

[data-theme="dark"] .discussion-message-badge {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

.discussion-message-time {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  margin-left: auto;
}

[data-theme="dark"] .discussion-message-time {
  color: #6b7280;
}

.discussion-message-text {
  padding: 12px 16px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  line-height: 1.5;
  margin: 0;
}

[data-theme="dark"] .discussion-message-text {
  background: #111827;
  border-color: #374151;
  color: #f9fafb;
}

.discussion-message.admin .discussion-message-text {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #ffffff;
}

[data-theme="dark"] .discussion-message.admin .discussion-message-text {
  background: #6d28d9;
  border-color: #6d28d9;
}

/* Discussion Reply Section */
.discussion-reply-section {
  padding: 20px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  flex-shrink: 0;
}

[data-theme="dark"] .discussion-reply-section {
  background: #111827;
  border-top-color: #374151;
}

.discussion-reply-input-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.discussion-reply-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 16px;
  color: #111827;
  overflow: hidden;
}

[data-theme="dark"] .discussion-reply-avatar {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

.discussion-reply-avatar .avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.discussion-reply-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.discussion-reply-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  font-weight: 500;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

[data-theme="dark"] .discussion-reply-input {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

.discussion-reply-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.discussion-reply-input::placeholder {
  color: #9ca3af;
}

.discussion-reply-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.discussion-reply-submit-btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid #7c3aed;
  background: #7c3aed;
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.discussion-reply-submit-btn:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}

.discussion-reply-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

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

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

/* Chat Sidebar */
.chat-sidebar {
  width: 25%;
  min-width: 280px;
  max-width: 400px;
  border-right: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="dark"] .chat-sidebar {
  background: #111827;
  border-right-color: #374151;
}

.chat-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-theme="dark"] .chat-sidebar-header {
  background: #1f2937;
  border-bottom-color: #374151;
}

.chat-sidebar-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

[data-theme="dark"] .chat-sidebar-header h2 {
  color: #f9fafb;
}

.chat-count-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background: #7c3aed;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-sidebar-header .add-query-btn {
  width: 100%;
  justify-content: center;
  font-size: 13px;
  padding: 10px 16px;
}

.chat-search {
  width: 100%;
}

.chat-search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

[data-theme="dark"] .chat-search-input {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

.chat-search-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.chat-search-input::placeholder {
  color: #9ca3af;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

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

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

.chat-list::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

[data-theme="dark"] .chat-list::-webkit-scrollbar-thumb {
  background: #374151;
}

/* Chat Item */
.chat-item {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  position: relative;
}

[data-theme="dark"] .chat-item {
  background: #1f2937;
  border-bottom-color: #374151;
}

.chat-item:hover {
  background: #f9fafb;
}

[data-theme="dark"] .chat-item:hover {
  background: #111827;
}

.chat-item.active {
  background: #f5f3ff;
  border-left: 3px solid #7c3aed;
}

[data-theme="dark"] .chat-item.active {
  background: #2d1b4e;
  border-left-color: #7c3aed;
}

.chat-item.unread {
  background: #fef3c7;
}

[data-theme="dark"] .chat-item.unread {
  background: #78350f;
}

.chat-item-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid #e5e7eb;
  position: relative;
}

[data-theme="dark"] .chat-item-avatar {
  border-color: #374151;
}

.chat-item-info {
  flex: 1;
  min-width: 0;
}

.chat-item-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .chat-item-title {
  color: #f9fafb;
}

.chat-item-preview {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  margin: 0 0 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="dark"] .chat-item-preview {
  color: #9ca3af;
}

.chat-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-item-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.chat-status-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-status-badge.chat-status-pending {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  color: #d97706;
}

[data-theme="dark"] .chat-status-badge.chat-status-pending {
  background: #78350f;
  border-color: #fbbf24;
  color: #fbbf24;
}

.chat-status-badge.chat-status-active {
  background: #d1fae5;
  border: 1px solid #10b981;
  color: #059669;
}

[data-theme="dark"] .chat-status-badge.chat-status-active {
  background: #064e3b;
  border-color: #10b981;
  color: #6ee7b7;
}

.chat-status-badge.chat-status-replied {
  background: #dbeafe;
  border: 1px solid #3b82f6;
  color: #1e40af;
}

[data-theme="dark"] .chat-status-badge.chat-status-replied {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

.chat-status-badge.chat-status-resolved {
  background: #d1fae5;
  border: 1px solid #10b981;
  color: #059669;
}

[data-theme="dark"] .chat-status-badge.chat-status-resolved {
  background: #064e3b;
  border-color: #10b981;
  color: #6ee7b7;
}

.chat-status-badge.chat-status-emergency {
  background: #fee2e2;
  border: 1px solid #ef4444;
  color: #dc2626;
}

[data-theme="dark"] .chat-status-badge.chat-status-emergency {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fca5a5;
}

.chat-item-time {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  white-space: nowrap;
}

[data-theme="dark"] .chat-item-time {
  color: #6b7280;
}

.chat-item-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.chat-item-title {
  flex: 1;
  min-width: 0;
}

/* Chat Main Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
}

[data-theme="dark"] .chat-main {
  background: #1f2937;
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: #6b7280;
}

[data-theme="dark"] .chat-empty-state {
  color: #9ca3af;
}

.empty-state-icon {
  margin-bottom: 24px;
  color: #d1d5db;
}

[data-theme="dark"] .empty-state-icon {
  color: #4b5563;
}

.chat-empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px;
}

[data-theme="dark"] .chat-empty-state h3 {
  color: #f9fafb;
}

.chat-empty-state p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

[data-theme="dark"] .chat-empty-state p {
  color: #9ca3af;
}

/* Chat Active View */
.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  min-height: 60px;
}

[data-theme="dark"] .chat-header {
  background: #1f2937;
  border-bottom-color: #374151;
}

.chat-header-left {
  flex: 1;
  min-width: 0;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-header-info h3 {
  font-size: 16px;
  margin: 0;
  line-height: 1.3;
}

.chat-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-category-badge {
  padding: 4px 10px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
}

[data-theme="dark"] .chat-category-badge {
  background: #111827;
  border-color: #374151;
  color: #9ca3af;
}

.chat-date {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
}

[data-theme="dark"] .chat-date {
  color: #6b7280;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  white-space: nowrap;
  height: 32px;
  box-sizing: border-box;
}

[data-theme="dark"] .chat-header-stats {
  background: #111827;
  border-color: #374151;
}

.chat-header-stats span {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

[data-theme="dark"] .chat-header-stats span {
  color: #9ca3af;
}

.chat-header-stats strong {
  color: #7c3aed;
  font-weight: 700;
  margin-left: 4px;
}

[data-theme="dark"] .chat-header-stats strong {
  color: #8b5cf6;
}

.chat-count-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  min-width: 120px;
}

[data-theme="dark"] .chat-count-info {
  background: #111827;
  border-color: #374151;
}

.chat-count-info > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-count-info span:first-child {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .chat-count-info span:first-child {
  color: #9ca3af;
}

.chat-count-info span:last-child {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

[data-theme="dark"] .chat-count-info span:last-child {
  color: #f9fafb;
}

.chat-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.chat-stat-item-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.2s;
  cursor: default;
  min-height: 36px;
}

.chat-stat-item-compact:hover {
  background: rgba(124, 58, 237, 0.1);
}

[data-theme="dark"] .chat-stat-item-compact:hover {
  background: rgba(167, 139, 250, 0.1);
}

.chat-stat-item-compact svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #6b7280;
  stroke-width: 2;
}

[data-theme="dark"] .chat-stat-item-compact svg {
  color: #9ca3af;
}

.chat-stat-count {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

[data-theme="dark"] .chat-stat-count {
  color: #f9fafb;
}

.chat-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .chat-stat-label {
  color: #9ca3af;
}

.chat-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #7c3aed;
}

[data-theme="dark"] .chat-stat-value {
  color: #e9d5ff;
}

.doctors-involved {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  height: 36px;
  box-sizing: border-box;
}

[data-theme="dark"] .doctors-involved {
  background: #1f2937;
  border-color: #374151;
  color: #8b5cf6;
}

.doctors-involved:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #7c3aed;
}

[data-theme="dark"] .doctors-involved:hover {
  background: #2d1b4e;
  color: #8b5cf6;
}

.doctors-involved svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.emergency-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #ef4444;
  background: #ffffff;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  height: 36px;
  box-sizing: border-box;
}

[data-theme="dark"] .emergency-btn {
  background: #1f2937;
  color: #fca5a5;
  border-color: #ef4444;
}

.emergency-btn:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .emergency-btn:hover {
  background: #7f1d1d;
  border-color: #fca5a5;
  color: #fca5a5;
}

.emergency-btn.active {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

[data-theme="dark"] .emergency-btn.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.emergency-btn.active:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.emergency-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
  min-height: 0;
}

[data-theme="dark"] .chat-messages {
  background: #111827;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb {
  background: #374151;
}

.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 75%;
}

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

.chat-message.admin {
  align-self: flex-start;
}

.chat-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  border: 2px solid #e5e7eb;
}

[data-theme="dark"] .chat-message-avatar {
  border-color: #374151;
}

.chat-message.admin .chat-message-avatar {
  background: #8b5cf6;
}

.chat-message-content {
  flex: 1;
  min-width: 0;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.chat-message-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

[data-theme="dark"] .chat-message-name {
  color: #f9fafb;
}

.chat-message-badge {
  padding: 2px 8px;
  border-radius: 4px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 10px;
  font-weight: 700;
  color: #8b5cf6;
  text-transform: uppercase;
}

[data-theme="dark"] .chat-message-badge {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

.chat-message-time {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  margin-left: auto;
}

[data-theme="dark"] .chat-message-time {
  color: #6b7280;
}

.chat-message-text {
  padding: 12px 16px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  line-height: 1.5;
  margin: 0;
  word-wrap: break-word;
}

[data-theme="dark"] .chat-message-text {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

.chat-message.user .chat-message-text {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #ffffff;
}

[data-theme="dark"] .chat-message.user .chat-message-text {
  background: #6d28d9;
  border-color: #6d28d9;
}

.chat-message.admin .chat-message-text {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #111827;
}

[data-theme="dark"] .chat-message.admin .chat-message-text {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #f9fafb;
}

.message-admin-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.admin-name {
  font-size: 13px;
  font-weight: 600;
  color: #8b5cf6;
}

[data-theme="dark"] .admin-name {
  color: #93c5fd;
}

.admin-role {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .admin-role {
  color: #9ca3af;
}

/* Chat Dividers */
.chat-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.chat-divider-line {
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

[data-theme="dark"] .chat-divider-line {
  background: #374151;
}

.chat-divider-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
}

[data-theme="dark"] .chat-divider-content {
  color: #9ca3af;
}

.chat-divider-content svg {
  flex-shrink: 0;
  color: #9ca3af;
}

[data-theme="dark"] .chat-divider-content svg {
  color: #6b7280;
}

.chat-divider-content strong {
  color: #111827;
  font-weight: 600;
}

[data-theme="dark"] .chat-divider-content strong {
  color: #f9fafb;
}

.chat-divider-time {
  color: #9ca3af;
  font-size: 11px;
  margin-left: auto;
}

[data-theme="dark"] .chat-divider-time {
  color: #6b7280;
}

.chat-divider-resolved {
  margin-top: 24px;
}

.chat-divider-resolved .chat-divider-content {
  color: #059669;
}

[data-theme="dark"] .chat-divider-resolved .chat-divider-content {
  color: #6ee7b7;
}

/* Message Attachments */
.chat-message-attachments {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-attachments {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  max-width: 250px;
}

.message-attachments.single-image {
  grid-template-columns: 1fr;
  max-width: 200px;
}

.message-attachments.two-images {
  grid-template-columns: repeat(2, 1fr);
  max-width: 250px;
}

.message-attachments.multiple-images {
  grid-template-columns: repeat(2, 1fr);
  max-width: 250px;
}

.message-attachment {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .message-attachment {
  background: #1f2937;
  border-color: #374151;
}

.message-attachment:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-attachment-image-wrapper {
  position: relative;
  width: 100%;
  max-width: 200px;
  max-height: 150px;
  overflow: hidden;
  border-radius: 8px;
}

.message-attachment-image {
  width: 100%;
  height: auto;
  max-height: 150px;
  object-fit: cover;
  display: block;
}

.message-attachment-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message-attachment:hover .message-attachment-overlay {
  opacity: 1;
}

.message-attachment-info {
  flex: 1;
  min-width: 0;
}

.message-attachment-name {
  font-size: 10px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-size {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.message-attachment-download {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.message-attachment-download svg {
  width: 14px;
  height: 14px;
}

.message-attachment-download:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.message-attachment-video {
  position: relative;
  width: 100%;
  max-width: 200px;
  max-height: 120px;
  overflow: hidden;
  background: #000000;
  border-radius: 8px;
}

.message-attachment-video video {
  width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: cover;
  cursor: pointer;
  display: block;
}

.message-attachment-video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.message-attachment-video-overlay:hover {
  background: rgba(0, 0, 0, 0.5);
}

.message-attachment-video-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111827;
}

.message-attachment-video-play svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

.message-attachment-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  max-width: 250px;
}

.message-attachment-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  flex-shrink: 0;
}

[data-theme="dark"] .message-attachment-icon-wrapper {
  background: #111827;
  color: #9ca3af;
}

.message-attachment-icon {
  width: 18px;
  height: 18px;
}

.message-attachment-file-info {
  flex: 1;
  min-width: 0;
}

.message-attachment-file-name {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .message-attachment-file-name {
  color: #f9fafb;
}

.message-attachment-file-size {
  font-size: 10px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .message-attachment-file-size {
  color: #9ca3af;
}

.message-attachment-file-download {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.message-attachment-file-download svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .message-attachment-file-download {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.message-attachment-file-download:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #7c3aed;
}

[data-theme="dark"] .message-attachment-file-download:hover {
  background: #2d1b4e;
  color: #8b5cf6;
}

.chat-attachment-item {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .chat-attachment-item {
  background: #1f2937;
  border-color: #374151;
}

.chat-attachment-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chat-attachment-image {
  width: 100%;
  max-width: 400px;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.chat-attachment-video {
  width: 100%;
  max-width: 400px;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.chat-attachment-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.chat-attachment-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  flex-shrink: 0;
}

[data-theme="dark"] .chat-attachment-icon {
  background: #111827;
  color: #9ca3af;
}

.chat-attachment-info {
  flex: 1;
  min-width: 0;
}

.chat-attachment-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .chat-attachment-name {
  color: #f9fafb;
}

.chat-attachment-size {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .chat-attachment-size {
  color: #9ca3af;
}

/* Chat Reply Area */
.chat-reply {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  flex-shrink: 0;
}

[data-theme="dark"] .chat-reply {
  background: #1f2937;
  border-top-color: #374151;
}

.attachment-preview-container {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

[data-theme="dark"] .attachment-preview-container {
  background: #111827;
  border-bottom-color: #374151;
}

.attachment-preview-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

[data-theme="dark"] .attachment-preview-item {
  background: #1f2937;
  border-color: #374151;
}

.attachment-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-item .preview-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #6b7280;
}

[data-theme="dark"] .attachment-preview-item .preview-icon {
  background: #111827;
  color: #9ca3af;
}

.attachment-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  border: 2px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.attachment-preview-remove:hover {
  background: #ef4444;
  transform: scale(1.1);
}

.chat-reply-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-reply-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  font-weight: 500;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .chat-reply-input {
  background: #111827;
  border-color: #374151;
  color: #f9fafb;
}

.chat-reply-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.chat-reply-input::placeholder {
  color: #9ca3af;
}

.chat-reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.attachment-options {
  display: flex;
  gap: 6px;
  align-items: center;
}

.attachment-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

[data-theme="dark"] .attachment-btn {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.attachment-btn:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #7c3aed;
}

[data-theme="dark"] .attachment-btn:hover {
  background: #2d1b4e;
  color: #8b5cf6;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #7c3aed !important;
  background: #7c3aed !important;
  color: white !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="light"] .send-btn,
[data-theme="dark"] .send-btn {
  border: 1px solid #7c3aed !important;
  background: #7c3aed !important;
  color: white !important;
}

.send-btn:hover {
  background: #6d28d9 !important;
  border-color: #6d28d9 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: #7c3aed !important;
  border-color: #7c3aed !important;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.attachment-preview-modal {
  z-index: 3000;
  background: rgba(0, 0, 0, 0.9);
}

.attachment-preview-content {
  background: #ffffff;
  border-radius: 16px;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

[data-theme="dark"] .attachment-preview-content {
  background: #1f2937;
}

.attachment-preview-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  background: #ffffff;
}

[data-theme="dark"] .attachment-preview-header {
  background: #1f2937;
  border-bottom-color: #374151;
}

.attachment-preview-info {
  flex: 1;
  min-width: 0;
}

.attachment-preview-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .attachment-preview-info h3 {
  color: #f9fafb;
}

.attachment-preview-body {
  flex: 1;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #000000;
  min-height: 400px;
  max-height: calc(90vh - 100px);
}

.attachment-preview-body img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.attachment-preview-body video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
}

.attachment-preview-body iframe {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: none;
  border-radius: 8px;
}

.attachment-preview-file-viewer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #ffffff;
  text-align: center;
}

[data-theme="dark"] .attachment-preview-file-viewer {
  color: #f9fafb;
}

.attachment-preview-file-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  color: #ffffff;
  opacity: 0.8;
}

.attachment-preview-file-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  word-break: break-word;
}

.attachment-preview-file-size {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 24px;
}

.attachment-preview-download-btn {
  padding: 12px 24px;
  border-radius: 8px;
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.attachment-preview-download-btn:hover {
  background: #f3f4f6;
  transform: translateY(-1px);
}

.modal-content {
  background: #ffffff;
  border-radius: 16px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

[data-theme="dark"] .modal-content {
  background: #1f2937;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

[data-theme="dark"] .modal-header {
  border-bottom-color: #374151;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

[data-theme="dark"] .modal-header h2 {
  color: #f9fafb;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

[data-theme="dark"] .modal-close {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.modal-close:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}

[data-theme="dark"] .modal-close:hover {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fca5a5;
}

.modal-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

[data-theme="dark"] .modal-body::-webkit-scrollbar-thumb {
  background: #374151;
}

.doctor-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  margin-bottom: 12px;
}

[data-theme="dark"] .doctor-item {
  background: #111827;
  border-color: #374151;
}

.doctor-item:last-child {
  margin-bottom: 0;
}

.doctor-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #8b5cf6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.doctor-info {
  flex: 1;
  min-width: 0;
}

.doctor-name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

[data-theme="dark"] .doctor-name {
  color: #f9fafb;
}

.doctor-role {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .doctor-role {
  color: #9ca3af;
}

/* ============================================================
   RESPONSIVE — TABLET (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .askdoctor-main {
    height: auto;
    min-height: calc(100vh - 60px);
  }

  .askdoctor-chat-container {
    height: calc(100vh - 60px);
  }

  .chat-sidebar {
    min-width: 200px;
    width: 28%;
    max-width: 260px;
  }

  /* Sidebar items: more compact */
  .chat-sidebar-header {
    padding: 12px;
    gap: 8px;
  }

  .chat-sidebar-header h2 {
    font-size: 16px;
  }

  .chat-sidebar-header .add-query-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .chat-item {
    padding: 10px 12px;
  }

  .chat-item-avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
    border-radius: 10px;
  }

  .chat-item-title {
    font-size: 13px;
  }

  .chat-item-preview {
    font-size: 11px;
    -webkit-line-clamp: 1;
  }

  .chat-item-status {
    gap: 4px;
  }

  .chat-status-badge {
    font-size: 9px;
    padding: 2px 5px;
  }

  .chat-item-time {
    font-size: 10px;
  }

  /* Chat header: compact layout */
  .chat-header {
    padding: 8px 12px;
    gap: 8px;
    min-height: auto;
    flex-wrap: wrap;
  }

  .chat-header-left {
    flex: 1;
    min-width: 0;
  }

  .chat-header-info h3 {
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-header-info > div:first-child {
    margin-bottom: 2px !important;
  }

  .chat-status-badge {
    font-size: 9px;
    padding: 2px 6px;
  }

  .chat-header-meta {
    gap: 6px;
  }

  .chat-category-badge {
    font-size: 10px;
    padding: 2px 7px;
  }

  .chat-date {
    font-size: 11px;
  }

  /* Header right: compact row */
  .chat-header-right {
    gap: 6px;
    flex-wrap: wrap;
  }

  .chat-header-stats {
    gap: 6px;
    padding: 3px 6px;
    height: auto;
    min-height: 28px;
    font-size: 10px;
    flex-wrap: nowrap;
  }

  .chat-header-stats span {
    font-size: 10px;
    white-space: nowrap;
  }

  .emergency-btn {
    padding: 4px 8px;
    font-size: 10px;
    height: auto;
    min-height: 28px;
    white-space: nowrap;
  }

  .emergency-btn svg {
    width: 14px;
    height: 14px;
  }

  .doctors-involved {
    padding: 4px 8px;
    font-size: 10px;
    height: auto;
    min-height: 28px;
  }

  .doctors-involved svg {
    width: 14px;
    height: 14px;
  }

  /* Messages */
  .chat-message-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .chat-message-text {
    padding: 10px 14px;
    font-size: 13px;
  }

  .chat-message-name {
    font-size: 12px;
  }

  .chat-message-time {
    font-size: 10px;
  }

  /* Reply area */
  .chat-reply {
    padding: 8px 12px;
  }

  .attachment-btn {
    width: 36px;
    height: 36px;
  }

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

/* ============================================================
   RESPONSIVE — MEDIUM TABLET (≤ 900px) — switch to WhatsApp style
   ============================================================ */
@media (max-width: 900px) {
  /* At 900px the side-by-side is too cramped, switch to full-screen toggle */
  .askdoctor-chat-container {
    position: relative;
    overflow: hidden;
  }

  .chat-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 100%;
    border-right: none;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    transform: translateX(0);
  }

  .chat-main {
    width: 100% !important;
    min-width: 100% !important;
    height: 100%;
    position: absolute;
    top: 0;
    left: 100%;
    transition: transform 0.3s ease;
    transform: translateX(0);
    overflow: hidden;
  }

  .askdoctor-chat-container.mobile-chat-active .chat-sidebar {
    transform: translateX(-100%);
  }

  .askdoctor-chat-container.mobile-chat-active .chat-main {
    transform: translateX(-100%);
  }

  /* Show back button */
  .chat-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
  }

  [data-theme="dark"] .chat-back-btn {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
  }

  /* Sidebar gets full width — show full-width button again */
  .chat-sidebar-header {
    padding: 16px;
    gap: 10px;
  }

  .chat-sidebar-header h2 {
    font-size: 18px;
  }

  .chat-item {
    padding: 14px 16px;
  }

  .chat-item-avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .chat-item-title {
    font-size: 15px;
  }

  .chat-item-preview {
    font-size: 13px;
    -webkit-line-clamp: 2;
  }

  /* Chat header: comfortable single row */
  .chat-header {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 10px 14px;
  }

  .chat-header-info h3 {
    font-size: 15px;
  }

  /* Hide stats on medium — keep emergency + doctors */
  .chat-header-stats {
    display: none !important;
  }

  .emergency-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .doctors-involved {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Empty state hidden — sidebar IS the default */
  .chat-empty-state {
    display: none !important;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 768px) — WhatsApp-style toggle layout
   ============================================================ */

/* Back button: hidden on desktop */
.chat-back-btn {
  display: none;
}

/* Mobile icon-only new query: hidden on desktop */
.add-query-btn-icon {
  display: none !important;
}

@media (max-width: 768px) {
  .askdoctor-main {
    height: auto;
    min-height: calc(100vh - 120px);
    overflow: hidden;
  }

  .askdoctor-chat-container {
    flex-direction: row; /* keep side-by-side for sliding */
    height: calc(100vh - 120px);
    position: relative;
    overflow: hidden;
  }

  /* ── SIDEBAR: full screen by default on mobile ── */
  .chat-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 100%;
    border-right: none;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    transform: translateX(0);
  }

  /* ── CHAT MAIN: off-screen right by default ── */
  .chat-main {
    width: 100% !important;
    min-width: 100% !important;
    height: 100%;
    position: absolute;
    top: 0;
    left: 100%;
    transition: transform 0.3s ease;
    transform: translateX(0);
    overflow: hidden;
  }

  /* ── When a chat is active: slide sidebar left, slide chat into view ── */
  .askdoctor-chat-container.mobile-chat-active .chat-sidebar {
    transform: translateX(-100%);
  }

  .askdoctor-chat-container.mobile-chat-active .chat-main {
    transform: translateX(-100%);
  }

  /* ── SIDEBAR HEADER: compact ── */
  .chat-sidebar-header {
    padding: 12px;
    gap: 8px;
  }

  .chat-sidebar-header h2 {
    font-size: 17px;
    margin: 0;
  }

  /* Hide the full-width "New Query" button on mobile */
  .add-query-btn-full {
    display: none !important;
  }

  /* Show the icon-only "New Query" button on mobile */
  .add-query-btn-icon {
    display: flex !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .add-query-btn-icon span {
    display: none !important;
  }

  .chat-search-input {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* ── CHAT LIST ITEMS ── */
  .chat-item {
    padding: 12px;
  }

  .chat-item-content {
    gap: 10px;
  }

  .chat-item-avatar {
    width: 40px;
    height: 40px;
    font-size: 15px;
    border-radius: 10px;
  }

  .chat-item-title {
    font-size: 14px;
  }

  .chat-item-preview {
    font-size: 12px;
    -webkit-line-clamp: 1;
    margin-bottom: 4px;
  }

  /* ── BACK BUTTON: visible on mobile ── */
  .chat-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
  }

  [data-theme="dark"] .chat-back-btn {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
  }

  .chat-back-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
    background: #f5f3ff;
  }

  /* ── CHAT HEADER: single compact row ── */
  .chat-header {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    min-height: auto;
    flex-wrap: nowrap;
  }

  .chat-header-left {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .chat-header-info {
    gap: 2px;
  }

  .chat-header-info h3 {
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 !important;
  }

  /* Title + Status inline */
  .chat-header-info > div:first-child {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    margin-bottom: 0 !important;
    overflow: hidden;
  }

  .chat-status-badge {
    font-size: 8px;
    padding: 1px 5px;
    flex-shrink: 0;
  }

  .chat-header-meta {
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .chat-category-badge {
    font-size: 10px;
    padding: 1px 6px;
    flex-shrink: 0;
  }

  .chat-date {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── HEADER RIGHT: compact icon row ── */
  .chat-header-right {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    flex-shrink: 0;
  }

  /* Stats: icon-only, no labels */
  .chat-header-stats {
    display: none !important; /* Hide stats on mobile — shown in a different way */
  }

  /* Emergency button: icon-only */
  .emergency-btn {
    padding: 4px 6px;
    font-size: 0; /* Hide text */
    height: 30px;
    width: 30px;
    min-height: auto;
    border-radius: 6px;
    justify-content: center;
  }

  .emergency-btn span {
    display: none;
  }

  .emergency-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Doctors involved: icon-only */
  .doctors-involved {
    padding: 4px 6px;
    font-size: 0;
    height: 30px;
    width: auto;
    min-height: auto;
    border-radius: 6px;
    justify-content: center;
    gap: 3px;
  }

  .doctors-involved span {
    display: inline;
    font-size: 10px;
  }

  .doctors-involved svg {
    width: 14px;
    height: 14px;
  }

  /* ── MESSAGES ── */
  .chat-messages {
    padding: 10px;
    flex: 1;
    min-height: 0;
  }

  .chat-message {
    max-width: 88%;
  }

  .chat-message-content {
    padding: 10px 12px;
    font-size: 13px;
  }

  .chat-message-header {
    gap: 4px;
    flex-wrap: wrap;
  }

  .chat-message-name {
    font-size: 12px;
  }

  .chat-message-role {
    font-size: 10px;
    padding: 1px 5px;
  }

  .chat-message-time {
    font-size: 10px;
  }

  .chat-message-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .chat-message-text {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* ── REPLY AREA ── */
  .chat-reply {
    padding: 8px 10px;
  }

  .chat-reply-input-wrapper {
    gap: 6px;
  }

  .chat-reply-input {
    padding: 8px 10px;
    font-size: 13px;
    min-height: 38px;
  }

  .chat-reply-actions {
    gap: 4px;
  }

  .attachment-options {
    gap: 2px;
  }

  .attachment-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .attachment-btn svg {
    width: 16px;
    height: 16px;
  }

  .send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

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

  /* ── QUERY POPUP ── */
  .query-popup {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .query-popup-content {
    padding: 16px;
  }

  /* ── EMPTY STATE ── */
  .chat-empty-state {
    display: none !important; /* On mobile, sidebar IS the default view */
  }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .askdoctor-chat-container {
    height: calc(100vh - 115px);
  }

  .chat-sidebar-header {
    padding: 10px;
    gap: 6px;
  }

  .chat-sidebar-header h2 {
    font-size: 16px;
  }

  .add-query-btn-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
  }

  .chat-item {
    padding: 10px;
  }

  .chat-item-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
    border-radius: 8px;
  }

  .chat-item-title {
    font-size: 13px;
  }

  .chat-item-preview {
    font-size: 11px;
  }

  /* Chat header */
  .chat-header {
    padding: 6px 8px;
    gap: 6px;
  }

  .chat-back-btn {
    width: 28px;
    height: 28px;
  }

  .chat-back-btn svg {
    width: 16px;
    height: 16px;
  }

  .chat-header-info h3 {
    font-size: 12px;
  }

  .chat-category-badge {
    font-size: 9px;
    padding: 1px 5px;
  }

  .chat-date {
    font-size: 9px;
  }

  .emergency-btn {
    width: 26px;
    height: 26px;
    padding: 3px;
  }

  .emergency-btn svg {
    width: 12px;
    height: 12px;
  }

  .doctors-involved {
    height: 26px;
    padding: 3px 5px;
    gap: 2px;
  }

  .doctors-involved svg {
    width: 12px;
    height: 12px;
  }

  .doctors-involved span {
    font-size: 9px;
  }

  /* Messages */
  .chat-messages {
    padding: 8px;
  }

  .chat-message {
    max-width: 92%;
  }

  .chat-message-text {
    padding: 6px 10px;
    font-size: 12px;
  }

  .chat-message-avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  .chat-message-name {
    font-size: 11px;
  }

  .chat-message-time {
    font-size: 9px;
  }

  /* Reply */
  .chat-reply {
    padding: 6px 8px;
  }

  .chat-reply-input {
    padding: 7px 10px;
    font-size: 12px;
    min-height: 34px;
  }

  .attachment-btn {
    width: 30px;
    height: 30px;
  }

  .attachment-btn svg {
    width: 14px;
    height: 14px;
  }

  .send-btn {
    width: 34px;
    height: 34px;
  }

  .send-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* ============================================================
   RESPONSIVE — VERY SMALL (≤ 380px)
   ============================================================ */
@media (max-width: 380px) {
  .chat-header-info h3 {
    font-size: 11px;
  }

  .chat-status-badge {
    font-size: 7px;
    padding: 1px 4px;
  }

  .chat-category-badge {
    font-size: 8px;
    padding: 1px 4px;
  }

  .chat-date {
    font-size: 8px;
  }

  .doctors-involved span {
    display: none;
  }
}

