/* =========================================================
   Recipe Hub - Enhanced Styles
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400&display=swap");

:root {
  --background: hsl(38 25% 96%);
  --foreground: hsl(36 10% 12%);
  --muted: hsl(36 10% 12% / 0.6);
  --accent: hsl(24 65% 45%);
  --accent-hover: hsl(24 65% 40%);
  --border: hsl(36 10% 12% / 0.1);
  --surface: hsl(38 25% 99%);
  --surface-strong: hsl(36 10% 12%);

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-soft: 0 1px 2px hsl(36 10% 12% / 0.04),
                 0 8px 24px -12px hsl(36 10% 12% / 0.12);
  --shadow-hover: 0 4px 12px hsl(36 10% 12% / 0.08);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* =========================================================
   Hero / Page Layout
   ========================================================= */

.hero {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 96px;
  animation: fade-up 0.8s var(--ease) both;
}

/* Header Section - Compact layout */
.hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.header-content {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex: 1;
  min-width: 200px;
}

.header-content h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
  background: linear-gradient(135deg, var(--foreground) 60%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.header-content .subtitle {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
  margin: 0;
  white-space: nowrap;
}

/* Navigation Actions - Inline with header */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0;
  padding: 0 0 8px 0;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}

.actions a,
.actions .login-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground);
  background: transparent;
  border: 0;
  padding: 6px 4px;
  cursor: pointer;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
  position: relative;
  white-space: nowrap;
}

.actions a:hover,
.actions .login-link:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.actions a:not(:last-child)::after,
.actions .login-link:not(:last-child)::after {
  content: "/";
  margin-left: 12px;
  color: var(--border);
  font-weight: 300;
}

.primary-action {
  background: var(--surface-strong) !important;
  color: var(--background) !important;
  padding: 8px 20px !important;
  border-radius: 999px;
  transition: all 0.2s var(--ease);
  font-weight: 600;
}
.primary-action:hover {
  background: var(--accent) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px hsl(24 65% 45% / 0.3);
}
.primary-action::after { display: none !important; }

/* Account Shell */
.account-shell {
  display: inline-flex;
  align-items: center;
  margin-left: 0;
  flex-shrink: 0;
  z-index: 50;
  position: relative;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--foreground);
  padding: 6px 12px 6px 6px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.account-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--surface-strong));
  color: var(--background);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1;
  overflow: hidden;
  flex-shrink: 0;
}

.account-badge img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.account-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-button {
  color: var(--accent) !important;
  font-weight: 700;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  display: grid;
  min-width: 140px;
  z-index: 20;
  overflow: hidden;
}

.profile-menu.hidden { display: none; }

.profile-menu-item {
  border: 0;
  background: transparent;
  color: var(--foreground);
  text-align: left;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.profile-menu-item:hover {
  background: hsl(38 25% 96%);
}

/* =========================================================
   Profile Page Avatar Styles
   ========================================================= */

.profile-avatar-section {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  padding: 24px;
  background: var(--background);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.profile-avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  border: 3px solid var(--border);
  transition: border-color 0.2s;
}

.profile-avatar-preview:hover {
  border-color: var(--accent);
}

.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-controls {
  flex: 1;
  min-width: 200px;
}

.profile-avatar-controls .avatar-option-group {
  margin-bottom: 12px;
}

.profile-avatar-controls .avatar-option-group:last-child {
  margin-bottom: 0;
}

.profile-avatar-controls .field {
  margin-bottom: 8px;
}

.profile-avatar-controls .field:last-child {
  margin-bottom: 0;
}

.profile-avatar-controls .field > span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}

/* Emoji Select */
.emoji-select-wrapper {
  position: relative;
}

.emoji-select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--foreground);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b5f4f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.emoji-select:hover {
  border-color: var(--accent);
}

.emoji-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.emoji-select option {
  padding: 4px 8px;
}

/* Color Picker */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker-wrapper input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.color-picker-wrapper input[type="color"]:hover {
  border-color: var(--accent);
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-picker-wrapper input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 80px;
  transition: color 0.3s;
}

/* Avatar Upload Area */
.avatar-upload-area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  transition: border-color 0.2s;
}

.avatar-upload-area:hover {
  border-color: var(--accent);
}

.avatar-upload-area .secondary-btn {
  padding: 6px 16px;
  font-size: 0.7rem;
}

/* Profile Details */
.profile-details {
  display: grid;
  gap: 16px;
}

/* =========================================================
   Avatar Picker - Legacy (still used in some places)
   ========================================================= */

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--surface-strong));
  color: var(--background);
  flex-shrink: 0;
  transition: background 0.3s var(--ease);
}

.avatar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  flex: 1;
  min-width: 200px;
}

.avatar-field {
  flex: 1;
  min-width: 120px;
  gap: 4px;
}

.avatar-field > span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.avatar-field input[type="text"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--foreground);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.avatar-field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.avatar-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  width: 100%;
  font-family: var(--font-body);
}

/* Avatar Emoji Grid - Legacy (for backward compatibility) */
.avatar-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 12px;
  background: var(--background);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-height: 200px;
  overflow-y: auto;
}

.avatar-emoji-option {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.avatar-emoji-option:hover {
  border-color: var(--accent);
  transform: scale(1.05);
  background: var(--background);
}

.avatar-emoji-option.selected {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--accent);
}

.avatar-emoji-option:active {
  transform: scale(0.95);
}

/* =========================================================
   Content Grid (Two Columns)
   ========================================================= */

.content-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  margin-top: 16px;
}

@media (max-width: 768px) {
  .content-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* =========================================================
   Panels
   ========================================================= */

.history-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 28px 32px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  transition: box-shadow 0.3s var(--ease);
}

.history-panel:hover {
  box-shadow: var(--shadow-hover);
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.panel-header h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.75rem;
  margin: 0;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--foreground);
  color: var(--background);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
}

/* =========================================================
   Search Container
   ========================================================= */

.search-container {
  margin-bottom: 20px;
}

.search-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrapper input[type="text"] {
  flex: 1 1 200px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--background);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-wrapper input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.search-wrapper input[type="text"]::placeholder {
  color: var(--muted);
}

.search-wrapper button {
  flex-shrink: 0;
}

/* =========================================================
   History Lists
   ========================================================= */

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.history-list li {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s var(--ease), padding 0.2s var(--ease);
  border-radius: 4px;
}

.history-list li:last-child {
  border-bottom: none;
}

.history-list li:hover:not(.empty-state) {
  background: hsl(38 25% 96%);
  padding-left: 16px;
}

.history-list .empty-state {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
  padding: 40px 12px;
  background: transparent !important;
  cursor: default;
}

/* Login History Items */
.history-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.history-item .username {
  font-weight: 600;
  font-size: 0.95rem;
}

.history-item .timestamp {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Recipe Items */
.recipe-item {
  padding: 0 !important;
}

.recipe-item:hover {
  padding-left: 0 !important;
  background: transparent !important;
}

.recipe-link {
  display: block;
  padding: 14px 12px;
  transition: background 0.2s var(--ease);
  border-radius: 4px;
}

.recipe-link:hover {
  background: hsl(38 25% 96%);
}

.recipe-content {
  display: flex;
  gap: 16px;
  align-items: center;
}

.recipe-photo {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.recipe-photo-placeholder {
  width: 70px;
  height: 70px;
  background: var(--background);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.recipe-info {
  flex: 1;
  min-width: 0;
}

.recipe-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  display: block;
  margin-bottom: 2px;
}

.recipe-creator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.recipe-dates {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.recipe-dates span {
  display: inline-block;
}

/* =========================================================
   Buttons
   ========================================================= */

.primary-btn,
.secondary-btn,
button[type="submit"] {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--foreground);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-weight: 500;
}

.primary-btn {
  background: var(--surface-strong);
  color: var(--background);
}
.primary-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsl(24 65% 45% / 0.3);
}

.secondary-btn {
  background: transparent;
  color: var(--foreground);
}
.secondary-btn:hover {
  background: var(--foreground);
  color: var(--background);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* =========================================================
   Modal
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  background: hsl(36 10% 12% / 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  animation: fade-up 0.3s var(--ease);
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 32px 80px -20px hsl(36 10% 12% / 0.4);
  border: 1px solid var(--border);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
  padding: 4px;
}

.modal-close:hover {
  color: var(--foreground);
  transform: rotate(90deg);
}

.modal-content h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.25rem;
  margin: 0 0 4px;
}

.modal-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 28px;
}

.modal-content form {
  display: grid;
  gap: 20px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.field input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--foreground);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.field input::placeholder {
  color: hsl(36 10% 12% / 0.3);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0;
  min-height: 1.2em;
  text-align: center;
}

/* =========================================================
   Animation
   ========================================================= */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Recipe Detail Page - Shared Styles
   ========================================================= */

.back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  transition: color 0.2s var(--ease);
}

.back-link:hover {
  color: var(--accent);
}

/* =========================================================
   Recipe Header with Actions
   ========================================================= */

.recipe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.recipe-header .back-link {
  margin-bottom: 0;
}

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

.recipe-actions-top .status {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.recipe-actions-top .small-btn {
  padding: 6px 16px;
  font-size: 0.65rem;
}

.recipe-actions-top .primary-btn.small-btn {
  background: var(--surface-strong);
  color: var(--background);
}

.recipe-actions-top .primary-btn.small-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.recipe-actions-top .secondary-btn.small-btn {
  background: transparent;
  color: var(--foreground);
}

.recipe-actions-top .secondary-btn.small-btn:hover {
  background: var(--foreground);
  color: var(--background);
}

/* =========================================================
   Recipe Hero Section
   ========================================================= */

.recipe-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin: 16px 0 32px;
  align-items: stretch;
}

.recipe-hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0;
}

.recipe-hero-content h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.recipe-hero-content .recipe-creator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
}

.recipe-hero-content .recipe-creator span {
  font-weight: 600;
  color: var(--foreground);
}

.recipe-hero-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 24px;
}

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

.meta-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.meta-item span:last-child {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--foreground);
}

.recipe-hero-image {
  background: var(--background);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  border: 1px solid var(--border);
}

.recipe-hero-image img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
}

/* =========================================================
   Recipe Detail Page - Two Column Layout
   ========================================================= */

.recipe-two-column {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 48px;
  margin: 8px 0 24px;
}

.recipe-column {
  min-width: 0;
}

.recipe-column .section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.recipe-column .ingredient-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.recipe-column .ingredient-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0 8px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}

.recipe-column .ingredient-table tbody td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.recipe-column .ingredient-table tbody td:first-child {
  font-weight: 500;
  padding-right: 16px;
}

.recipe-column .ingredient-table tbody td:last-child {
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
}

.recipe-column .ingredient-table tbody tr:last-child td {
  border-bottom: none;
}

.recipe-column .step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step-counter;
}

.recipe-column .step-list li {
  counter-increment: step-counter;
  padding: 12px 0 12px 48px;
  position: relative;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
}

.recipe-column .step-list li:last-child {
  border-bottom: none;
}

.recipe-column .step-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--background);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.recipe-column .step-list li:first-child::before {
  top: 10px;
}

.recipe-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 32px;
}

.recipe-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.recipe-footer p strong {
  color: var(--foreground);
  font-weight: 600;
}

/* =========================================================
   Browse Page Styles
   ========================================================= */

.browse-page .hero-header {
  margin-bottom: 32px;
}

.browse-page .hero-header h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  background: linear-gradient(135deg, var(--foreground) 60%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.browse-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
  padding: 20px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.browse-controls .search-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}

.browse-controls .search-wrapper input[type="text"] {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--background);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.browse-controls .search-wrapper input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.browse-controls .search-wrapper input[type="text"]::placeholder {
  color: var(--muted);
}

.browse-stats {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.browse-stats span {
  font-weight: 600;
  color: var(--foreground);
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 8px;
}

.browse-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s var(--ease);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.browse-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px hsl(36 10% 12% / 0.12);
  border-color: var(--accent);
}

.browse-card-image {
  width: 100%;
  height: 200px;
  background: var(--background);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.browse-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}

.browse-card:hover .browse-card-image img {
  transform: scale(1.03);
}

.browse-card-placeholder {
  font-size: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--background);
}

.browse-card-content {
  padding: 20px 24px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.browse-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 4px;
  line-height: 1.3;
  color: var(--foreground);
}

.browse-card-creator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.browse-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.browse-card-classification {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--background);
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-weight: 500;
  text-transform: none;
  line-height: 1.6;
}

.browse-card-dietary {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.55rem;
  font-weight: 500;
  border: 1px solid rgba(46, 125, 50, 0.15);
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  line-height: 1.6;
  text-transform: none;
}

.browse-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.browse-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.browse-card-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px;
}

.browse-card-stars {
  color: #f5a623;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.browse-card-rating-count {
  color: var(--muted);
  font-size: 0.7rem;
}

.browse-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.browse-card-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.browse-card-favorite-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s var(--ease);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 2;
  padding: 0;
}

.browse-card-favorite-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.browse-card-favorite-btn.favorite-active {
  color: #e74c3c;
}

.browse-card-favorite-btn.favorite-active:hover {
  color: #c0392b;
  background: rgba(255, 255, 255, 1);
}

.browse-card-favorite-btn span {
  display: inline-block;
  pointer-events: none;
  user-select: none;
}

.browse-card-favorite-btn:active {
  transform: scale(0.9);
}

.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.browse-grid .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.browse-grid .empty-state .primary-btn {
  display: inline-block;
  text-decoration: none;
}

/* =========================================================
   Recipe Classification Badges
   ========================================================= */

.recipe-classification {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--background);
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-top: 2px;
}

.recipe-dietary-classification {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 1px 10px;
  border-radius: 10px;
  font-size: 0.55rem;
  font-weight: 500;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  border: 1px solid rgba(46, 125, 50, 0.15);
  margin-top: 2px;
  line-height: 1.6;
}

/* =========================================================
   Step Reordering Styles
   ========================================================= */

.step-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--background);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 6px;
}

.step-row .step-number {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}

.step-row input[type="text"] {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--foreground);
}

.step-row input[type="text"]:focus {
  outline: none;
}

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

.step-actions .small-btn {
  padding: 4px 8px;
  font-size: 0.7rem;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-actions .move-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.step-actions .move-btn:hover:not(:disabled) {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}

.step-actions .move-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.step-actions .small-btn[data-action="remove-step"] {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  font-weight: 300;
}

.step-actions .small-btn[data-action="remove-step"]:hover {
  background: hsl(0, 70%, 50%);
  color: white;
  border-color: hsl(0, 70%, 50%);
}

/* =========================================================
   Select / Dropdown Styling
   ========================================================= */

.field select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--foreground);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b5f4f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
  cursor: pointer;
}

.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.field select option {
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--foreground);
}

.field select:-moz-focusring {
  color: transparent;
  text-shadow: 0 0 0 var(--foreground);
}

.field select::-ms-expand {
  display: none;
}

.field select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================================================
   Ingredient Edit Table
   ========================================================= */

.ingredient-table-wrapper {
  overflow-x: auto;
}

.ingredient-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.ingredient-edit-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px 10px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}

.ingredient-edit-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.ingredient-edit-table tbody tr:last-child td {
  border-bottom: none;
}

.ingredient-edit-table tbody td:first-child {
  width: 25%;
  min-width: 80px;
}

.ingredient-edit-table tbody td:nth-child(2) {
  width: 25%;
  min-width: 100px;
}

.ingredient-edit-table tbody td:nth-child(3) {
  width: 40%;
  min-width: 120px;
}

.ingredient-edit-table tbody td:last-child {
  width: 10%;
  min-width: 40px;
  text-align: center;
}

.ingredient-edit-table input[type="text"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: transparent;
  border: none;
  padding: 6px 4px;
  color: var(--foreground);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
}

.ingredient-edit-table input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.ingredient-edit-table select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: transparent;
  border: none;
  padding: 6px 4px;
  color: var(--foreground);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.ingredient-edit-table select:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.ingredient-edit-table .small-btn {
  padding: 4px 8px;
  font-size: 0.7rem;
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.ingredient-edit-table .small-btn:hover {
  background: hsl(0, 70%, 50%);
  color: white;
  border-color: hsl(0, 70%, 50%);
}

/* =========================================================
   Allergen Grid Layout
   ========================================================= */

.allergen-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 16px;
  padding: 4px 0;
  width: 100%;
}

.allergen-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--foreground);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--ease);
  margin: 0;
  line-height: 1.4;
  min-height: 32px;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

.allergen-checkbox-item:hover {
  background: var(--background);
}

.allergen-checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  display: inline-block;
  vertical-align: middle;
}

.allergen-checkbox-item span {
  user-select: none;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  word-break: break-word;
  display: inline-block;
  vertical-align: middle;
}

/* =========================================================
   Favorite Button Styles
   ========================================================= */

.favorite-btn {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.2s var(--ease);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-btn:hover {
  transform: scale(1.15);
  color: var(--accent);
}

.favorite-btn.favorite-active {
  color: #e74c3c;
}

.favorite-btn.favorite-active:hover {
  color: #c0392b;
  transform: scale(1.15);
}

.favorite-btn .favorite-icon {
  display: inline-block;
  transition: transform 0.2s var(--ease);
}

/* =========================================================
   Rating Stars Styles
   ========================================================= */

.recipe-rating {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stars {
  display: flex;
  gap: 4px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.star {
  color: var(--muted);
  transition: all 0.15s var(--ease);
  display: inline-block;
}

.star.active {
  color: #f5a623;
}

.star.user-rated {
  color: #f5a623;
  text-shadow: 0 0 4px rgba(245, 166, 35, 0.4);
}

.star.hover {
  color: #f5a623;
  transform: scale(1.15);
}

.stars:hover .star {
  color: var(--muted);
}

.stars:hover .star.hover {
  color: #f5a623;
}

.star:active {
  transform: scale(0.9);
}

.rating-info {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--muted);
}

.stars.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.stars.disabled .star {
  cursor: not-allowed;
}

.recipe-rating-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 0.8rem;
}

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

.recipe-rating-count {
  color: var(--muted);
  font-size: 0.7rem;
}

/* =========================================================
   Recipe Description
   ========================================================= */

.recipe-description {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 90%;
}

@media (max-width: 768px) {
  .recipe-description {
    max-width: 100%;
    font-size: 0.9rem;
  }
}

/* =========================================================
   Time Input Row Styles
   ========================================================= */

.time-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--background);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.time-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-right: 2px;
}

.time-input {
  width: 100px !important;
  min-width: 100px !important;
  flex: 0 0 auto !important;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 10px !important;
  color: var(--foreground);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.time-input:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.time-unit-select {
  width: 90px !important;
  min-width: 90px !important;
  flex: 0 0 auto !important;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 10px !important;
  padding-right: 30px !important;
  color: var(--foreground);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b5f4f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.time-unit-select:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

/* =========================================================
   Nutrition Input Row Styles
   ========================================================= */

.nutrition-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--background);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  width: 100%;
}

.nutrition-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-right: 2px;
  min-width: 45px;
  flex-shrink: 0;
}

.nutrition-input {
  width: 100px !important;
  min-width: 100px !important;
  flex: 0 0 auto !important;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 6px 8px !important;
  color: var(--foreground);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.nutrition-input:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.nutrition-unit-select {
  width: 60px !important;
  min-width: 60px !important;
  flex: 0 0 auto !important;
  font-family: var(--font-body);
  font-size: 0.8rem;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 6px 4px !important;
  padding-right: 20px !important;
  color: var(--foreground);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b5f4f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.nutrition-unit-select:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

/* =========================================================
   Featured Recipe Favorite Button
   ========================================================= */

.featured-recipe-image {
  position: relative;
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 320px;
}

.featured-recipe-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 320px;
}

.featured-favorite-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s var(--ease);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 2;
  padding: 0;
}

.featured-favorite-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.featured-favorite-btn.favorite-active {
  color: #e74c3c;
}

.featured-favorite-btn.favorite-active:hover {
  color: #c0392b;
  background: rgba(255, 255, 255, 1);
}

.featured-favorite-btn span {
  display: inline-block;
  pointer-events: none;
  user-select: none;
}

.featured-favorite-btn:active {
  transform: scale(0.9);
}

/* =========================================================
   Search Page Styles
   ========================================================= */

.search-filters {
  margin-bottom: 40px;
}

.search-filters .card-form {
  padding: 24px 32px;
}

.filter-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.filter-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row + .filter-row {
  margin-top: 8px;
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  min-width: 80px;
}

.filter-field {
  flex: 1;
  min-width: 100px;
}

.filter-field.inline-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 80px;
}

.filter-field.inline-field span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-field.inline-field .filter-number {
  width: 70px !important;
  min-width: 60px !important;
  flex: 0 0 auto !important;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px !important;
  color: var(--foreground);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.filter-field.inline-field .filter-number:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(24 65% 45% / 0.1);
}

.filter-unit {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  min-width: 30px;
}

.filter-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.filter-actions .primary-btn,
.filter-actions .secondary-btn {
  padding: 10px 28px;
}

.filter-allergen-grid {
  flex: 1;
  min-width: 200px;
}

#searchResults .browse-controls {
  margin-top: 0;
}

/* =========================================================
   Pie Chart Styles
   ========================================================= */

.pie-chart-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.pie-chart {
  flex-shrink: 0;
}

.pie-chart svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.pie-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 140px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--foreground);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-label {
  font-weight: 500;
  min-width: 60px;
}

.legend-value {
  color: var(--muted);
  font-size: 0.85rem;
}

.pie-chart-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.pie-chart-message p {
  margin: 0;
}

.calorie-warning {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--radius-sm);
  color: #856404;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
}

.calorie-warning svg {
  display: inline-block;
  margin-right: 8px;
}

/* =========================================================
   Category Tags
   ========================================================= */

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.category-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--foreground);
  background: var(--background);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 500;
}

.category-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  cursor: default;
}

/* =========================================================
   Carousel Styles
   ========================================================= */

.carousel-section {
  margin-top: 0.5rem;
  padding: 0.5rem 0;
}

.carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.carousel-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.carousel-header-left h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0;
}

.carousel-header-right {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.carousel-container {
  position: relative;
  overflow: hidden;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.carousel-track-wrapper {
  overflow: hidden;
  border-radius: var(--radius);
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
  will-change: transform;
}

.carousel-item {
  flex: 0 0 100%;
  min-height: 420px;
  display: flex;
  align-items: stretch;
}

.carousel-item-content {
  display: flex;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.carousel-image-wrapper {
  flex: 0 0 66.666%;
  position: relative;
  overflow: hidden;
  background: var(--surface-strong);
  min-height: 420px;
}

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

.carousel-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: var(--surface-strong);
  color: var(--muted);
  position: absolute;
  top: 0;
  left: 0;
}

.carousel-item-info {
  flex: 0 0 33.333%;
  padding: 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}

.carousel-recipe-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.2rem 0;
  color: var(--foreground);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
}

.carousel-creator {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.4rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.5rem;
  max-width: 100%;
}

.carousel-classification {
  display: inline-block;
  background: var(--background);
  color: var(--accent);
  padding: 0.1rem 0.6rem;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 500;
  border: 1px solid var(--border);
  line-height: 1.5;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-dietary-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 0.1rem 0.6rem;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 500;
  border: 1px solid rgba(46, 125, 50, 0.15);
  line-height: 1.5;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  margin: 0.3rem 0;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 100%;
}

.carousel-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

.carousel-rating {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.3rem 0;
  flex-wrap: wrap;
}

.carousel-stars {
  color: #f5a623;
  font-size: 0.85rem;
  letter-spacing: 1px;
  white-space: nowrap;
}

.carousel-rating-count {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.carousel-description {
  color: var(--muted);
  margin: 0.3rem 0;
  line-height: 1.3;
  font-size: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
}

.carousel-view-btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 0.4rem 1.2rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  margin-top: 0.3rem;
  align-self: flex-start;
  transition: background 0.2s;
  text-align: center;
  white-space: nowrap;
}

.carousel-view-btn:hover {
  background: var(--accent-hover);
  color: white;
}

.carousel-favorite-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  transition: all 0.2s;
  z-index: 5;
}

.carousel-favorite-btn:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.8);
}

.carousel-favorite-btn .favorite-icon {
  line-height: 1;
  transition: color 0.2s;
}

.carousel-favorite-btn.favorite-active .favorite-icon {
  color: #ff4757;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 10;
  transition: background 0.2s, transform 0.2s;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) scale(1.05);
}

.carousel-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.carousel-prev {
  left: 1rem;
}

.carousel-next {
  right: 1rem;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0;
}

.carousel-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface-strong);
  cursor: pointer;
  padding: 0;
  transition: all 0.3s;
}

.carousel-dots .dot:hover {
  background: var(--border);
}

.carousel-dots .dot.active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.2);
}

.carousel-item .empty-state {
  width: 100%;
  text-align: center;
  padding: 4rem 2rem;
  font-size: 1.1rem;
  color: var(--muted);
}

.recipe-grid.hidden {
  display: none;
}

/* =========================================================
   Carousel Tabs
   ========================================================= */

.carousel-tabs {
  display: flex;
  gap: 4px;
  background: var(--background);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.carousel-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s var(--ease);
}

.carousel-tab:hover {
  color: var(--foreground);
  background: var(--surface);
}

.carousel-tab.active {
  color: var(--foreground);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

/* =========================================================
   Search Section
   ========================================================= */

.search-section {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.search-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.search-header-right {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

/* =========================================================
   Responsive Styles
   ========================================================= */

@media (max-width: 1024px) {
  .recipe-hero {
    gap: 32px;
  }
  .carousel-item {
    min-height: 380px;
  }
  .carousel-image-wrapper {
    min-height: 380px;
  }
  .carousel-item-info {
    padding: 1.25rem;
  }
  .carousel-recipe-name {
    font-size: 1.1rem;
  }
  .carousel-meta {
    font-size: 0.7rem;
    gap: 0.2rem 0.6rem;
  }
  .browse-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  .nutrition-input-row {
    gap: 6px;
    padding: 6px 12px;
  }
  .nutrition-input {
    width: 85px !important;
    min-width: 85px !important;
    padding: 5px 6px !important;
    font-size: 0.8rem;
  }
  .nutrition-unit-select {
    width: 55px !important;
    min-width: 55px !important;
    padding: 5px 4px !important;
    padding-right: 18px !important;
    font-size: 0.75rem;
  }
  .nutrition-label {
    font-size: 0.55rem;
    min-width: 35px;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 24px 16px 64px;
  }
  .hero-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }
  .header-content {
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-content h1 {
    font-size: clamp(2rem, 6vw, 2.8rem);
    white-space: normal;
  }
  .header-content .subtitle {
    font-size: 0.9rem;
    white-space: normal;
  }
  .actions {
    justify-content: center;
    gap: 6px 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
  }
  .actions a,
  .actions .login-link {
    font-size: 0.6rem;
    padding: 4px 2px;
  }
  .actions a:not(:last-child)::after,
  .actions .login-link:not(:last-child)::after {
    margin-left: 8px;
  }
  .primary-action {
    padding: 6px 14px !important;
    font-size: 0.6rem !important;
  }
  .account-shell {
    position: static;
    align-self: flex-end;
  }
  .account-button {
    padding: 4px 10px 4px 4px;
  }
  .account-badge {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  .account-label {
    font-size: 0.55rem;
  }
  .recipe-header {
    flex-wrap: wrap;
  }
  .recipe-actions-top {
    flex-wrap: wrap;
  }
  .recipe-actions-top .status {
    white-space: normal;
  }
  .recipe-actions-top .small-btn {
    padding: 4px 12px;
    font-size: 0.6rem;
  }
  .recipe-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .recipe-hero-content {
    order: 1;
    padding: 0;
  }
  .recipe-hero-image {
    order: 0;
    min-height: 200px;
  }
  .recipe-hero-image img {
    min-height: 200px;
  }
  .recipe-hero-content h1 {
    font-size: clamp(2rem, 6vw, 2.8rem);
  }
  .recipe-hero-meta {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
  }
  .recipe-two-column {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .recipe-column .ingredient-table {
    font-size: 0.85rem;
  }
  .recipe-column .ingredient-table tbody td {
    padding: 6px 0;
  }
  .recipe-column .step-list li {
    padding: 10px 0 10px 42px;
    font-size: 0.85rem;
  }
  .recipe-column .step-list li::before {
    width: 24px;
    height: 24px;
    font-size: 0.6rem;
    top: 10px;
  }
  .recipe-column .step-list li:first-child::before {
    top: 8px;
  }
  .recipe-footer {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  .section-header .search-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  .section-header .search-wrapper input[type="text"] {
    min-width: unset;
  }
  .section-header .search-wrapper button {
    width: 100%;
  }
  .browse-controls {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 20px;
  }
  .browse-controls .search-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  .browse-controls .search-wrapper input[type="text"] {
    min-width: unset;
  }
  .browse-controls .search-wrapper button {
    width: 100%;
  }
  .browse-stats {
    text-align: center;
  }
  .browse-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
  .browse-card-image {
    height: 160px;
  }
  .browse-card-content {
    padding: 16px 18px 18px;
  }
  .browse-card-title {
    font-size: 1.1rem;
  }
  .search-filters .card-form {
    padding: 16px 18px;
  }
  .filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-label {
    min-width: unset;
  }
  .filter-field.inline-field {
    flex: 1;
  }
  .filter-field.inline-field .filter-number {
    width: 100% !important;
    min-width: unset !important;
    flex: 1 !important;
  }
  .filter-actions {
    flex-direction: column;
  }
  .filter-actions .primary-btn,
  .filter-actions .secondary-btn {
    width: 100%;
    text-align: center;
  }
  .filter-allergen-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .carousel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }
  .carousel-header-left h2 {
    font-size: 1.3rem;
  }
  .carousel-header-right {
    justify-content: stretch;
  }
  .search-wrapper {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .search-wrapper input[type="text"] {
    min-width: unset;
    padding: 6px 12px;
    font-size: 0.8rem;
    width: 100%;
  }
  .search-wrapper button {
    width: 100%;
    justify-content: center;
  }
  .carousel-item-content {
    flex-direction: column;
  }
  .carousel-image-wrapper {
    flex: 0 0 200px;
    min-height: 200px;
    width: 100%;
  }
  .carousel-item-info {
    flex: 0 0 auto;
    padding: 1rem;
  }
  .carousel-item {
    min-height: auto;
  }
  .carousel-recipe-name {
    font-size: 1rem;
  }
  .carousel-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  .carousel-prev {
    left: 0.5rem;
  }
  .carousel-next {
    right: 0.5rem;
  }
  .carousel-favorite-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    top: 0.75rem;
    right: 0.75rem;
  }
  .carousel-section {
    margin-top: 0;
    padding: 0.25rem 0;
  }
  .carousel-description {
    font-size: 0.75rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .carousel-meta {
    font-size: 0.65rem;
  }
  .carousel-view-btn {
    padding: 0.3rem 1rem;
    font-size: 0.7rem;
  }
  .carousel-tabs {
    flex-direction: column;
    width: 100%;
  }
  .carousel-tab {
    text-align: center;
    padding: 10px 16px;
  }
  .search-header {
    flex-direction: column;
    align-items: stretch;
  }
  .search-header-right {
    justify-content: stretch;
  }
  .nutrition-input-row {
    padding: 6px 10px;
    gap: 4px;
  }
  .nutrition-label {
    font-size: 0.5rem;
    min-width: 30px;
  }
  .nutrition-input {
    width: 70px !important;
    min-width: 70px !important;
    padding: 4px 6px !important;
    font-size: 0.75rem;
  }
  .nutrition-unit-select {
    width: 50px !important;
    min-width: 50px !important;
    padding: 4px 4px !important;
    padding-right: 16px !important;
    font-size: 0.7rem;
  }
  .browse-card-image {
    height: 160px;
  }
  .browse-card-favorite-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    top: 8px;
    right: 8px;
  }
  .profile-avatar-section {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 16px;
  }
  .profile-avatar-preview {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }
  .profile-avatar-controls {
    width: 100%;
  }
  .color-picker-wrapper {
    flex-wrap: wrap;
  }
  .featured-recipe-content {
    grid-template-columns: 1fr;
  }
  .featured-recipe-image {
    min-height: 200px;
  }
  .featured-recipe-image img {
    min-height: 200px;
  }
  .featured-recipe-info {
    padding: 24px 28px;
  }
  .featured-favorite-btn {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    top: 12px;
    right: 12px;
  }
  .time-input-row {
    padding: 6px 10px;
    gap: 4px;
  }
  .time-label {
    font-size: 0.55rem;
  }
  .time-input {
    width: 55px !important;
    min-width: 55px !important;
    padding: 6px 8px !important;
    font-size: 0.9rem;
  }
  .time-unit-select {
    width: 90px !important;
    min-width: 90px !important;
    padding: 6px 8px !important;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 40px 16px 64px;
  }
  .hero-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }
  .header-content h1 {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
  }
  .header-content .subtitle {
    font-size: 1rem;
  }
  .actions {
    gap: 6px 14px;
    padding: 12px 0 16px;
    margin-bottom: 32px;
  }
  .actions a,
  .actions .login-link {
    font-size: 0.65rem;
  }
  .profile-menu {
    right: auto;
    left: 0;
  }
  .primary-action {
    padding: 8px 16px !important;
  }
  .content-grid {
    gap: 24px;
  }
  .history-panel {
    padding: 20px;
  }
  .panel-header h2 {
    font-size: 1.5rem;
  }
  .search-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrapper input[type="text"] {
    flex: 1;
  }
  .search-wrapper button {
    width: 100%;
  }
  .modal-content {
    padding: 32px 24px 28px;
    margin: 12px;
  }
  .modal-content h2 {
    font-size: 1.75rem;
  }
  .recipe-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .recipe-photo,
  .recipe-photo-placeholder {
    width: 100%;
    height: 120px;
  }
  .recipe-dates {
    flex-direction: column;
    gap: 2px;
  }
  .recipe-stars,
  .browse-card-stars {
    font-size: 0.7rem;
  }
  .recipe-rating-compact {
    font-size: 0.7rem;
  }
  .favorite-btn {
    font-size: 1.5rem;
    padding: 2px 6px;
  }
  .stars {
    font-size: 1.25rem;
    gap: 3px;
  }
  .rating-info {
    font-size: 0.75rem;
  }
  .pie-chart-wrapper {
    flex-direction: column;
    gap: 20px;
  }
  .pie-chart {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
  .pie-chart-legend {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
  }
  .legend-item {
    font-size: 0.8rem;
  }
  .legend-value {
    font-size: 0.75rem;
  }
  .ingredient-edit-table {
    font-size: 0.8rem;
  }
  .ingredient-edit-table tbody td {
    padding: 4px 4px;
  }
  .ingredient-edit-table tbody td:first-child {
    width: 20%;
    min-width: 60px;
  }
  .ingredient-edit-table tbody td:nth-child(2) {
    width: 20%;
    min-width: 70px;
  }
  .ingredient-edit-table tbody td:nth-child(3) {
    width: 45%;
    min-width: 80px;
  }
  .ingredient-edit-table tbody td:last-child {
    width: 15%;
    min-width: 30px;
  }
  .nutrition-input-row {
    flex-wrap: wrap;
    gap: 4px 6px;
  }
  .avatar-picker {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 16px;
  }
  .avatar-preview {
    align-self: center;
    width: 72px;
    height: 72px;
    font-size: 1.75rem;
  }
  .avatar-controls {
    flex-direction: column;
    gap: 12px;
  }
  .avatar-field {
    min-width: unset;
  }
  .color-picker-wrapper {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 16px 12px 48px;
  }
  .header-content h1 {
    font-size: 1.8rem;
  }
  .header-content .subtitle {
    font-size: 0.8rem;
  }
  .actions {
    gap: 4px 10px;
  }
  .actions a,
  .actions .login-link {
    font-size: 0.55rem;
  }
  .actions a:not(:last-child)::after,
  .actions .login-link:not(:last-child)::after {
    margin-left: 6px;
  }
  .carousel-header-left h2 {
    font-size: 1.1rem;
  }
  .carousel-image-wrapper {
    flex: 0 0 160px;
    min-height: 160px;
  }
  .carousel-item-info {
    padding: 0.75rem;
  }
  .carousel-recipe-name {
    font-size: 0.9rem;
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }
  .carousel-classification,
  .carousel-dietary-badge {
    font-size: 0.55rem;
    padding: 0.05rem 0.5rem;
  }
  .carousel-meta {
    gap: 0.15rem 0.4rem;
    font-size: 0.6rem;
  }
  .carousel-stars {
    font-size: 0.7rem;
  }
  .carousel-view-btn {
    padding: 0.3rem 0.8rem;
    font-size: 0.65rem;
    white-space: normal;
  }
  .carousel-description {
    font-size: 0.7rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .recipe-hero-image {
    min-height: 160px;
  }
  .recipe-hero-image img {
    min-height: 160px;
  }
  .recipe-hero-meta {
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
  }
  .meta-label {
    font-size: 0.55rem;
  }
  .meta-item span:last-child {
    font-size: 0.8rem;
  }
  .recipe-two-column {
    gap: 24px;
  }
  .recipe-column .section-title {
    font-size: 1.15rem;
  }
  .recipe-column .ingredient-table tbody td:last-child {
    white-space: normal;
    text-align: right;
  }
  .featured-recipe-info h2 {
    font-size: 1.5rem;
  }
  .featured-recipe-meta {
    flex-wrap: wrap;
    gap: 8px 16px;
  }
  .featured-recipe-info .primary-btn {
    width: 100%;
    text-align: center;
  }
  .browse-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .browse-card-image {
    height: 200px;
  }
  .browse-card-favorite-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  .filter-allergen-grid {
    grid-template-columns: 1fr 1fr;
  }
  .profile-avatar-preview {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }
  .avatar-upload-area {
    flex-direction: column;
    align-items: stretch;
  }
  .avatar-upload-area .secondary-btn {
    width: 100%;
  }
}

/* =========================================================
   Nutrition Input Row - Additional responsive
   ========================================================= */

@media (max-width: 600px) {
  .nutrition-input-row {
    flex-wrap: wrap;
    gap: 4px 6px;
  }
  .nutrition-input {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 100% !important;
  }
  .nutrition-unit-select {
    flex: 0 0 auto !important;
    width: 60px !important;
    min-width: 60px !important;
  }
}