/* Social Media Assistant — agoodun.com
   Brand tokens, type stack and component shapes follow BRAND.md and the
   other agoodun.com apps, so this sits alongside them without redoing
   the look per app.

   Note this is the *app's* interface. The posts it generates are drawn
   on the user's own colours and typeface, which live in the database,
   not here. */

:root {
  --color-primary: #ce0f69;
  --color-secondary-teal: #009ca6;
  --color-secondary-purple: #68478d;
  --color-tertiary-gold: #ffb81c;
  --color-tertiary-black: #000000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Several classes below set `display`, which has equal specificity to
   the UA [hidden] rule and would silently win by source order — leaving
   "hidden" elements visible. Force it explicitly. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

a {
  color: inherit;
}

.muted {
  color: #6b7280;
}

/* ---------------------------------------------------------------------
   Shell and nav
   --------------------------------------------------------------------- */

.app-shell {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.nav-app-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

.nav-link.active {
  color: var(--color-primary);
  background: rgba(206, 15, 105, 0.08);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-email {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-logout:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */

.card {
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.card.accent {
  border-top: 6px solid transparent;
  border-image: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-secondary-teal),
    var(--color-secondary-purple),
    var(--color-tertiary-gold)
  );
  border-image-slice: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  margin-bottom: 24px;
}

.card-header .page-title {
  margin-bottom: 16px;
  flex: 1;
  min-width: 240px;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.5;
}

.setup-notice {
  border-left: 6px solid var(--color-tertiary-gold);
  padding: 20px 24px;
}

.setup-notice h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.setup-notice p {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #374151;
}

.setup-notice a {
  color: var(--color-primary);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */

.input-group {
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.field-hint {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 10px;
}

.field-count {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 6px;
}

.text-input,
.text-area,
.select-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.98rem;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-area {
  resize: vertical;
  line-height: 1.55;
}

.text-input:focus,
.text-area:focus,
.select-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.text-input.invalid {
  border-color: #dc2626;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-danger {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #b00d5a;
}

.btn-secondary {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-danger {
  background: #ffffff;
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: #fef2f2;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-text,
.btn-link {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
}

.btn-link {
  text-decoration: underline;
}

.btn-text:hover,
.btn-link:hover {
  color: #b00d5a;
}

.btn-icon {
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: #6b7280;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.btn-icon:hover:not(:disabled) {
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------
   Status lines
   --------------------------------------------------------------------- */

.status {
  font-size: 0.88rem;
  color: #6b7280;
  padding: 8px 0;
}

.status-line {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-secondary-teal);
}

.status-line.error,
.form-error {
  color: #b91c1c;
}

.form-error {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
}

.empty-state {
  padding: 28px 0;
  text-align: center;
}

.empty-state h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.9rem;
  color: #6b7280;
}

/* ---------------------------------------------------------------------
   Create page
   --------------------------------------------------------------------- */

.layout-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.layout-option {
  font-family: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.layout-option:hover {
  border-color: var(--color-primary);
}

.layout-option.selected {
  border-color: var(--color-primary);
  background: rgba(206, 15, 105, 0.06);
}

.layout-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.layout-desc {
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.45;
}

.generate-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.estimate {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.estimate-main {
  font-size: 0.92rem;
  font-weight: 600;
  color: #374151;
}

.estimate-detail {
  font-size: 0.78rem;
  color: #6b7280;
}

/* ---------------------------------------------------------------------
   Result
   --------------------------------------------------------------------- */

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

@media (max-width: 720px) {
  .result-layout {
    grid-template-columns: 1fr;
  }
}

.preview-frame {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #f4f5f7;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
}

/* The canvas is a real 1080×1080 buffer; this only scales how it's
   displayed, so the exported PNG is full resolution regardless. */
#previewCanvas {
  display: block;
  width: 100%;
  height: auto;
}

.result-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.result-block h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.result-body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #374151;
  white-space: pre-wrap;
}

.cost-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 0.88rem;
  color: #374151;
}

.cost-row strong {
  font-variant-numeric: tabular-nums;
}

.layout-swap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.layout-chip {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.layout-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.layout-chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* ---------------------------------------------------------------------
   Posts list
   --------------------------------------------------------------------- */

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #f9fafb;
}

.post-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.post-tagline {
  font-size: 0.94rem;
  font-weight: 600;
}

.post-meta {
  font-size: 0.78rem;
  color: #6b7280;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   Library
   --------------------------------------------------------------------- */

.drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--color-primary);
  background: rgba(206, 15, 105, 0.04);
}

.drop-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.drop-hint {
  font-size: 0.85rem;
  color: #6b7280;
}

.upload-progress {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-secondary-teal);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.image-tile {
  border-radius: 10px;
  overflow: hidden;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.image-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e5e7eb;
}

.image-tile figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
}

.tile-name {
  font-size: 0.76rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Brand
   --------------------------------------------------------------------- */

.color-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-swatch {
  width: 46px;
  height: 44px;
  flex-shrink: 0;
  padding: 2px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
}

.color-hex {
  max-width: 140px;
}

.color-role {
  font-size: 0.78rem;
  color: #6b7280;
  flex: 1;
}

.font-preview {
  margin-top: 12px;
  padding: 20px 16px;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 1.9rem;
  line-height: 1.2;
}

/* ---------------------------------------------------------------------
   Settings
   --------------------------------------------------------------------- */

.key-state {
  margin-bottom: 24px;
}

.key-present,
.key-absent {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 0.88rem;
  color: #374151;
}

.key-badge {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: var(--color-secondary-teal);
  border-radius: 999px;
  padding: 4px 10px;
}

.key-badge.muted {
  background: #9ca3af;
}

.key-mask {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.key-updated {
  font-size: 0.8rem;
  color: #6b7280;
}

.security-note {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #f0f1f3;
}

.security-note h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.security-note p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #6b7280;
}

.spend-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.spend-figure {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 10px;
  background: #f9fafb;
}

.spend-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.spend-value {
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}

.usage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #f9fafb;
}

.usage-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.usage-purpose {
  font-size: 0.9rem;
  font-weight: 600;
}

.usage-meta {
  font-size: 0.76rem;
  color: #6b7280;
}

.usage-cost {
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

/* ---------------------------------------------------------------------
   Auth landing
   --------------------------------------------------------------------- */

.auth-landing {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 40px;
  align-items: center;
}

@media (max-width: 820px) {
  .auth-landing {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.hero-copy h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 1rem;
  line-height: 1.55;
  color: #374151;
  margin-bottom: 20px;
}

.hero-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 20px;
}

.hero-features li {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #374151;
}

.auth-shell {
  margin: 0;
}

/* ---------------------------------------------------------------------
   Explainer
   --------------------------------------------------------------------- */

.explainer {
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.explainer summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  font-weight: 600;
  font-size: 0.95rem;
}

.explainer summary::-webkit-details-marker {
  display: none;
}

.explainer summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.explainer[open] summary::after {
  transform: rotate(-135deg);
}

.explainer[open] summary {
  border-bottom: 1px solid #f0f1f3;
}

.explainer-content {
  padding: 4px 24px 24px;
}

.explainer-content h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-top: 18px;
  margin-bottom: 6px;
}

.explainer-content h2:first-child {
  margin-top: 0;
}

.explainer-content p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: #374151;
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */

.powered-by a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #6b7280;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.powered-by a:hover {
  color: var(--color-tertiary-black);
}

.powered-by-logo {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.powered-by strong {
  color: var(--color-primary);
  font-weight: 700;
}
