@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Root tokens ─────────────────────────────────────────────────────────── */
.aigp-widget {
  --c-bg:        #faf8f5;
  --c-surface:   #ffffff;
  --c-border:    #e8e2d9;
  --c-ink:       #1a1714;
  --c-muted:     #7a7269;
  --c-accent:    #c8622a;
  --c-accent-lt: #f5ede6;
  --c-success:   #2d6a4f;
  --c-error:     #b5192b;

  --r:    6px;
  --r-lg: 12px;
  --shadow: 0 2px 12px rgba(26,23,20,.08);

  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-ink);
  background: var(--c-bg);
  border-radius: var(--r-lg);
  padding: 0;
  max-width: 760px;
  margin: 2rem auto;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Header bar ─────────────────────────────────────────────────────────── */
.aigp-header {
  background: var(--c-ink);
  color: #fff;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.aigp-header-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.aigp-header-text h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 2px;
  letter-spacing: .01em;
}
.aigp-header-text p {
  margin: 0;
  font-size: .8rem;
  opacity: .6;
  font-weight: 300;
}

/* ── Step progress bar ───────────────────────────────────────────────────── */
.aigp-progress {
  display: flex;
  background: #f0ebe4;
  padding: .75rem 2rem;
  gap: .5rem;
  border-bottom: 1px solid var(--c-border);
}
.aigp-step-pip {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 500;
  color: var(--c-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.aigp-step-pip.active  { color: var(--c-accent); }
.aigp-step-pip.done    { color: var(--c-success); }
.aigp-step-pip .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.aigp-step-pip .sep {
  width: 24px; height: 1px;
  background: var(--c-border);
  margin: 0 .2rem;
}

/* ── Body / card ─────────────────────────────────────────────────────────── */
.aigp-body {
  padding: 2rem;
  background: var(--c-surface);
  min-height: 300px;
}

/* ── Section heading ─────────────────────────────────────────────────────── */
.aigp-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 .3rem;
  color: var(--c-ink);
}
.aigp-section-sub {
  color: var(--c-muted);
  font-size: .85rem;
  margin: 0 0 1.75rem;
}

/* ── Application cards ───────────────────────────────────────────────────── */
.aigp-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .875rem;
  margin-bottom: 2rem;
}
.aigp-app-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--r);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  background: var(--c-surface);
  position: relative;
  user-select: none;
}
.aigp-app-card:hover {
  border-color: var(--c-accent);
  box-shadow: 0 4px 16px rgba(200,98,42,.1);
  transform: translateY(-2px);
}
.aigp-app-card.selected {
  border-color: var(--c-accent);
  background: var(--c-accent-lt);
}
.aigp-app-card.selected::after {
  content: '✓';
  position: absolute;
  top: .6rem; right: .75rem;
  font-size: .8rem;
  color: var(--c-accent);
  font-weight: 700;
}
.aigp-app-card-name {
  font-weight: 500;
  font-size: .9rem;
  margin-bottom: .25rem;
}
.aigp-app-card-desc {
  font-size: .78rem;
  color: var(--c-muted);
  line-height: 1.4;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.aigp-field {
  margin-bottom: 1.25rem;
}
.aigp-field label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--c-muted);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .4rem;
}
.aigp-field input[type="text"],
.aigp-field select,
.aigp-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: .6rem .85rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: .9rem;
  color: var(--c-ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.aigp-field input:focus,
.aigp-field select:focus,
.aigp-field textarea:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(200,98,42,.12);
}
.aigp-field textarea {
  resize: vertical;
  min-height: 90px;
}
.aigp-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7269' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  padding-right: 2.2rem;
}

/* ── Two-column context grid ─────────────────────────────────────────────── */
.aigp-context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}
@media (max-width: 520px) {
  .aigp-context-grid { grid-template-columns: 1fr; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.aigp-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.75rem;
  gap: .75rem;
  flex-wrap: wrap;
}
.aigp-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  padding: .6rem 1.4rem;
  border-radius: var(--r);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .15s, color .15s, transform .12s, box-shadow .15s;
  letter-spacing: .02em;
  line-height: 1;
}
.aigp-btn:active { transform: scale(.97); }
.aigp-btn-primary {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.aigp-btn-primary:hover {
  background: #b05522;
  box-shadow: 0 4px 12px rgba(200,98,42,.3);
}
.aigp-btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.aigp-btn-ghost {
  background: transparent;
  color: var(--c-muted);
  border-color: var(--c-border);
}
.aigp-btn-ghost:hover { border-color: var(--c-muted); color: var(--c-ink); }

/* ── Loading state ───────────────────────────────────────────────────────── */
.aigp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 1.25rem;
  color: var(--c-muted);
}
.aigp-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: aigp-spin .7s linear infinite;
}
@keyframes aigp-spin { to { transform: rotate(360deg); } }
.aigp-loading-label {
  font-size: .85rem;
  font-weight: 400;
}

/* ── Error banner ────────────────────────────────────────────────────────── */
.aigp-error {
  background: #fff0f1;
  border: 1px solid #f5c6cb;
  color: var(--c-error);
  border-radius: var(--r);
  padding: .85rem 1rem;
  font-size: .85rem;
  margin-bottom: 1rem;
}

/* ── Results ─────────────────────────────────────────────────────────────── */
.aigp-results {}
.aigp-result-section {
  border-bottom: 1px solid var(--c-border);
  padding: 1.5rem 0;
}
.aigp-result-section:first-child { padding-top: 0; }
.aigp-result-section:last-child  { border-bottom: none; padding-bottom: 0; }
.aigp-result-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 .75rem;
  color: var(--c-ink);
}
.aigp-result-section .aigp-md {
  font-size: .9rem;
  line-height: 1.7;
  color: #333;
}
.aigp-md p  { margin: 0 0 .75em; }
.aigp-md ul { padding-left: 1.4em; margin: 0 0 .75em; }
.aigp-md li { margin-bottom: .25em; }
.aigp-md strong { font-weight: 600; color: var(--c-ink); }
.aigp-md h3 { font-family:'Playfair Display',serif; margin:.75em 0 .4em; }
.aigp-restart {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--c-border);
  text-align: center;
}

/* ── Fade-in animation ───────────────────────────────────────────────────── */
.aigp-fade {
  animation: aigp-fade-in .3s ease;
}
@keyframes aigp-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
