/* ==========================================================================
   TERMOVA COLLABORATIVE WORKSPACE & TEAM CHAT CSS
   ========================================================================== */

.workspace-view-container {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  height: calc(100vh - var(--header-height, 65px));
  width: 100%;
  overflow: hidden;
  background: var(--bg-surface-dark, #0b0f19);
  color: var(--text-primary, #f1f5f9);
}

/* ──── Left Sidebar: Rooms & Channels ──── */
.ws-sidebar {
  border-right: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  background: var(--bg-card, rgba(17, 24, 39, 0.7));
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.ws-sidebar-header {
  padding: 1.25rem 1rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.ws-header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.ws-header-title-row h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ws-create-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.ws-create-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.ws-search-box {
  position: relative;
  width: 100%;
}

.ws-search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: 6px;
  padding: 0.4rem 0.75rem 0.4rem 2rem;
  color: #fff;
  font-size: 0.85rem;
}

.ws-search-box input:focus {
  outline: none;
  border-color: #6366f1;
}

.ws-search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.ws-rooms-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ws-room-card {
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.ws-room-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.ws-room-card.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: inset 3px 0 0 #6366f1;
}

.ws-room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.ws-room-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.ws-room-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.4rem;
}

.ws-room-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: #64748b;
}

.ws-meta-pill {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ──── Center: Chat Feed ──── */
.ws-main-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: radial-gradient(circle at 50% 0%, rgba(30, 41, 59, 0.4) 0%, rgba(11, 15, 25, 1) 100%);
  overflow: hidden;
}

.ws-chat-header {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(8px);
}

.ws-active-title-group h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ws-active-title-group p {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.ws-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ws-members-avatar-stack {
  display: flex;
  align-items: center;
  margin-right: 0.5rem;
}

.ws-avatar-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0b0f19;
  margin-left: -8px;
}

.ws-avatar-pill:first-child {
  margin-left: 0;
}

.ws-avatar-more {
  background: #475569;
}

.ws-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}

.ws-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ──── Feed List ──── */
.ws-messages-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ws-msg-row {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
  animation: fadeIn 0.2s ease-out;
}

.ws-msg-row.human-msg {
  align-self: flex-start;
}

.ws-msg-row.ai-msg {
  align-self: flex-start;
  max-width: 90%;
}

.ws-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.ws-msg-avatar.human {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
}

.ws-msg-avatar.ai {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}

.ws-msg-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ws-msg-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.ws-msg-author {
  font-weight: 600;
  color: #f1f5f9;
}

.ws-msg-time {
  color: #64748b;
}

.ws-ai-badge {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.ws-msg-bubble {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #e2e8f0;
  position: relative;
}

.ws-msg-row.human-msg .ws-msg-bubble {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ws-msg-row.ai-msg .ws-msg-bubble {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Citations & Evidence Inside Message */
.ws-citation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ws-citation-chip {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  border-radius: 5px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s;
}

.ws-citation-chip:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #60a5fa;
  color: #fff;
}

/* Reaction & Pin Bar */
.ws-msg-footer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.ws-reaction-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s;
}

.ws-reaction-pill.reacted {
  background: rgba(99, 102, 241, 0.25);
  border-color: #6366f1;
  color: #fff;
}

.ws-btn-icon-action {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ws-btn-icon-action:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
}

.ws-btn-icon-action.pinned {
  color: #f59e0b;
}

/* ──── Input Area ──── */
.ws-input-area {
  padding: 1rem 1.5rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(8px);
}

.ws-input-mode-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.ws-mode-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ws-mode-pill.active.ai-mode {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.3));
  border-color: #8b5cf6;
  color: #e0e7ff;
}

.ws-mode-pill.active.team-mode {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #93c5fd;
}

.ws-input-box {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  padding: 0.4rem 0.5rem 0.4rem 0.75rem;
  transition: border-color 0.2s;
}

.ws-input-box:focus-within {
  border-color: #6366f1;
}

.ws-input-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  resize: none;
  height: 42px;
  max-height: 120px;
  line-height: 1.4;
  font-family: inherit;
}

.ws-input-box textarea:focus {
  outline: none;
}

.ws-send-btn {
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.ws-send-btn:hover {
  background: #4f46e5;
  transform: scale(1.03);
}

.ws-typing-indicator {
  font-size: 0.75rem;
  color: #94a3b8;
  height: 16px;
  margin-top: 0.3rem;
  font-style: italic;
}

/* ──── Right Sidebar: Pinned Findings & Scope ──── */
.ws-pinned-sidebar {
  border-left: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  background: var(--bg-card, rgba(17, 24, 39, 0.7));
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.ws-pinned-header {
  padding: 1.25rem 1rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.ws-pinned-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ws-pinned-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ws-pinned-card {
  background: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.85rem;
}

.ws-pinned-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #f59e0b;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.ws-pinned-snippet {
  color: #e2e8f0;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ws-pinned-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.4rem;
}

.ws-scoped-docs-section {
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  padding: 0.85rem;
  max-height: 220px;
  overflow-y: auto;
}

.ws-scoped-docs-section h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin: 0 0 0.5rem 0;
}

.ws-scoped-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

/* ──── Modals ──── */
.ws-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-modal-box {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.ws-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.ws-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.ws-form-group {
  margin-bottom: 1rem;
}

.ws-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

.ws-form-group input,
.ws-form-group select,
.ws-form-group textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #fff;
  font-size: 0.9rem;
}

.ws-doc-checklist {
  max-height: 160px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ws-doc-check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #cbd5e1;
  cursor: pointer;
}

.ws-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

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

/* ──── Mobile & Tablet Responsiveness for Workspace ──── */
@media screen and (max-width: 1024px) {
  .workspace-view-container {
    grid-template-columns: 240px 1fr;
    height: 100%;
  }

  .ws-right-panel {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .workspace-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  .ws-sidebar {
    height: auto;
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
  }

  .ws-rooms-list {
    max-height: 120px;
    overflow-y: auto;
  }

  .ws-main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  .ws-chat-header {
    padding: 8px 12px;
  }

  #ws-active-title {
    font-size: 1rem;
  }

  #ws-active-desc {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }

  .ws-messages-feed {
    padding: 10px;
    flex: 1;
  }

  .ws-input-area {
    padding: 8px 10px;
  }

  .ws-modal-box {
    width: 95vw;
    padding: 1rem;
  }
}

@media screen and (max-width: 480px) {
  .ws-sidebar-header {
    padding: 8px 10px;
  }

  .ws-input-mode-toggle {
    flex-wrap: wrap;
    gap: 4px;
  }

  .ws-mode-pill {
    font-size: 0.72rem;
    padding: 4px 8px;
  }
}
