/* ===========================
   AI Resource Hub — Base Styles
   Light, clean, minimal design system
   =========================== */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f2f8f4;
  --color-border: #d7e5da;
  --color-text: #1c231e;
  --color-text-muted: #59665c;
  --color-accent: #1a8a44;
  --color-accent-hover: #146536;
  --color-accent-soft: #e2f4e8;
  --color-success: #15803d;
  --color-gold: #fdd10a;
  --color-gold-hover: #e2ba00;
  --color-red: #ce1126;
  --color-red-soft: #fbe2e4;
  --color-header-bg: rgba(255, 255, 255, 0.92);
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --max-width: 1120px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark theme palette — applied when <html data-theme="dark"> */
[data-theme="dark"] {
  --color-bg: #0f1410;
  --color-bg-alt: #171d18;
  --color-border: #2a3a2e;
  --color-text: #e9ede9;
  --color-text-muted: #9db3a3;
  --color-accent: #3ddc73;
  --color-accent-hover: #64e592;
  --color-accent-soft: #17301f;
  --color-success: #3ddc73;
  --color-gold: #ffd400;
  --color-gold-hover: #ffe14d;
  --color-red: #ff5b6a;
  --color-red-soft: #3a1a1e;
  --color-header-bg: rgba(15, 20, 16, 0.88);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .info-banner {
  border-color: #26402c;
}

[data-theme="dark"] .lightbox-overlay {
  background: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"] img:not(.upload-preview):not(.gallery-item img):not(.lightbox-content img) {
  opacity: 0.92;
}

html {
  transition: background-color 0.15s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  border-top: 4px solid;
  border-image: linear-gradient(90deg, var(--color-red) 0 33%, var(--color-gold) 33% 66%, var(--color-accent) 66% 100%) 1;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1320px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-brand .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-gold);
  color: #14210f;
  font-weight: 800;
  font-size: 0.95rem;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.nav-links a {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--color-text);
}

.nav-cta {
  background: var(--color-gold);
  color: #14210f !important;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-cta:hover {
  background: var(--color-gold-hover);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 24px 16px;
    display: none;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links li {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
  }
  .nav-links li:last-child {
    border-bottom: none;
  }
  .nav-cta {
    display: inline-block;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: 80px 0 64px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  background: var(--color-gold);
  color: #14210f;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}

.hero p.lead {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

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

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ---------- Sections ---------- */

section {
  padding: 56px 0;
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}

.section-header h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.section-header p {
  color: var(--color-text-muted);
  margin: 0;
}

.alt-bg {
  background: var(--color-bg-alt);
}

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

.grid {
  display: grid;
  gap: 20px;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 860px) {
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 14px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card p {
  color: var(--color-text-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Resource Directory ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 40px;
}

.filter-btn {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.filter-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.resource-category {
  margin-bottom: 48px;
}

.resource-category h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.resource-category .category-desc {
  color: var(--color-text-muted);
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.resource-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.resource-card .tag {
  display: inline-block;
  align-self: flex-start;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.resource-card h3 {
  margin: 0 0 6px;
}

.resource-card p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin: 0 0 14px;
  flex-grow: 1;
}

.resource-card a.visit-link {
  font-weight: 600;
  font-size: 0.88rem;
}

/* ---------- Prompt Generator ---------- */

.tool-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.tool-tab {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.tool-tab.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.generator-panel {
  display: none;
}

.generator-panel.active {
  display: block;
}

.generator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

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

.form-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--color-text);
  background: var(--color-bg);
}

.field textarea {
  resize: vertical;
  min-height: 70px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.output-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: sticky;
  top: 88px;
}

.output-card h3 {
  margin-top: 0;
}

#promptOutput {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
}

.output-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.copy-feedback {
  display: none;
  color: var(--color-success);
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 10px;
}

.copy-feedback.show {
  display: block;
}

/* ---------- AI enhance (Prompt Generator) ---------- */

.ai-enhance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.ai-enhance-status {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: none;
}

.ai-enhance-status.show {
  display: inline;
}

.ai-enhance-status.success {
  color: var(--color-success);
  font-weight: 600;
}

.ai-enhance-status.error {
  color: var(--color-red);
}

.ai-enhance-auth-note {
  margin: 14px 0 0;
  padding: 10px 14px;
  font-size: 0.82rem;
}

#textPromptOutput.ai-enhanced,
#imagePromptOutput.ai-enhanced,
#videoPromptOutput.ai-enhanced {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* The three output boxes auto-grow to fit their content via JS (see
   autoGrowOutput() in prompt-generator.js). max-height caps that growth so
   a long result doesn't turn the box into a tall, skinny column that looks
   out of proportion with the rest of the card — past the cap it scrolls
   internally instead (overflow-y: auto), same as it always could by hand
   via the resize handle.
   width is set explicitly here because these textareas live directly
   inside .output-card rather than inside a .field wrapper, so they never
   picked up the width: 100% every other input/textarea on this page gets —
   without this they fall back to the browser's default ~20-column
   intrinsic width, which is why the box was rendering much narrower than
   the info banner above it. box-sizing: border-box keeps the padding from
   pushing it past the card's edge now that width is explicit. */
#textPromptOutput,
#imagePromptOutput,
#videoPromptOutput {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.88rem;
  min-height: 220px;
  max-height: 420px;
  line-height: 1.55;
  overflow-y: auto;
}

@media (max-width: 640px) {
  #textPromptOutput,
  #imagePromptOutput,
  #videoPromptOutput {
    min-height: 180px;
    max-height: 340px;
  }
}

/* ---------- Ad Slots ---------- */

.ad-slot {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.ad-slot .ad-placeholder {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  background: var(--color-bg-alt);
}

/* ---------- Forms (Contact) ---------- */

.contact-form {
  max-width: 560px;
  margin: 0 auto;
}

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

.site-footer {
  border-top: 4px solid;
  border-image: linear-gradient(90deg, var(--color-accent) 0 33%, var(--color-gold) 33% 66%, var(--color-red) 66% 100%) 1;
  padding: 40px 0 28px;
  margin-top: 40px;
  background: var(--color-bg-alt);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ---------- Misc pages ---------- */

.page-header {
  padding: 56px 0 24px;
  text-align: center;
}

.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 12px;
}

.page-header p {
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.prose {
  max-width: 760px;
  margin: 0 auto;
}

.prose h2 {
  margin-top: 36px;
}

.prose p,
.prose li {
  color: var(--color-text-muted);
}

.info-banner {
  background: var(--color-accent-soft);
  border: 1px solid #bfe3cb;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.9rem;
  color: var(--color-accent-hover);
  margin-bottom: 28px;
}

/* ---------- Model note (Prompt Generator) ---------- */

.model-note {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

/* ---------- Gallery ---------- */

.gallery-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.gallery-search {
  flex: 1;
  min-width: 220px;
}

.gallery-search input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.gallery-search input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.gallery-sort select {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg);
  cursor: pointer;
}

.gallery-sort select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.gallery-toolbar #openUploadBtn {
  flex-shrink: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

@media (max-width: 960px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

.gallery-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.gallery-item-body {
  padding: 12px 14px;
}

.gallery-item-body h4 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-item-body p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-item-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.gallery-item-footer .gallery-tags {
  max-height: 3.4em;
  overflow: hidden;
}

.gallery-item-footer .card-like-btn {
  margin-top: 1px;
}

.gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.gallery-tags .tag {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---------- Likes ---------- */

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.like-btn .like-heart {
  font-size: 1rem;
  line-height: 1;
}

.like-btn.liked,
.like-btn.liked .like-heart {
  color: var(--color-red);
}

.card-like-btn {
  border: 1px solid transparent;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.card-like-btn:hover {
  color: var(--color-red);
}

.card-like-btn.liked {
  background: var(--color-red-soft);
}

#lightboxLikeBtn.liked {
  border-color: var(--color-red);
}

.gallery-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

.upload-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  max-width: 560px;
  margin: 0 auto 48px;
}

.upload-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin-top: 10px;
  display: none;
  background: var(--color-bg-alt);
}

.upload-preview.show {
  display: block;
}

.form-status {
  font-size: 0.85rem;
  margin-top: 12px;
  display: none;
}

.form-status.show {
  display: block;
}

.form-status.success {
  color: var(--color-success);
}

.form-status.error {
  color: var(--color-red);
}

/* Lightbox modal */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 21, 26, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-content {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.lightbox-content img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  background: var(--color-bg-alt);
}

.lightbox-body {
  padding: 22px;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
}

/* Gallery setup banner is hidden until JS determines Supabase isn't configured */
#setupBanner {
  display: none;
}
#setupBanner.show {
  display: block;
}

/* ---------- Nav auth slot ---------- */

.nav-auth-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-auth-email {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.nav-auth-signout {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-auth-signout:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

@media (max-width: 760px) {
  .nav-auth-slot {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
  }
}

/* ---------- Auth page ---------- */

.auth-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 9px 0;
  border-radius: 8px;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.auth-tab.active {
  background: var(--color-accent);
  color: #fff;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

.auth-logged-in {
  text-align: center;
}

.auth-logged-in p {
  color: var(--color-text-muted);
}

.auth-divider {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 24px 0 18px;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 90px);
  border-top: 1px solid var(--color-border);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.access-request-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---------- Gallery: video + visibility additions ---------- */

video.upload-preview {
  width: 100%;
}

#authRequiredBanner {
  display: none;
}
#authRequiredBanner.show {
  display: block;
}

.visibility-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.visibility-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 0.88rem;
  color: var(--color-text);
  cursor: pointer;
}

.visibility-option input {
  accent-color: var(--color-accent);
}

/* Portrait "reel" style thumbnail: a fixed 9:16 box that always shows the
   ENTIRE photo/video (object-fit: contain) instead of cropping a slice out
   of it. Landscape uploads letterbox with bars above/below inside the same
   portrait frame rather than being cropped into a thin sliver; portrait
   uploads fill it edge-to-edge. */
.gallery-item video,
.gallery-item img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: var(--color-bg-alt);
  display: block;
}

.gallery-item .tag.private {
  background: var(--color-red-soft);
  color: var(--color-red);
}

.gallery-media-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.gallery-item {
  position: relative;
}

/* Floating native-resolution video preview shown on card hover — sized to
   the video's actual aspect ratio (no cropping), unlike the grid thumbnail. */
.gallery-hover-preview {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  background: #000;
  line-height: 0;
}

.gallery-hover-preview video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(90vw, 420px);
  max-height: min(80vh, 420px);
}

#lightboxVideo {
  display: none;
  width: 100%;
  max-height: 380px;
  background: #000;
}

/* Auth page setup banner is hidden until JS determines Supabase isn't configured */
#authSetupBanner {
  display: none;
}
#authSetupBanner.show {
  display: block;
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
  color: var(--color-text-muted);
}

.theme-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

@media (max-width: 760px) {
  .nav-links li:has(.theme-toggle) {
    border-bottom: none;
    padding: 10px 0 0;
  }
}

/* ---------- Prompt Generator: Basic / Advanced mode ---------- */

.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.mode-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.mode-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.advanced-field {
  display: none;
}

.mode-advanced .advanced-field {
  display: block;
}

/* ---------- Admin panel ---------- */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px;
}

.admin-tab {
  flex: 1;
  min-width: 120px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.admin-tab.active {
  background: var(--color-accent);
  color: #fff;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.admin-inline-form input[type="email"],
.admin-inline-form input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
}

.admin-inline-form select {
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--color-bg);
}

.admin-row-main {
  flex: 1;
  min-width: 0;
}

.admin-row-meta {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.admin-row-note {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  word-break: break-word;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-empty {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.admin-stat-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--color-bg-alt);
}

.admin-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
}

.admin-stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.admin-stat-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--color-text);
}

.admin-stat-list li {
  padding: 2px 0;
}

@media (max-width: 640px) {
  .admin-row {
    flex-direction: column;
  }
}

/* ---------- Comments & remixes ---------- */

.lightbox-comments {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.comments-heading {
  margin: 0 0 14px;
  font-size: 1rem;
}

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

.comments-empty {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin: 0 0 18px;
}

.comment-row {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 40px 12px 14px;
  background: var(--color-bg-alt);
  position: relative;
}

.comment-meta {
  margin-bottom: 4px;
}

.comment-author {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-accent);
}

.comment-body {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--color-text);
  white-space: pre-wrap;
}

.comment-remix {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
}

.comment-remix img,
.comment-remix video {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 999px;
  background: var(--color-bg-alt);
}

.comment-remix:hover {
  border-color: var(--color-accent);
}

.comment-remix-hidden {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text-muted);
  font-weight: 400;
  cursor: default;
}

.comment-delete {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.74rem;
  cursor: pointer;
  text-decoration: underline;
}

.comment-delete:hover {
  color: var(--color-red);
}

.comment-composer textarea#commentBody {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
  resize: vertical;
  min-height: 60px;
  margin-bottom: 10px;
  display: block;
}

.comment-composer textarea#commentBody:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

#toggleRemixBtn {
  display: inline-block;
  margin-bottom: 12px;
}

.remix-subform {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: var(--color-bg-alt);
}

#postCommentBtn {
  margin-right: 8px;
}

/* Remix badge shown on grid cards for posts that riff on another post */
.remix-of {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 4px;
  cursor: pointer;
}

.remix-of:hover {
  text-decoration: underline;
}

.remix-of-hidden {
  color: var(--color-text-muted);
  cursor: default;
}

/* ---------- Cover thumbnail picker (upload / remix / edit) ---------- */

.cover-picker {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--color-bg-alt);
}

.cover-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.cover-mode-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.cover-mode-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.cover-frame-mode input[type="range"] {
  width: 100%;
  accent-color: var(--color-accent);
}

.cover-frame-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.cover-photo-mode input[type="file"] {
  width: 100%;
}

#editCoverResetBtn {
  margin-top: 12px;
}

.remix-of-hidden:hover {
  text-decoration: none;
}

/* ============================================================
   Gallery reports + workflow attachment + admin moderation
   ============================================================ */

.required-mark { color: #e5484d; font-weight: 700; }

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted, #8a8a8a);
}
.btn-ghost:hover {
  color: var(--color-text, #111);
  border-color: var(--color-border, #ddd);
}

/* Push the Report button to the right edge of the lightbox action row */
.lightbox-report-btn { margin-left: auto; }

/* The report + admin-email modals sit above the lightbox (z-index 100) */
#reportModalOverlay,
#emailModalOverlay { z-index: 400; }
.report-modal { max-width: 540px; }

/* Admin: reported-posts list */
.admin-flag-row { align-items: flex-start; gap: 12px; }
.admin-flag-thumb {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  flex: 0 0 auto; background: var(--color-bg-alt, #ececec);
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-flag-thumb-video { color: var(--color-text-muted, #8a8a8a); font-size: 1.4rem; }
.admin-flag-actions { flex-wrap: wrap; gap: 6px; }
.admin-note { color: #b26a00; }
[data-theme="dark"] .admin-note { color: #e0a54a; }
