/* Potluck — Shared Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --cream: #FDF6EC;
  --warm-white: #FFFDF9;
  --terracotta: #C75B39;
  --terracotta-light: #E8825F;
  --terracotta-dark: #A84A2D;
  --deep-brown: #2C1810;
  --warm-gray: #6B5B50;
  --sage: #7A8B6F;
  --sage-light: #A3B496;
  --golden: #D4A853;
  --peach: #F5D5C0;
  --error: #D14444;
  --error-bg: #FFF0F0;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--warm-white);
  color: var(--deep-brown);
  min-height: 100vh;
}

/* ── Layout ────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--cream);
  border-bottom: 1px solid rgba(44, 24, 16, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  /* fallback text style if image not loaded */
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--deep-brown);
}

/* ── Logo image ──────────────────────── */

.logo-img {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

.auth-logo-link {
  display: block;
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.auth-logo-img {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}

.app-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-header nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--warm-gray);
  text-decoration: none;
  transition: color 0.2s;
}

.app-header nav a:hover {
  color: var(--terracotta);
}

/* ── Nav messages badge ───────────────── */

.nav-messages-link {
  position: relative;
}

.nav-unread-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #D14444;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  line-height: 1;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

/* ── Buttons ───────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--terracotta);
  color: white;
}

.btn-primary:hover {
  background: var(--terracotta-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--terracotta);
  border: 1.5px solid var(--terracotta);
}

.btn-secondary:hover {
  background: rgba(199, 91, 57, 0.06);
}

.btn-ghost {
  background: transparent;
  color: var(--warm-gray);
  padding: 0.5rem 1rem;
}

.btn-ghost:hover {
  color: var(--terracotta);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
}

/* ── Forms ─────────────────────────────── */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--deep-brown);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(44, 24, 16, 0.15);
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--deep-brown);
  background: white;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(199, 91, 57, 0.1);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(107, 91, 80, 0.5);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--warm-gray);
  margin-top: 0.35rem;
}

/* ── Auth pages ────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  padding: 2rem;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(44, 24, 16, 0.08);
}

.auth-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.auth-card .subtitle {
  color: var(--warm-gray);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.auth-card .divider {
  text-align: center;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--warm-gray);
}

.auth-card .footer-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--warm-gray);
}

.auth-card .footer-link a {
  color: var(--terracotta);
  text-decoration: none;
  font-weight: 600;
}

.auth-card .footer-link a:hover {
  text-decoration: underline;
}

/* ── Alert ─────────────────────────────── */

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: none;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(209, 68, 68, 0.2);
}

.alert-success {
  background: #F0FFF4;
  color: #2D6A4F;
  border: 1px solid rgba(45, 106, 79, 0.2);
}

/* ── Feed ──────────────────────────────── */

.feed-header {
  text-align: center;
  padding: 3rem 2rem 1rem;
}

.feed-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 0.5rem;
}

.feed-header p {
  color: var(--warm-gray);
  font-size: 1.05rem;
}

.feed-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 2rem 2rem;
}

.post-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 12px rgba(44, 24, 16, 0.06);
  border: 1px solid rgba(44, 24, 16, 0.06);
  transition: box-shadow 0.2s;
}

.post-card:hover {
  box-shadow: 0 4px 20px rgba(44, 24, 16, 0.1);
}

.post-card-image {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
  background: var(--cream);
}

.post-card-image-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  font-size: 3rem;
}

.post-card-body {
  padding: 1.5rem;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.post-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--terracotta);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
}

.post-card-author {
  font-weight: 600;
  font-size: 0.9rem;
}

.post-card-author-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--deep-brown);
  text-decoration: none;
  transition: color 0.2s;
}

.post-card-author-link:hover {
  color: var(--terracotta);
}

.post-card-avatar-link {
  text-decoration: none;
  transition: transform 0.2s;
  display: inline-flex;
}

.post-card-avatar-link:hover {
  transform: scale(1.08);
}

.post-card-avatar-link:hover .post-card-avatar {
  box-shadow: 0 2px 8px rgba(199, 91, 57, 0.3);
}

.post-card-date {
  font-size: 0.8rem;
  color: var(--warm-gray);
}

.post-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-card-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border-radius: 2rem;
  margin-bottom: 0.75rem;
}

.tag-family-recipe { background: rgba(199, 91, 57, 0.1); color: var(--terracotta); }
.tag-cultural-story { background: rgba(122, 139, 111, 0.15); color: var(--sage); }
.tag-weeknight-dinner { background: rgba(212, 168, 83, 0.15); color: #9A7B2E; }
.tag-comfort-food { background: rgba(245, 213, 192, 0.5); color: var(--terracotta-dark); }
.tag-holiday-tradition { background: rgba(122, 139, 111, 0.1); color: var(--sage); }
.tag-first-attempt { background: rgba(212, 168, 83, 0.1); color: #9A7B2E; }
.tag-default { background: rgba(44, 24, 16, 0.06); color: var(--warm-gray); }

.post-card-recipe {
  font-size: 0.95rem;
  color: var(--warm-gray);
  line-height: 1.7;
  white-space: pre-wrap;
}

.post-card-recipe-preview {
  max-height: 4.5em;
  overflow: hidden;
  position: relative;
}

.post-card-recipe-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2em;
  background: linear-gradient(transparent, white);
}

.post-card-readmore {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--terracotta);
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.post-card-readmore:hover {
  text-decoration: underline;
}

/* ── New Post ──────────────────────────── */

.new-post-page {
  padding-top: 2rem;
}

.new-post-page h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.new-post-page .subtitle {
  color: var(--warm-gray);
  margin-bottom: 2rem;
}

.photo-upload {
  width: 100%;
  height: 240px;
  border: 2px dashed rgba(44, 24, 16, 0.15);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(253, 246, 236, 0.5);
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.photo-upload:hover {
  border-color: var(--terracotta);
  background: rgba(253, 246, 236, 0.8);
}

.photo-upload .icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.photo-upload .text {
  font-size: 0.9rem;
  color: var(--warm-gray);
  font-weight: 500;
}

.photo-upload .hint {
  font-size: 0.8rem;
  color: rgba(107, 91, 80, 0.5);
  margin-top: 0.25rem;
}

.photo-upload img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-upload.has-photo {
  border-style: solid;
  border-color: var(--sage);
}

.story-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.story-tags label {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1.5px solid rgba(44, 24, 16, 0.12);
  border-radius: 2rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--warm-gray);
}

.story-tags label:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
}

.story-tags input[type="radio"] {
  display: none;
}

.story-tags input[type="radio"]:checked + label {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: white;
}

/* ── Empty state ───────────────────────── */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--warm-gray);
  margin-bottom: 1.5rem;
}

/* ── Loading ───────────────────────────── */

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--warm-gray);
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(44, 24, 16, 0.1);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Footer ────────────────────────────── */

.app-footer {
  padding: 3rem 2rem;
  background: var(--deep-brown);
  color: rgba(253, 246, 236, 0.4);
  text-align: center;
  font-size: 0.85rem;
  margin-top: 4rem;
}

.app-footer .brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

/* ── Comments ──────────────────────────── */

.post-card-footer {
  padding: 0 1.5rem 1rem;
  border-top: 1px solid rgba(44, 24, 16, 0.06);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
}

.post-card-comment-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--warm-gray);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.post-card-comment-toggle:hover {
  color: var(--terracotta);
}

.comments-section {
  margin-top: 1rem;
  display: none;
}

.comments-section.open {
  display: block;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.comment-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--terracotta);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
  overflow: hidden;
}

.comment-bubble {
  flex: 1;
  background: var(--cream);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
}

.comment-bubble-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

.comment-author-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--deep-brown);
  text-decoration: none;
}

.comment-author-link:hover {
  color: var(--terracotta);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--warm-gray);
}

.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(107, 91, 80, 0.4);
  font-size: 0.8rem;
  padding: 0 0 0 0.25rem;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

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

.comment-content {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--deep-brown);
}

.comment-input-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.comment-input-row textarea {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid rgba(44, 24, 16, 0.15);
  border-radius: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.88rem;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  overflow-y: auto;
  color: var(--deep-brown);
  background: white;
  transition: border-color 0.2s;
}

.comment-input-row textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(199, 91, 57, 0.1);
}

.comment-input-row textarea::placeholder {
  color: rgba(107, 91, 80, 0.5);
}

.comment-post-btn {
  padding: 0.55rem 1rem;
  background: var(--terracotta);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.comment-post-btn:hover {
  background: var(--terracotta-dark);
}

.comment-post-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.comments-login-prompt {
  font-size: 0.85rem;
  color: var(--warm-gray);
  padding: 0.5rem 0;
}

.comments-login-prompt a {
  color: var(--terracotta);
  font-weight: 600;
  text-decoration: none;
}

/* ── Post detail page ──────────────────── */

.post-detail-hero {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
  border-radius: 16px;
  margin-bottom: 1.5rem;
}

.post-detail-hero-placeholder {
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  border-radius: 16px;
  font-size: 4rem;
  margin-bottom: 1.5rem;
}

.post-detail-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.post-detail-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.post-detail-recipe {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--warm-gray);
  white-space: pre-wrap;
  margin-bottom: 2rem;
}

.post-detail-divider {
  border: none;
  border-top: 1px solid rgba(44, 24, 16, 0.08);
  margin: 2rem 0;
}

.post-detail-comments-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

/* ── Responsive ────────────────────────── */

@media (max-width: 768px) {
  .container { padding: 1.5rem; }
  .app-header { padding: 0.75rem 1.25rem; }
  .auth-card { padding: 2rem 1.5rem; }
  .post-card-image { height: 220px; }
  .feed-actions { flex-direction: column; align-items: center; }
}
