/* ==========================================================================
   TRI-PANE GRID ARCHITECTURE: Files/tripane.css
   PURPOSE: Grid layout with inverted structural frames (White in Dark, Black in Light).
   Strictly under 200 lines in compliance with project rules.
   ========================================================================== */

.tripane-container {
  display: grid;
  grid-template-columns: var(--col-left, 320px) 8px minmax(160px, 1fr) 8px var(--col-right, 320px);
  width: 100vw;
  height: 100vh;
  padding: 8px;
  gap: 0;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  user-select: none;
  overflow: hidden;
}

/* Left & Right Symmetric Column Stacks */
.left-col-stack,
.right-col-stack {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
  overflow: hidden;
}

/* Top Floating Boxes with Inverted Frames */
.left-top-box,
.right-top-box {
  height: 48px;
  border-radius: 18px;
  background: var(--surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1.5px solid var(--frame-border);
  box-shadow: var(--island-shadow);
  display: flex;
  align-items: center;
  padding: 0 10px;
  flex-shrink: 0;
}

.right-top-box {
  justify-content: space-between;
  gap: 8px;
}

.settings-box-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 12px;
}
.settings-box-btn:hover { background: var(--surface-alt); }
.head-gear-icon { font-size: 24px; color: var(--text-main); }

/* Floating Glass Islands with Inverted Structural Frames */
.pane-island {
  height: 100%;
  border-radius: 22px;
  background: var(--surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1.5px solid var(--frame-border);
  box-shadow: var(--island-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.pane-left { flex: 1; padding: 14px; }
.pane-center { padding: 14px 12px 12px 14px; overflow: hidden; }
.pane-right { flex: 1; padding: 16px; }

.diary-mount-container {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Text Selection Permissions */
#diary-stream,
#review-chat-stream,
.chat-bubble-user,
.chat-bubble-bot,
.chat-bubble-user > div,
.chat-bubble-bot > div {
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text;
}

.chat-bubble-bot button,
.chat-bubble-bot .icon-btn,
.chat-bubble-user button {
  user-select: none !important;
  cursor: pointer !important;
}

#review-chat-stream .chat-bubble-user { align-self: flex-end; }
#review-chat-stream .chat-bubble-bot { align-self: flex-start; }

/* Structural Chat Bubbles */
.chat-bubble-user {
  background: var(--bubble-user-bg);
  border: 1.5px solid var(--bubble-user-border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  padding: 12px 18px;
  border-radius: 20px 20px 4px 20px;
  max-width: 82%;
  font-family: var(--font-family-chat, var(--font-sans));
  font-size: var(--font-size-chat, 15.5px);
  line-height: var(--line-height-chat, 1.6);
  color: var(--bubble-user-text);
  word-break: break-word;
}

.chat-bubble-bot {
  background: var(--bubble-bot-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--bubble-bot-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  padding: 15px 20px;
  border-radius: 20px 20px 20px 4px;
  max-width: 88%;
  font-family: var(--font-family-chat, var(--font-sans));
  font-size: var(--font-size-chat, 15.5px);
  line-height: var(--line-height-chat, 1.6);
  color: var(--text-main);
  word-break: break-word;
}

/* Chat Input Dock */
.chat-dock {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: flex-end;
  padding: 6px 4px 2px 2px;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
}

.chat-input-textarea {
  flex: 1;
  min-height: 42px;
  max-height: 130px;
  border-radius: 14px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border-light);
  color: var(--text-main);
  padding: 10px 14px;
  font-family: var(--font-family-chat, var(--font-sans));
  font-size: var(--font-size-chat, 15px);
  outline: none;
  resize: none;
  line-height: 1.45;
  box-sizing: border-box;
  overflow-y: hidden;
  scrollbar-width: none;
  user-select: text !important;
}
.chat-input-textarea:focus { border-color: var(--border-focus); }

.btn-circle.is-recording {
  background: var(--danger) !important;
  color: #FFFFFF !important;
  animation: pulseGlowRing 1.5s infinite !important;
}

/* Splitters with Responsive Color Pins */
.drag-splitter {
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
.drag-splitter::before {
  content: "";
  width: 3px;
  height: 48px;
  border-radius: 3px;
  background: var(--splitter-pin);
  transition: all 0.25s var(--ease);
}
.drag-splitter:hover::before,
.drag-splitter.dragging::before {
  background: var(--splitter-active);
  height: 120px;
}
.drag-splitter.dragging { background: rgba(0, 0, 0, 0.05); border-radius: 4px; }

/* Sub-Headers & Scroll Area */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}
.pane-title-group { display: flex; align-items: center; gap: 8px; }
.pane-icon { font-size: 19px; color: var(--text-main); }
.pane-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-dim); text-transform: uppercase; }

.pane-scroll-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}