/* SPDX-License-Identifier: AGPL-3.0-or-later */
/* Copyright (C) 2024-2026 Philippe Naveau — contact@perfshop.io */
/* PerfShop — Test AI — https://perfshop.io */

/**
 * layout.css — Page structure (body, login, header, main grid).
 *
 * Cascade :
 *   1. tokens.css  → defines var(--*)
 *   2. layout.css  → THIS — structural rules
 *   3. components.css → atoms (buttons, panels, badges)
 *   4. inline-fix.css → utility classes for refactored inline styles
 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ── Login screen ────────────────────────────────────────────────── */

#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .4);
}

.login-logo {
  font-size: 40px;
  text-align: center;
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 4px;
}

.login-card p {
  text-align: center;
  color: var(--text2);
  margin: 0 0 22px;
  font-size: 13px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}

.field input:focus {
  border-color: var(--accent);
}

.login-error {
  background: rgba(255, 71, 87, .12);
  border: 1px solid rgba(255, 71, 87, .4);
  color: #ffb1ba;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── Main screen ─────────────────────────────────────────────────── */

#mainScreen {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  height: var(--ta-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

header p {
  font-size: 12px;
  color: var(--text2);
  margin: 2px 0 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ta-main-banner {
  padding: 8px 20px;
  background: rgba(102, 126, 234, .08);
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  font-size: 12px;
  flex-shrink: 0;
}

.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--ta-sidebar-w) 1fr;
  min-height: 0;
}

/* ── Sidebar (3 collapsible sections) ───────────────────────────── */

.ta-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ta-sidebar-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* The B2.c header is a <div> wrapping a disclosure <button> + per-
   section action buttons (HTML forbids nesting buttons). The detailed
   styling lives in components.css ; layout.css only sets the section
   container chrome. */
.ta-sidebar-icon { font-size: 14px; }
.ta-sidebar-title { flex: 1; }
.ta-sidebar-chevron {
  color: var(--text2);
  font-size: 11px;
  transition: transform .15s;
}

/* ── Central pane ───────────────────────────────────────────────── */

.ta-central {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.ta-central > .ta-central-empty,
.ta-central > .ta-editor {
  flex: 1;
  min-height: 0;
}

.ta-central-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text2);
  padding: 20px;
}

.ta-central-empty > * {
  max-width: 420px;
}

.ta-central-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: .6;
}

.ta-central-empty p {
  margin: 4px 0;
  font-size: 14px;
}

.ta-central-empty-hint {
  font-size: 12px;
  font-style: italic;
  margin-top: 8px;
  color: var(--text2);
}

/* ── Bottom prompt bar ──────────────────────────────────────────── */

.ta-prompt-bar {
  height: var(--ta-prompt-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.ta-prompt-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text2);
  font-weight: 600;
}

.ta-prompt-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.ta-prompt-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}

.ta-prompt-input:focus {
  border-color: var(--accent);
}

.ta-prompt-input:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.ta-prompt-hint {
  font-size: 11px;
  color: var(--text2);
  font-style: italic;
}
