/* ==============================
   SUSTAINE — APP STYLES
   ============================== */

/* ---- Layout ---- */
.app-main {
  padding: 40px 48px;
  max-width: 1400px;
  margin: 0 auto;
}

.app-header {
  margin-bottom: 40px;
}
.app-header h1 {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.app-header p {
  color: var(--fg-muted);
  font-size: 1.05rem;
}

.app-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 40px;
  align-items: start;
}

/* ---- Sidebar ---- */
.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.btn-primary {
  padding: 14px 20px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: 'DM Sans', system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover { background: #333; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  font-family: 'DM Sans', system-ui, sans-serif;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: #c00; }

/* ---- Recent Brands ---- */
.recent-brands {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.recent-brands h3 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

.brand-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: border-color 0.15s;
  gap: 12px;
}
.brand-item:hover { border-color: var(--accent); }
.brand-item-name { font-size: 0.9rem; font-weight: 500; color: var(--fg); }
.brand-item-status { font-size: 0.75rem; padding: 2px 8px; border-radius: 20px; font-weight: 500; }

.status-generating { background: #F5DFA0; color: #8B6914; }
.status-completed { background: #D4EDDA; color: #155724; }
.status-failed { background: #F8D7DA; color: #721c24; }

.empty-state { font-size: 0.85rem; color: var(--fg-faint); }

/* ---- Results ---- */
.app-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 400px;
  padding: 32px;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  text-align: center;
  color: var(--fg-faint);
  gap: 16px;
}

.result-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  text-align: center;
  gap: 16px;
  color: var(--fg-muted);
}
.result-loading small { color: var(--fg-faint); font-size: 0.85rem; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Brand Result ---- */
.brand-result-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.brand-result-header h2 {
  font-size: 2rem;
  margin: 0;
}
.tagline {
  font-size: 1.1rem;
  color: var(--fg-muted);
  font-style: italic;
  font-family: 'Playfair Display', serif;
}
.status-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  margin-left: auto;
}

.brand-section {
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}
.brand-section:last-of-type { border-bottom: none; }
.brand-section h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: var(--fg);
}
.brand-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin: 16px 0 8px;
}

/* Competitors */
.competitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.competitor-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.competitor-card strong { display: block; margin-bottom: 6px; }
.competitor-card p { font-size: 0.85rem; color: var(--fg-muted); margin-bottom: 6px; }
.competitor-card small { font-size: 0.78rem; color: var(--fg-faint); }

.gap-list { padding-left: 20px; }
.gap-list li { font-size: 0.9rem; margin-bottom: 6px; }

/* Colors */
.color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.color-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.1s;
}
.color-swatch:hover { transform: translateY(-2px); }
.swatch-color { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); flex-shrink: 0; }
.swatch-info { display: flex; flex-direction: column; }
.swatch-name { font-size: 0.82rem; font-weight: 600; }
.swatch-hex { font-size: 0.75rem; font-family: 'Space Mono', monospace; color: var(--fg-muted); }
.swatch-role { font-size: 0.72rem; color: var(--fg-faint); }

.typography-info { display: flex; flex-direction: column; gap: 8px; }
.typography-info p { font-size: 0.9rem; }

/* Voice */
.do-donts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 12px;
}
.do-column h4 { color: #155724; }
.dont-column h4 { color: #721c24; }
.do-donts ul { padding-left: 18px; }
.do-donts li { font-size: 0.9rem; margin-bottom: 5px; }

/* Messaging */
.highlight-box {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 1rem;
  line-height: 1.5;
}

.message-block { margin-bottom: 20px; }
.objection-handlers { display: flex; flex-direction: column; gap: 12px; }
.objection-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}
.objection-card strong { font-size: 0.85rem; color: var(--fg-muted); }
.objection-card blockquote {
  margin: 8px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  font-size: 0.9rem;
  color: var(--fg);
}

/* Raw JSON */
.raw-json { margin-top: 28px; }
.raw-json summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-family: 'DM Sans', sans-serif;
}
.raw-json pre {
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 0.78rem;
  overflow-x: auto;
  font-family: 'Space Mono', monospace;
}

/* ---- Dashboard ---- */
.dashboard-main {
  padding: 40px 48px;
  max-width: 1100px;
  margin: 0 auto;
}
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.dashboard-header h1 { font-size: 2rem; }

.brand-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.brand-table th {
  background: var(--bg-alt);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}
.brand-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.brand-table tr:last-child td { border-bottom: none; }
.brand-table tr:hover td { background: var(--bg); }

.empty-dashboard {
  text-align: center;
  padding: 60px;
  color: var(--fg-muted);
}

@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .do-donts { grid-template-columns: 1fr; }
}