/* BA Platform — styles for project management pages.
   Extends the base design tokens from styles.css.
   Imported by login, projects, project, brief, analysis, evidence, output, admin pages. */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700&family=Inter:wght@400;500&display=swap');

/* ── Offshorly brand tokens (light theme, overrides dark recorder theme) ── */
body.ba-page {
  --bg:          #F9F9FE;
  --surface:     #FFFFFF;
  --surface-2:   #F0F0FA;
  --fg:          #1C1C22;
  --muted:       #8D8D8D;
  --accent:      #7F67F6;
  --accent-hover:#6b52e8;
  --accent-green:#5DD9B3;
  --accent-blue: #4DA1FF;
  --success:     #5DD9B3;
  --warn:        #f59e0b;
  --danger:      #ef4444;
  --border:      #DFE1E5;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

body.ba-page h1,
body.ba-page h2,
body.ba-page h3,
body.ba-page .modal-title,
body.ba-page .card-title,
body.ba-page .page-header h1 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* ── Page layouts ────────────────────────────────────────────────────────── */
body.ba-page {
  overflow-y: auto;
  height: auto;
  min-height: 100vh;
}

.ba-page .app {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

/* ── Auth topbar additions ───────────────────────────────────────────────── */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar-user strong { color: var(--fg); }

/* ── Page content area ───────────────────────────────────────────────────── */
.page-content {
  padding: 28px 32px;
  max-width: 1100px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--fg);
}

/* ── Project grid ────────────────────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.project-card:hover { border-color: var(--accent); background: var(--surface-2); }

.project-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.project-card-client {
  font-size: 0.82rem;
  color: var(--muted);
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Stage pipeline tabs ─────────────────────────────────────────────────── */
.stage-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.stage-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-tab:hover { color: var(--fg); }

.stage-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.stage-tab .tab-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.72rem;
}

.stage-tab.active .tab-badge {
  background: rgba(79,124,255,0.15);
  border-color: rgba(79,124,255,0.35);
  color: var(--accent);
}

/* ── Stage panels ────────────────────────────────────────────────────────── */
.stage-panel { display: none; }
.stage-panel.active { display: block; }

/* ── Status badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-brief    { background: rgba(139,147,163,0.15); color: var(--muted); }
.badge-analysis { background: rgba(79,124,255,0.15);  color: var(--accent); }
.badge-evidence { background: rgba(245,158,11,0.15);  color: var(--warn); }
.badge-output   { background: rgba(54,211,153,0.15);  color: var(--success); }
.badge-go       { background: rgba(54,211,153,0.2);   color: var(--success); }
.badge-no-go    { background: rgba(255,79,94,0.2);    color: var(--danger); }
.badge-cond     { background: rgba(245,158,11,0.2);   color: var(--warn); }
.badge-pending  { background: rgba(139,147,163,0.15); color: var(--muted); }

/* ── Service line pill ───────────────────────────────────────────────────── */
.sl-pill {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: capitalize;
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-wrap {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Form elements ───────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-textarea { resize: vertical; min-height: 80px; }
.form-select   { appearance: none; cursor: pointer; }

.form-error {
  color: var(--danger);
  font-size: 0.8rem;
}

/* ── Analysis output cards ───────────────────────────────────────────────── */
.analysis-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.analysis-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.analysis-section-body {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--fg);
  white-space: pre-wrap;
}

.go-signal-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
}

.go-signal-banner.go        { background: rgba(54,211,153,0.12); border: 1px solid rgba(54,211,153,0.4);  color: var(--success); }
.go-signal-banner.no-go     { background: rgba(255,79,94,0.1);   border: 1px solid rgba(255,79,94,0.35); color: var(--danger);  }
.go-signal-banner.conditional { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.35); color: var(--warn); }

/* ── Evidence list ───────────────────────────────────────────────────────── */
.evidence-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.evidence-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.evidence-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  padding-top: 2px;
}

.evidence-body { flex: 1; min-width: 0; }

.evidence-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evidence-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.evidence-notes {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
}

.evidence-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Platform selector ───────────────────────────────────────────────────── */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.platform-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  background: var(--surface-2);
}

.platform-card:hover { border-color: var(--accent); }

.platform-card.selected {
  border-color: var(--accent);
  background: rgba(79,124,255,0.08);
}

.platform-icon { font-size: 2rem; margin-bottom: 8px; }
.platform-name { font-size: 0.88rem; font-weight: 600; color: var(--fg); }
.platform-desc { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* ── Output preview ─────────────────────────────────────────────────────── */
.output-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  font-size: 0.85rem;
  font-family: 'Menlo', 'Consolas', monospace;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
  color: var(--fg);
}

/* ── Analysis progress bar ───────────────────────────────────────────────── */
.analysis-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: rgba(79,124,255,0.06);
  border: 1px solid rgba(79,124,255,0.2);
  border-radius: var(--radius-md);
}

.analysis-progress-msg {
  font-size: 0.85rem;
  color: var(--accent);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
/* display:flex on .modal-overlay would override the [hidden] attribute,
   so we use :not([hidden]) to only flex when visible. */
.modal-overlay[hidden] { display: none !important; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  text-align: center;
}

.login-logo span { color: var(--accent); }

.login-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Large centred input for OTP code entry */
.otp-input {
  font-size: 2rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 14px;
}

/* ── User table ──────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state-icon { font-size: 2.4rem; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--fg); }
.empty-state-desc  { font-size: 0.85rem; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Section header ──────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 12px;
}

/* ── Action bar (bottom of a stage panel) ────────────────────────────────── */
.action-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ── Analysis version picker ─────────────────────────────────────────────── */
.version-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.version-row label {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Offshorly topbar logo ───────────────────────────────────────────────── */
.offshorly-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.offshorly-brand img {
  height: 22px;
  width: auto;
}
.offshorly-brand .brand-name {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.offshorly-brand .brand-product {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

/* ── Login card logo ─────────────────────────────────────────────────────── */
.login-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.login-logo-wrap img { height: 36px; width: auto; }
.login-logo-wrap .login-wordmark {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}

/* ── Super admin platform badge/button ───────────────────────────────────── */
.btn-platform {
  background: linear-gradient(135deg, #7F67F6 0%, #4DA1FF 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.15s;
}
.btn-platform:hover { opacity: 0.88; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 99999;
  max-width: 380px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  pointer-events: none;
}
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast-success { background: #5DD9B3; color: #1C1C22; }
.toast-error   { background: #ef4444; color: #fff; }
.toast-info    { background: #1C1C22; color: #fff; }
.toast-warn    { background: #f59e0b; color: #1C1C22; }

/* ── Confirm dialog (replaces browser confirm()) ─────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,28,34,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
}
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.confirm-box p {
  margin: 0 0 20px;
  font-size: 0.92rem;
  color: var(--fg);
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Org users modal ─────────────────────────────────────────────────────── */
.org-users-modal .data-table td { font-size: 0.84rem; }
