/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background: #faf9f6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* --- Nav --- */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: #b91c1c;
  color: white;
}

nav .logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: white;
  text-decoration: underline;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  color: #b91c1c;
}

.hero p {
  font-size: 1.15rem;
  color: #555;
  margin-top: 0.5rem;
}

/* --- Sauce Grid --- */
.sauce-list h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.sauce-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.sauce-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}

.sauce-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.sauce-card-image {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef2f2;
}

.sauce-card-image img {
  max-height: 100%;
  max-width: 100%;
  object-fit: cover;
}

.sauce-placeholder {
  font-size: 4rem;
}

.sauce-card-body {
  padding: 1rem;
}

.sauce-card-body h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.sauce-brand {
  color: #777;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.tag {
  display: inline-block;
  background: #fee2e2;
  color: #b91c1c;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

.heat-badge {
  display: inline-block;
  font-size: 0.8rem;
  color: #92400e;
  background: #fef3c7;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 3rem 0;
  font-size: 1.1rem;
}

/* --- Auth Forms --- */
.auth-form {
  max-width: 440px;
  margin: 2rem auto;
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-form h1 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: #b91c1c;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary {
  background: #b91c1c;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #991b1b;
}

.btn-secondary {
  background: #e5e7eb;
  color: #333;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: #666;
}

.auth-switch a {
  color: #b91c1c;
  font-weight: 600;
}

/* --- Alerts --- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* --- Section Header --- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin-bottom: 0;
}

/* --- Sauce Cards (clickable) --- */
a.sauce-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.sauce-card-meta {
  margin-top: 0.25rem;
}

.sauce-card-rating {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stars {
  color: #f59e0b;
  letter-spacing: 1px;
}

.stars-lg {
  color: #f59e0b;
  font-size: 1.25rem;
  letter-spacing: 2px;
}

.rating-text {
  font-size: 0.85rem;
  color: #777;
}

.result-count {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 1rem;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.filter-input:focus {
  outline: none;
  border-color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.filter-select {
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  background: white;
}

/* --- Form Row (side by side) --- */
.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* --- Back Link --- */
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: #b91c1c;
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* --- Sauce Detail Page --- */
.sauce-detail-header {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.sauce-detail-image {
  flex: 0 0 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef2f2;
  border-radius: 10px;
  overflow: hidden;
}

.sauce-detail-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.sauce-placeholder-lg {
  font-size: 6rem;
}

.sauce-detail-info {
  flex: 1;
}

.sauce-detail-info h1 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.sauce-brand-lg {
  font-size: 1.1rem;
  color: #777;
  margin-bottom: 0.75rem;
}

.sauce-description {
  margin-bottom: 1rem;
  color: #444;
}

.sauce-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sauce-added-by {
  font-size: 0.85rem;
  color: #888;
  margin-top: 1rem;
}

/* --- Rating Summary --- */
.rating-summary {
  background: #faf9f6;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.rating-big {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rating-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #b91c1c;
  line-height: 1;
}

.review-count-text {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.25rem;
}

.rating-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.rating-row span:first-child {
  width: 50px;
  color: #666;
}

.no-reviews-yet {
  color: #999;
  font-style: italic;
  margin: 1rem 0;
}

/* --- Reviews --- */
.reviews-section h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f3f4f6;
}

.review-card {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.review-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.review-date {
  font-size: 0.85rem;
  color: #999;
}

.review-ratings {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.review-text {
  color: #444;
  margin-top: 0.5rem;
}

/* --- Review Form --- */
.review-form-section {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.review-form-section h2 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: #b91c1c;
}

.star-ratings-row {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.star-rating-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.star-rating-group label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #333;
}

.star-picker {
  display: flex;
  gap: 2px;
  cursor: pointer;
}

.star-pick {
  font-size: 1.75rem;
  color: #ddd;
  transition: color 0.1s;
  user-select: none;
}

.star-pick.active {
  color: #f59e0b;
}

.star-pick.hover {
  color: #fbbf24;
}

.star-pick:hover {
  transform: scale(1.15);
}

.review-form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 0.65rem 1.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  background: #fee2e2;
}

.login-prompt {
  text-align: center;
  padding: 1.5rem;
  background: #faf9f6;
  border-radius: 8px;
  color: #666;
}

.login-prompt a {
  color: #b91c1c;
  font-weight: 600;
}

/* --- Review Cards (own review highlight) --- */
.review-own {
  border-left: 3px solid #b91c1c;
}

.review-yours {
  font-size: 0.75rem;
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.review-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.review-date {
  margin-left: auto;
}

/* --- Error Page --- */
.error-page {
  text-align: center;
  padding: 4rem 0;
}

.error-page h1 {
  font-size: 2rem;
  color: #b91c1c;
  margin-bottom: 0.5rem;
}

.error-page p {
  color: #666;
  margin-bottom: 1.5rem;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.page-link {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  color: #333;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.page-link:hover {
  background: #f3f4f6;
}

.page-current {
  background: #b91c1c;
  color: white;
  border-color: #b91c1c;
}

/* --- File Input --- */
.file-input {
  padding: 0.5rem;
  border: 1px dashed #ccc;
  border-radius: 6px;
  width: 100%;
  background: #fafafa;
  cursor: pointer;
}

.file-input:hover {
  border-color: #b91c1c;
}

.form-hint {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.25rem;
}

/* --- Clear Filter Button --- */
.btn-clear {
  color: #b91c1c;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.6rem 0.5rem;
  white-space: nowrap;
}

.btn-clear:hover {
  text-decoration: underline;
}

/* --- Image Preview --- */
.image-preview {
  margin-top: 0.5rem;
  max-width: 200px;
  border-radius: 8px;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  display: block;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .sauce-detail-header {
    flex-direction: column;
  }

  .sauce-detail-image {
    flex: none;
    width: 100%;
    height: 200px;
  }

  .filter-bar {
    flex-direction: column;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .rating-summary {
    flex-direction: column;
    text-align: center;
  }

  .star-ratings-row {
    gap: 1rem;
  }

  .review-ratings {
    flex-direction: column;
    gap: 0.25rem;
  }

  nav {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .nav-links a {
    margin-left: 0.75rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .section-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 1.5rem;
  color: #999;
  font-size: 0.85rem;
  border-top: 1px solid #eee;
}
