/* Chat Notes Modular CSS */

/* The Modal Container */
#chatNotesModal .modal-dialog {
  max-width: 90vw; /* Wide layout */
  margin: 2vh auto;
  height: 96vh;
  display: flex;
  align-items: center;
}

#chatNotesModal .modal-content {
  height: 100%;
  max-height: 900px;
  border-radius: 16px;
  overflow: hidden;
  border: none;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

#chatNotesModal .modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

#chatNotesModal .modal-body {
  padding: 0;
  display: flex;
  overflow: hidden;
  flex: 1;
  background: #f8fafc;
}

/* Left Sidebar using Grid now in HTML but styled here as flex column */
.chat-notes-sidebar {
  width: 320px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  gap: 20px;
  flex-shrink: 0;
  z-index: 2;
}

/* Right Content Area */
.chat-notes-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* Client Info Card */
.client-info-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e2e8f0;
}

.client-info-header {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.client-info-row:last-child {
  margin-bottom: 0;
}

.client-info-label {
  color: #64748b;
  font-weight: 500;
}

.client-info-value {
  color: #334155;
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Quick Actions Panel */
.notes-actions-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-action-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  transition: all 0.2s;
}

.btn-action-note:hover {
  background: #f1f5f9;
  color: #1e293b;
  transform: translateY(-1px);
}

.btn-action-note i {
  font-size: 14px;
  color: #64748b;
}

/* Comments List Scroll Area */
.chat-comments-scroll-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background-image: 
    radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 20px 20px;
  background-color: #f8fafc;
}

.chat-comments-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  gap: 16px;
}

.chat-comments-empty i {
  font-size: 48px;
  opacity: 0.5;
}

/* Comment Item Design */
.chat-comment-item {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border: 1px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.chat-comment-item:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  border-color: #e2e8f0;
}

.chat-comment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.chat-comment-author-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.chat-comment-meta {
  display: flex;
  flex-direction: column;
}

.chat-comment-name {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.chat-comment-role-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
  width: fit-content;
}

.chat-comment-timestamp {
  font-size: 11px;
  color: #94a3b8;
}

.chat-comment-body {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
  padding-left: 40px; /* Align with text not avatar */
}

.chat-comment-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #f1f5f9;
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-comment-item:hover .chat-comment-actions-bar {
  opacity: 1;
}

/* Composer Area */
.chat-composer-area {
  padding: 20px 24px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.02);
  z-index: 10;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] #chatNotesModal .modal-content {
  background: #0f172a;
  color: #e5e7eb;
}

[data-theme="dark"] #chatNotesModal .modal-header {
  background: #0b1220;
  border-bottom-color: #1f2937;
}

[data-theme="dark"] #chatNotesModal .modal-body {
  background: #0f172a;
}

[data-theme="dark"] .chat-notes-sidebar {
  background: #0b1220;
  border-right-color: #1f2937;
}

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

[data-theme="dark"] .client-info-header,
[data-theme="dark"] .chat-comment-name {
  color: #e5e7eb;
}

[data-theme="dark"] .client-info-label,
[data-theme="dark"] .chat-comment-timestamp {
  color: #94a3b8;
}

[data-theme="dark"] .client-info-value,
[data-theme="dark"] .chat-comment-body {
  color: #cbd5f5;
}

[data-theme="dark"] .btn-action-note {
  background: #0f172a;
  border-color: #1f2937;
  color: #e2e8f0;
}

[data-theme="dark"] .btn-action-note:hover {
  background: #111827;
  color: #ffffff;
}

[data-theme="dark"] .chat-comments-scroll-area {
  background-color: #0f172a;
  background-image: radial-gradient(#1f2937 1px, transparent 1px);
}

[data-theme="dark"] .chat-comment-item {
  background: #111827;
  border-color: #1f2937;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .chat-comment-item:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] .chat-comment-role-badge {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5f5;
}

[data-theme="dark"] .chat-comment-actions-bar {
  border-top-color: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .chat-composer-area {
  background: #0b1220;
  border-top-color: #1f2937;
}

.chat-composer-wrapper {
  position: relative;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  transition: all 0.2s;
}

.chat-composer-wrapper:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
  background: #ffffff;
}

[data-theme="dark"] .chat-composer-wrapper {
  background: #0f172a;
  border-color: #1f2937;
}

[data-theme="dark"] .chat-composer-wrapper:focus-within {
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
  background: #111827;
}

.chat-composer-input {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  min-height: 60px;
  outline: none;
  color: #1e293b;
}

[data-theme="dark"] .chat-composer-input {
  color: #e5e7eb;
}

.chat-composer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

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

.composer-status {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-btn-group {
  display: flex;
  gap: 8px;
}

/* Mentions dropdown */
.chat-mentions-dropdown {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
  animation: mentionPop 140ms ease-out;
}

.chat-mentions-list {
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .chat-mentions-dropdown {
  background: #0f172a;
  border-color: #1f2937;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

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

[data-theme="dark"] .chat-mention-item:hover,
[data-theme="dark"] .chat-mention-item.active {
  background: rgba(99, 102, 241, 0.18);
}

[data-theme="dark"] .chat-mention-label {
  color: #c7d2fe;
}

[data-theme="dark"] .chat-mention-hint {
  color: #94a3b8;
}

.chat-mention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  gap: 12px;
}

.chat-mention-item:hover,
.chat-mention-item.active {
  background: #eef2ff;
}

.chat-mention-label {
  font-weight: 700;
  color: #4f46e5;
}

.chat-mention-hint {
  font-size: 11px;
  color: #64748b;
}

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

/* Mention highlight in comments */
.mention-token {
  color: #6d28d9;
  background: rgba(109, 40, 217, 0.12);
  padding: 0 6px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(109, 40, 217, 0.15);
}

.mention-token-all {
  color: #b45309;
  background: rgba(245, 158, 11, 0.18);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
  animation: mentionPulse 1.6s ease-in-out infinite;
}

@keyframes mentionPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Side Toggle Button (Floating) */
.chat-notes-toggle {
    position: absolute;
    top: 15%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
  padding: 12px 10px 12px 6px;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
    font-size: 20px;
    display: flex;
    align-items: center;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.08);
    cursor: pointer;
    z-index: 5; 
    color: #94a3b8;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.5);
  border-left: none;
}

.chat-notes-toggle:hover {
  transform: translateY(-50%) translateX(4px);
    color: #475569;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.12);
  padding-left: 8px;
}

.chat-side-toggles .chat-notes-toggle:hover {
  transform: translateX(4px);
}

.chat-notes-toggle.has-notes {
    color: #f59e0b;
    background: #fffbeb;
    border-color: #fcd34d;
}

.chat-notes-toggle.has-notes::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 8px;
  width: 6px;
  height: 6px;
  background: #f59e0b;
  border-radius: 50%;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  #chatNotesModal .modal-dialog {
    max-width: 95vw;
    height: 90vh;
  }
}

@media (max-width: 768px) {
  #chatNotesModal .modal-body {
    flex-direction: column;
    overflow-y: auto;
  }
  
  .chat-notes-sidebar {
    width: 100%;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px;
  }
  
  .chat-comments-scroll-area {
    height: auto;
    flex: none;
    min-height: 300px;
  }
  
  .chat-notes-main {
    overflow: visible;
  }
}
