﻿/*
 * Base app shell, columns, panel layout, shared inputs/forms.
 * Extracted from public/styles.css lines 549-982.
 */

/* =========================
   LAYOUT
========================= */

#container {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

#container.hidden { display: none; }

/* =========================
   CHAT COLUMN
========================= */

#chat-col {
  width: 420px;
  min-width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#resizer {
  width: 6px;
  cursor: col-resize;
  background: #1f2937;
  flex-shrink: 0;
  transition: background 0.15s;
}

#resizer:hover,
#resizer.active {
  background: #3b82f6;
}

#right {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #1f2937;
  overflow: hidden;
}

/* =========================
   CHAT (LEFT)
========================= */

#chat-header {
  display: none;
}

#chat-headerbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #1f2937;
  background: #0c0e12;
  flex-shrink: 0;
}

#chat-headerbar #profile {
  flex: 1;
  min-width: 0;
  padding: 5px 7px;
  background: #161a22;
  color: #e2e8f0;
  border: 1px solid #2a2f3a;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 0;
}

#chat-headerbar #profile:focus {
  outline: none;
  border-color: #3b82f6;
}

.workspace-switcher {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 3px;
  gap: 2px;
  border: 1px solid rgba(231, 199, 143, 0.18);
  border-radius: 999px;
  background: rgba(18, 15, 12, 0.48);
}

.workspace-switcher button {
  min-height: 30px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #b8aa98;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.workspace-switcher button:hover {
  color: #fff7eb;
  background: rgba(67, 57, 47, 0.66);
}

.workspace-switcher button.active {
  color: #1b130c;
  background: #dfb86d;
}

#chat, #mai-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

#chat::before, #mai-chat::before {
  content: '';
  flex: 1;
}

.chat-empty {
  margin: auto;
  color: #9f927f;
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
  max-width: 260px;
  padding: 18px;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.chat-empty strong {
  color: #eadcc8;
  font-size: 16px;
}

.provider-setup-region {
  flex-shrink: 0;
  width: 100%;
  padding: 0 12px;
  box-sizing: border-box;
}

.provider-setup-region:empty {
  display: none;
}

.chat-access-notice,
.mai-access-notice {
  width: min(520px, calc(100% - 8px));
  margin: 0 auto 8px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  border: 1px solid rgba(211, 177, 128, 0.18);
  border-radius: 14px;
  background: rgba(34, 29, 24, 0.72);
  color: #b9aa96;
  font-size: 13px;
  line-height: 1.45;
}

.chat-access-notice strong,
.mai-access-notice strong {
  color: #eadcc8;
  font-size: 14px;
}

.chat-access-notice button,
.mai-access-notice button,
.chat-empty button,
.mai-empty button {
  margin-top: 6px;
  min-height: 36px;
  border: 1px solid rgba(211, 177, 128, 0.24);
  border-radius: 999px;
  background: rgba(231, 199, 143, 0.14);
  color: #e7c78f;
  cursor: pointer;
  font-weight: 700;
  padding: 0 14px;
}

.chat-loading-state {
  margin: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #b9aa96;
  font-size: 14px;
  line-height: 1.4;
  padding: 18px;
  animation: chat-loading-fade 0.16s ease-out;
}

.chat-loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d4ac6f;
  box-shadow: 0 0 12px rgba(212, 172, 111, 0.55);
  animation: chat-loading-pulse 1.1s ease-in-out infinite;
}

@keyframes chat-loading-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes chat-loading-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1); }
}

.chat-history-hint {
  text-align: center;
  font-size: 11px;
  color: #4b5563;
  padding: 6px 0 10px;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ctrl-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

/* =========================
   INPUT AREA
========================= */

#input-area {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 12px 12px;
  border-top: 1px solid #1f2937;
}

#input-area .chat-composer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-language-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
}

.chat-runtime-pill {
  display: inline-flex;
  align-items: center;
  position: relative;
  min-width: 0;
  min-height: 30px;
  border: 1px solid rgba(231, 199, 143, 0.18);
  border-radius: 999px;
  background: rgba(43, 36, 29, 0.64);
  color: #f1ddc2;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.chat-runtime-pill:hover,
.chat-runtime-pill:focus-within {
  border-color: rgba(231, 199, 143, 0.34);
  background: rgba(54, 45, 36, 0.78);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.chat-runtime-pill::after {
  content: "⌄";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-54%);
  color: rgba(231, 199, 143, 0.78);
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}

.chat-runtime-icon {
  flex: 0 0 auto;
  padding-left: 9px;
  font-size: 12px;
  opacity: 0.82;
}

.chat-language-row select {
  width: auto;
  min-width: 0;
  max-width: 176px;
  field-sizing: content;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: #f1ddc2;
  border: 0;
  border-radius: 0;
  padding: 6px 23px 6px 5px;
  font-size: 12px;
  font-weight: 650;
  outline: none;
  cursor: pointer;
}

.chat-language-row select option {
  background: #211c18;
  color: #f4e7d3;
}

.chat-language-row select:disabled {
  opacity: 0.7;
}

#model {
  max-width: 170px;
}

body.ai-studio-mode .chat-language-row {
  display: none;
}

#input-area textarea#message {
  width: 100%;
  height: 72px;
  min-height: 72px;
  background: #1a1d23;
  color: #eee;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
  resize: none;
  padding: 8px 10px;
  font-size: 14px;
  box-sizing: border-box;
  line-height: 1.4;
  font-family: inherit;
}

#input-area textarea#message:focus {
  outline: none;
  border-color: #3b82f6;
}

.message-char-status {
  display: flex;
  justify-content: flex-end;
  min-height: 16px;
  color: #8f8274;
  font-size: 11px;
  line-height: 1.25;
}

.message-char-status.is-warning {
  color: #d4a95f;
}

.message-char-status.is-over {
  color: #fca5a5;
  font-weight: 700;
}

#send-btn {
  height: 72px;
  width: 60px;
  background: #1e3a5f;
  color: #93c5fd;
  border: 1px solid #1e3a5f;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  margin-top: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#send-btn:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

#send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* =========================
   RIGHT PANEL
========================= */

.user-bar-admin {
  font-size: 11px;
  padding: 3px 8px;
  background: #161c2a;
  color: #8ab4f8;
  border: 1px solid #2d3a5a;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
  margin-top: 0;
}

.user-bar-admin:hover {
  background: #1e2a42;
  color: #93c5fd;
  border-color: #3b5a9a;
}

#panelContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* =========================
   SECTION (panel pages)
========================= */

.section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  min-height: 0;
  max-width: 100%;
}

/* sections that scroll their own content */
.section.scrollable {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.section h2 {
  flex-shrink: 0;
  margin-bottom: 10px;
}

/* =========================
   INPUTS / BUTTONS
========================= */

select, button {
  margin-top: 5px;
  background: #2a2f38;
  color: #eee;
  border: none;
  padding: 6px;
  cursor: pointer;
}

button {
  padding: 8px 12px;
  border-radius: 6px;
}

button:hover {
  background: #3a404c;
}

button.primary {
  background: #2b6cb0;
}

button.primary:hover {
  background: #3b7dd8;
}

/* =========================
   FORM HELPERS
========================= */

.row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.form-group input,
.form-group textarea,
.row input,
.row select {
  flex: 1;
  padding: 8px;
  background: #1a1d23;
  border: 1px solid #444;
  color: #eee;
  border-radius: 6px;
}

/* panel textareas: taller default, user-resizable */
.form-group textarea {
  flex: none;           /* override flex:1 from combined rule â€” lets resize drag work */
  width: 100%;
  box-sizing: border-box;
  min-height: 200px;
  max-height: 60vh;
  resize: vertical;
}

#panelButtons {
  padding: 10px;
  border-bottom: 1px solid #333;
}

