/* =========================================================================
 * TBK v6.0 — Smart Docked Workspace (Google Meet / MS Teams / Zoom Layout),
 * Persistent Right-Side Received/Shared Files Panel, HTML5 Rich Chat + Emoji Picker,
 * and 3-Step Smart Transfer Studio (1 File / Multi-File / Recursive Folder Tree)
 * High-Contrast Executive Light Edition
 * ========================================================================= */

/* 1. SPLIT WORKSPACE: Left Video Grid (Auto-Adapting) + Right Fixed Dock */
.tbk6-call-split-stage {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.65rem;
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
  width: 100%;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.tbk6-left-video-column {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: flex 0.25s cubic-bezier(0.22, 1, 0.36, 1), width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.tbk6-right-fixed-dock {
  width: 390px;
  min-width: 340px;
  max-width: 410px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  flex-shrink: 0;
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, transform 0.24s ease;
}

.tbk6-right-fixed-dock.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  margin: 0 !important;
}

/* Header & Tabs inside the Fixed Right Sidebar (Chat | Archivos Recibidos | Vista Combinada | Participantes) */
.tbk6-dock-top-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.28rem;
  padding: 0.48rem 0.55rem;
  background: #f8fafc;
  border-bottom: 1.5px solid #cbd5e1;
}

.tbk6-dock-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  padding: 0.42rem 0.35rem;
  border-radius: 9px;
  border: 1.5px solid #94a3b8;
  background: #eef2f6;
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
  position: relative;
  white-space: nowrap;
}

.tbk6-dock-tab-btn:hover {
  color: #ffffff;
  background: #0071e3;
  border-color: #005bb5;
}

.tbk6-dock-tab-btn.active {
  background: #0071e3;
  color: #ffffff;
  border-color: #005bb5;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
}

.tbk6-dock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #047857;
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 900;
}

.tbk6-dock-badge.pulse-new {
  background: #d97706;
  color: #ffffff;
  animation: tbk6BadgePulse 1.3s infinite;
}

@keyframes tbk6BadgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7); }
  50% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
}

/* Split Mode inside Right Dock: Upper = Persistent Received/Shared Files, Lower = HTML5 Rich Chat */
.tbk6-dock-pane {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tbk6-dock-pane.active {
  display: flex;
}

/* Persistent Received & Sent Files Section on the Right Side */
.tbk6-received-files-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1.5px solid #cbd5e1;
  max-height: 44%;
  overflow-y: auto;
}

.tbk6-received-files-panel.full-height {
  max-height: 100%;
  flex: 1;
}

.tbk6-received-file-card {
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #10b981;
  border-radius: 11px;
  padding: 0.58rem 0.68rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.tbk6-received-file-card.incoming-highlight {
  border-color: #0284c7;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.18);
}

.tbk6-file-actions-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* 2. HTML5 RICH-TEXT CHAT + URL LINKIFIER + METADATA PREVIEW + EMOJI PICKER */
.tbk6-rich-chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  padding: 0.38rem 0.65rem;
  background: #f8fafc;
  border-top: 1.5px solid #cbd5e1;
}

.tbk6-format-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 26px;
  padding: 0 0.38rem;
  border-radius: 6px;
  border: 1.5px solid #94a3b8;
  background: #eef2f6;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tbk6-format-btn:hover,
.tbk6-format-btn.active {
  background: #0071e3;
  color: #ffffff;
  border-color: #005bb5;
}

.tbk6-rich-chat-editor {
  min-height: 40px;
  max-height: 115px;
  overflow-y: auto;
  flex: 1;
  background: #ffffff;
  border: 1.5px solid #94a3b8;
  border-radius: 10px;
  padding: 0.5rem 0.72rem;
  color: #0f172a;
  font-size: 0.85rem;
  line-height: 1.42;
  outline: none;
  word-break: break-word;
}

.tbk6-rich-chat-editor:empty::before {
  content: attr(data-placeholder);
  color: #64748b;
  pointer-events: none;
}

.tbk6-rich-chat-editor:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16);
}

/* Rendered HTML5 Rich Content inside Chat Bubbles */
.sacbe-chat-rich-body a {
  color: #0284c7;
  font-weight: 700;
  text-decoration: underline;
  word-break: break-all;
}

.sacbe-chat-rich-body code,
.sacbe-chat-rich-body pre {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.76rem;
  background: #eef2f6;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 0.12rem 0.35rem;
}

.tbk6-url-preview-card {
  margin-top: 0.38rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0f172a;
  border-left: 3px solid #0284c7;
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
  font-size: 0.74rem;
}

/* Emoji Picker Popover */
.tbk6-emoji-picker-popover {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem;
  background: #ffffff;
  color: #0f172a;
  border-top: 1.5px solid #cbd5e1;
  border-bottom: 1.5px solid #cbd5e1;
  max-height: 195px;
  overflow-y: auto;
}

.tbk6-emoji-picker-popover.open {
  display: flex;
}

.tbk6-emoji-category-bar {
  display: flex;
  gap: 0.28rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.32rem;
}

.tbk6-emoji-cat-btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
  border-radius: 6px;
  border: 1.5px solid #94a3b8;
  background: #eef2f6;
  color: #0f172a;
  cursor: pointer;
  font-weight: 700;
}

.tbk6-emoji-cat-btn.active {
  background: #0071e3;
  color: #ffffff;
  border-color: #005bb5;
}

.tbk6-emoji-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.22rem;
}

.tbk6-emoji-item {
  height: 30px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 1.12rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}

.tbk6-emoji-item:hover {
  background: #e0f2fe;
  transform: scale(1.18);
}

/* 3. FOLDER & SUBFOLDER VISUAL TREE STAGING */
.tbk6-folder-tree-box {
  background: #f8fafc;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.55rem 0.68rem;
  max-height: 170px;
  overflow-y: auto;
  font-size: 0.75rem;
}

.tbk6-tree-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.24rem 0.35rem;
  border-radius: 6px;
  color: #0369a1;
  font-weight: 700;
}

.tbk6-tree-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.18rem 0.35rem 0.18rem 1.25rem;
  color: #334155;
  font-size: 0.72rem;
}

@media (max-width: 960px) {
  .tbk6-call-split-stage {
    flex-direction: column;
  }
  .tbk6-right-fixed-dock {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: 54dvh;
  }
}
