/* CSS Document */

/* =========================
   1) Design tokens
========================= */
@font-face {
  font-family: 'Futurabook';
  src: url('../fonts/futura_book-webfont.eot');
  src:
    url('../fonts/futura_book-webfont.eot?#iefix') format('embedded-opentype'),
    url('../fonts/futura_book-webfont.woff') format('woff'),
    url('../fonts/futura_book-webfont.ttf') format('truetype'),
    url('../fonts/futura_book-webfont.svg#FuturaBook') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --body-font: 'Open Sans', sans-serif;
  --header-font: 'Futurabook';

  --bg: #f9fafb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;

  --blue-dark: #00274f;
  --blue-light: #0183c4;
  --blue-dimmed: #657296;

  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-400: #fbbf24;
  --amber-700: #b45309;
  --amber-800: #92400e;
  --amber-900: #78350f;

  --emerald-600: #339900;
  --emerald-700: #047857;

  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.06);

  --radius-xl: 14px;
  --radius-sm: 8px;

  --container: 960px;
}

/* =========================
   2) Base / reset
========================= */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--body-font);
  background: var(--bg);
  color: var(--text);
  padding: 16px;
}

@media (min-width: 768px) {
  body { padding: 32px; }
}

.hidden { display: none !important; }

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================
   3) App shell
========================= */
#app {
  max-width: var(--container);
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.app-header {
  background: var(--blue-dark);
  color: #fff;
  padding: 24px;
}

.app-title {
  margin: 0 0 4px 0;
  font-size: 28px;
font-weight: normal;
  font-family: var(--header-font);
}

.app-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: bold;
  color: var(--blue-dimmed);
}

.app-main { padding: 24px; }

@media (min-width: 768px) {
  .app-main { padding: 32px; }
}

/* =========================
   4) Icons
========================= */
.hero-icon,
.model-card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.hero-icon { color: var(--amber-700); }
.model-card-icon { color: var(--blue-light); }

.hero-icon svg,
.model-card-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.detail-icon {
  color: #fff;
  background: var(--blue-light);
  padding: 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.detail-icon svg {
  width: 32px;
  height: 32px;
  display: block;
}

.coach-bolt {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.coach-bolt svg {
  width: 100%;
  height: 100%;
  display: block;
}

.back-icon,
.copy-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

/* Global stroke defaults */
.hero-icon svg,
.model-card-icon svg,
.detail-icon svg,
.coach-bolt svg,
.back-icon,
.copy-icon {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* =========================
   5) List view / hero
========================= */
.hero-card {
  width: 100%;
  border: 0;
  text-align: left;

  display: flex;
  align-items: center;
  gap: 16px;

  background: var(--amber-100);
  border-left: 4px solid var(--amber-400);
  padding: 20px;

  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;

  transition: background 160ms ease;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.hero-card:hover { background: var(--amber-200); }
.hero-card:focus-visible { outline: 3px solid rgba(1,131,196,0.35); outline-offset: 2px; }

.hero-title {
  margin: 0 0 2px 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--amber-900);
}

.hero-desc {
  margin: 0;
  font-size: 14px;
  color: var(--amber-800);
}

.section-label {
  margin: 0 0 14px 0;
  font-size: 14px;
  font-weight: bold;
  color: var(--blue-dimmed);
  text-transform: uppercase;
}

/* =========================
   6) Model cards (flex)
========================= */
.models-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.model-card {
  width: 100%;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 160ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@media (min-width: 640px) {
  .model-card { width: calc(50% - 9px); }
}

@media (min-width: 840px) {
  .model-card { width: calc(33.3% - 11px); }
}

.model-card:hover { border-color: var(--blue-dimmed); }
.model-card:focus-visible { outline: 3px solid rgba(1,131,196,0.35); outline-offset: 2px; }

.model-card-icon { margin-bottom: 16px; }

.model-card-title {
  color: var(--blue-dark);
  font-family: var(--header-font);
  font-size: 18px;
  line-height: 1.2;
}

/* =========================
   7) Detail header + back
========================= */
.back-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--blue-dimmed);
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0 0 22px 0;
  transition: color 160ms ease;
}

.back-btn:hover { color: var(--blue-dark); }
.back-btn:focus-visible { outline: 3px solid rgba(1,131,196,0.35); outline-offset: 2px; }

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.detail-title {
  margin: 0;
  font-size: 26px;
  font-weight: normal;
  color: var(--blue-dark);
  font-family: var(--header-font);
}

/* =========================
   8) Model content
========================= */
.model-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 26px;
}

.content-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-xl);
}

.content-card-heading {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--blue-dimmed);
}

.content-card-points {
  margin: 0;
  padding-left: 18px;
}

/* =========================
   9) Coach section
========================= */
.coach { padding-top: 26px; }

.coach-title {
  margin: 0 0 14px 0;
  font-size: 20px;
  color: var(--blue-dark);
  font-family: var(--header-font);
  display: flex;
  align-items: center;
  gap: 10px;
}

.coach-input {
  width: 100%;
  resize: vertical;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  transition: box-shadow 160ms ease, border-color 160ms ease;
  margin-bottom: 18px;
  font-family: var(--body-font);
}

.coach-input:focus {
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(1,131,196,0.22);
}

.coach-blocks {
  display: flex;
  flex-direction: column;
  gap: 42px;
}

.coach-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =========================
   10) Buttons
========================= */
.btn {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  transition: filter 120ms ease, transform 120ms ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--blue-light);
  color: #fff;
}

.btn-primary:hover { filter: brightness(0.92); }

.btn-success {
  background: var(--emerald-600);
  color: #fff;
}

.btn-success:hover { filter: brightness(0.95); }

.btn:focus-visible { outline: 3px solid rgba(1,131,196,0.35); outline-offset: 2px; }

/* Validation */
.field-error {
  margin-top: -10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 14px;
  line-height: 1.4;
}

.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.18) !important;
}

/* =========================
   11) Loading bar (spinner removed)
========================= */
.loading-bar {
  height: 4px;
  width: 100%;
  background-color: var(--border);
  overflow: hidden;
  border-radius: 2px;
  margin-top: 8px;
}

.loading-bar-inner {
  height: 100%;
  width: 30%;
  background-color: var(--blue-light);
  animation: loading 1.5s infinite ease-in-out;
}

.loading-bar-inner-success { background-color: var(--emerald-600); }

@keyframes loading {
  0% { margin-left: -30%; }
  100% { margin-left: 100%; }
}

/* =========================
   12) Output + copy button
========================= */
.output-wrap { position: relative; }

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  color: #4b5563;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  z-index: 10;
}

.copy-btn:hover {
  background: #ffffff;
  border-color: var(--border);
}

.copy-btn:focus-visible { outline: 3px solid rgba(1,131,196,0.35); outline-offset: 2px; }

.output {
  padding: 28px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.error-box {
  padding: 16px;
  border-radius: var(--radius-xl);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Toast (copy feedback) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(17,24,39,0.92);
  color: #ffffff;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1;
  box-shadow: var(--shadow-md);
  z-index: 9999;
}

/* Disabled buttons */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* =========================
   13) Prose (markdown output)
========================= */
.prose h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--blue-dark);
}

.prose p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
  color: #374151;
}

.prose ul {
  list-style-type: disc;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose strong {
  font-weight: 700;
  color: #111827;
}

.context-field-wrap {
  position: relative;
}

.context-field-wrap textarea {
  padding-right: 46px;
  resize: none;
}

.context-clear-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  color: #444;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
  z-index: 2;
  padding: 0;
}

.context-clear-btn.hidden {
  display: none;
}

.context-clear-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.context-clear-btn:hover,
.context-clear-btn:focus-visible {
  background: rgba(0, 0, 0, 0.12);
  color: #111;
  outline: none;
}