/* Floating toggle button - hidden since it's now in header */
.yaze-console-toggle {
  display: none;
}

.yaze-console-container {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: 380px; /* Slightly wider */
  max-width: 90vw;
  z-index: 1990;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  display: none;
  pointer-events: auto;
  box-shadow: -4px 0 24px rgba(0,0,0,0.5);
  display: flex; /* Prepare for toggle */
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.yaze-console-container.active {
  transform: translateX(0);
}

/* --- Chat Pane (Top) --- */
.yaze-chat-pane {
  flex: 1 1 auto; /* Takes available space */
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  min-height: 0; /* Allow shrinking */
}

.yaze-chat-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
}

.yaze-field {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--control-radius);
  padding: 4px 8px;
  height: 32px;
}

.yaze-field .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-muted);
}

.yaze-field input {
  width: 100%;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ui);
}

.yaze-field input:focus {
  outline: none;
}

.yaze-chat-header select {
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--control-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  height: 32px;
  font-family: var(--font-ui);
}

.yaze-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  width: 100%;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--control-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
}

.yaze-icon-btn .material-symbols-outlined {
  font-size: 16px;
}

.yaze-icon-btn.primary {
  background: var(--accent-primary);
  border: none;
  color: #000;
}

.yaze-icon-btn.subtle {
  background: var(--bg-panel);
}

.yaze-icon-btn:hover {
  filter: brightness(1.05);
}

/* Full width elements in grid */
#yaze-server-url { grid-column: 1 / -1; }
#yaze-session-code, #yaze-session-name { grid-column: 1 / -1; }
#yaze-username, #yaze-password { grid-column: span 1; }
#yaze-mode { grid-column: span 2; }
#yaze-connect, #yaze-disconnect { grid-column: span 1; }
#yaze-status { grid-column: 1 / -1; text-align: center; margin-top: 4px; }
#yaze-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
#yaze-status .status-icon { font-size: 16px; }

.yaze-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-app);
}

.yaze-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 90%;
}

.yaze-msg.chat {
  align-self: flex-start;
}

.yaze-msg .meta {
  font-size: 11px;
  color: var(--text-accent);
  font-weight: 600;
  margin-left: 2px;
}

.yaze-msg .text {
  background: var(--bg-input);
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border-color);
}

.yaze-msg.system {
  align-self: center;
  max-width: 100%;
  width: 100%;
  text-align: center;
  opacity: 0.7;
  margin: 8px 0;
}

.yaze-msg.system .text {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}

.yaze-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-header);
  flex-shrink: 0;
}

.yaze-chat-input textarea {
  flex: 1;
  height: 38px;
  min-height: 38px;
  max-height: 100px;
  resize: none;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 19px; /* Pill shape */
  padding: 8px 16px;
  font-size: 13px;
  font-family: var(--font-ui);
  line-height: 20px;
}

.yaze-chat-input textarea:focus {
  border-color: var(--border-focus);
  outline: none;
}

.yaze-chat-input button {
  width: 42px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #000; /* Contrast for button */
  border: none;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px; /* For icon if used, or text */
}

.yaze-chat-input button:hover {
  background: var(--accent-hover);
}

/* --- Console Pane (Bottom) --- */
.yaze-console-pane {
  flex: 0 0 200px; /* Fixed height for log */
  background: var(--bg-panel);
  border-top: 4px solid var(--bg-header); /* Visual separator */
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 11px;
}

.yaze-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}

.yaze-console-header .title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.yaze-console-header .title .material-symbols-outlined {
  font-size: 16px;
}

.yaze-console-header .controls button {
  margin-left: 8px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-ui);
}

.yaze-console-header .controls button:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.yaze-console-body {
  padding: 8px 12px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1 1 auto;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Badge Status */
.yaze-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-secondary);
}

.yaze-badge.locked { color: var(--status-warning); }
.yaze-badge.unlocked { color: var(--status-success); }

@media (max-width: 900px) {
  .yaze-console-container {
    width: 100%;
    max-width: 100%;
    border-left: none;
    top: auto;
    bottom: 0;
    height: 80vh;
    transform: translateY(100%);
  }
  
  .yaze-console-container.active {
    transform: translateY(0);
  }
}

/* Docking logic */
body.yaze-console-open {
  margin-right: 380px;
  transition: margin-right 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 900px) {
  body.yaze-console-open {
    margin-right: 0;
  }
}
