/* ===========================================
   Dark Mode - True Dark Theme (No Blue)
   =========================================== */
[data-theme="dark"] {
  /* Primary colors - warm neutral grey */
  --pico-primary: #a8a8a8;
  --pico-primary-background: #3d3d3d;
  --pico-primary-border: #4a4a4a;
  --pico-primary-hover: #d0d0d0;
  --pico-primary-hover-background: #4a4a4a;
  --pico-primary-hover-border: #5a5a5a;
  --pico-primary-focus: rgba(168, 168, 168, 0.4);
  --pico-primary-underline: rgba(168, 168, 168, 0.5);
  --pico-primary-inverse: #0a0a0a;

  /* Secondary colors - neutral */
  --pico-secondary: #707070;
  --pico-secondary-background: #2a2a2a;
  --pico-secondary-border: #3a3a3a;
  --pico-secondary-hover: #909090;
  --pico-secondary-hover-background: #3a3a3a;
  --pico-secondary-hover-border: #4a4a4a;
  --pico-secondary-focus: rgba(112, 112, 112, 0.4);
  --pico-secondary-underline: rgba(112, 112, 112, 0.5);
  --pico-secondary-inverse: #f5f5f5;

  /* True dark background colors - near black */
  --pico-background-color: #0a0a0a;
  --pico-card-background-color: #141414;
  --pico-card-sectioning-background-color: #141414;

  /* Muted colors for borders, text */
  --pico-muted-color: #666666;
  --pico-muted-border-color: #2a2a2a;

  /* Form colors */
  --pico-form-element-background-color: #141414;
  --pico-form-element-border-color: #2a2a2a;
  --pico-form-element-focus-color: #a8a8a8;

  /* Text colors - warm white */
  --pico-color: #e0e0e0;

  /* Additional overrides for true dark */
  --pico-h1-color: #f0f0f0;
  --pico-h2-color: #e8e8e8;
  --pico-h3-color: #e0e0e0;
  --pico-h4-color: #d8d8d8;
  --pico-h5-color: #d0d0d0;
  --pico-h6-color: #c8c8c8;

  /* Code/pre blocks */
  --pico-code-background-color: #1a1a1a;
  --pico-code-color: #c0c0c0;

  /* Table */
  --pico-table-border-color: #2a2a2a;

  /* Dropdown/select */
  --pico-dropdown-background-color: #141414;
  --pico-dropdown-border-color: #2a2a2a;
  --pico-dropdown-hover-background-color: #1e1e1e;

  /* Modal/dialog */
  --pico-modal-overlay-background-color: rgba(0, 0, 0, 0.85);
}

/* Dark mode card gradients for visual depth */
[data-theme="dark"] .recipe-card,
[data-theme="dark"] .category-card,
[data-theme="dark"] .belief-card {
  background: linear-gradient(
    180deg,
    var(--pico-card-background-color) 0%,
    rgba(16, 16, 16, 0.95) 100%
  );
}

/* Enhanced focus states for accessibility */
[data-theme="dark"] a:focus-visible,
[data-theme="dark"] button:focus-visible,
[data-theme="dark"] [role="button"]:focus-visible,
[data-theme="dark"] input:focus-visible,
[data-theme="dark"] select:focus-visible,
[data-theme="dark"] textarea:focus-visible {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

/* Subtle hover states for interactive text */
[data-theme="dark"] article a:not([role="button"]):hover {
  color: var(--pico-primary-hover);
}

/* ===========================================
   Global Typography & List Styling
   =========================================== */

/* Refined heading hierarchy */
h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3, h4, h5, h6 {
  font-weight: 600;
}

/* Better body text readability */
p, li {
  line-height: 1.7;
}

/* Elegant link styling in articles */
article a:not([role="button"]) {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

/* Global list positioning - keep bullets inside content area */
article ul,
article ol,
main ul:not(.nav-links):not(.pagination),
main ol {
  list-style-position: outside;
  padding-left: 1.5rem;
  margin-left: 0;
}

/* Modern disc bullets instead of squares */
article ul,
main ul:not(.nav-links):not(.pagination) {
  list-style-type: disc;
}

/* Muted bullet color */
article ul li::marker,
main ul:not(.nav-links):not(.pagination) li::marker {
  color: var(--pico-muted-color);
}

/* Proper spacing between list items */
article li,
main li {
  padding: 0.25rem 0;
}

/* ===========================================
   Spacing & Rhythm
   =========================================== */

/* Consistent section spacing */
article > section,
main > section {
  margin-bottom: 2.5rem;
}

article > section:last-child,
main > section:last-child {
  margin-bottom: 0;
}

/* Section separators (hr) */
article hr {
  margin: 2rem 0;
  border-color: var(--pico-muted-border-color);
  opacity: 0.5;
}

/* Better paragraph spacing in articles */
article p + p {
  margin-top: 1rem;
}

/* ===========================================
   Recipe Page List Styling
   =========================================== */

/* Ingredients list */
#ingredients-list {
  list-style-type: disc;
  list-style-position: outside;
  padding-left: 1.25rem;
}

#ingredients-list li {
  padding: 0.375rem 0;
  line-height: 1.5;
}

/* Instructions (ordered list in recipe) */
article section ol {
  list-style-position: outside;
  padding-left: 1.5rem;
}

article section ol li {
  padding: 0.5rem 0;
  line-height: 1.6;
}

/* Numbered list markers */
article section ol li::marker {
  color: var(--pico-primary);
  font-weight: 600;
}

/* ===========================================
   Elegant Button Styling
   =========================================== */

/* Base button improvements */
button,
[role="button"],
input[type="submit"],
input[type="button"],
input[type="reset"] {
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  font-weight: 500;
}

/* Outline buttons - thinner, more refined */
[data-theme="dark"] button.outline,
[data-theme="dark"] [role="button"].outline,
[data-theme="dark"] a.outline[role="button"] {
  border-width: 1px;
  background: transparent;
}

/* Primary outline */
[data-theme="dark"] button.outline:not(.secondary):not(:disabled),
[data-theme="dark"] [role="button"].outline:not(.secondary):not(:disabled) {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
}

[data-theme="dark"] button.outline:not(.secondary):hover:not(:disabled),
[data-theme="dark"] [role="button"].outline:not(.secondary):hover:not(:disabled) {
  background: rgba(156, 163, 175, 0.1);
  border-color: var(--pico-primary-hover);
  color: var(--pico-primary-hover);
  transform: translateY(-1px);
}

/* Secondary outline */
[data-theme="dark"] button.outline.secondary:not(:disabled),
[data-theme="dark"] [role="button"].outline.secondary:not(:disabled),
[data-theme="dark"] a.outline.secondary[role="button"]:not(:disabled) {
  border-color: var(--pico-secondary);
  color: var(--pico-secondary);
}

[data-theme="dark"] button.outline.secondary:hover:not(:disabled),
[data-theme="dark"] [role="button"].outline.secondary:hover:not(:disabled),
[data-theme="dark"] a.outline.secondary[role="button"]:hover:not(:disabled) {
  background: rgba(107, 114, 128, 0.15);
  border-color: var(--pico-secondary-hover);
  color: var(--pico-secondary-hover);
  transform: translateY(-1px);
}

/* Solid buttons - subtle shadow for depth and proper contrast */
[data-theme="dark"] button:not(.outline):not(:disabled),
[data-theme="dark"] [role="button"]:not(.outline):not(:disabled),
[data-theme="dark"] input[type="submit"]:not(:disabled) {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color: #fff;
}

[data-theme="dark"] button:not(.outline):hover:not(:disabled),
[data-theme="dark"] [role="button"]:not(.outline):hover:not(:disabled),
[data-theme="dark"] input[type="submit"]:hover:not(:disabled) {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

/* Focus states */
button:focus-visible,
[role="button"]:focus-visible,
input[type="submit"]:focus-visible {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

/* ===========================================
   Trix Editor Dark Mode Styling
   =========================================== */
[data-theme="dark"] trix-editor {
  background-color: var(--pico-form-element-background-color);
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: 0.5rem;
  color: var(--pico-color);
  min-height: 8em;
}

[data-theme="dark"] trix-editor:focus {
  border-color: var(--pico-form-element-focus-color);
  outline: none;
}

[data-theme="dark"] trix-toolbar {
  background-color: var(--pico-card-background-color);
  border-radius: 0.5rem 0.5rem 0 0;
  padding: 0.5rem;
  margin-bottom: -1px;
}

[data-theme="dark"] trix-toolbar .trix-button-group {
  background-color: var(--pico-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.375rem;
  margin-bottom: 0;
}

[data-theme="dark"] trix-toolbar .trix-button {
  background: transparent;
  border: none;
  border-bottom: none;
  color: var(--pico-muted-color);
}

[data-theme="dark"] trix-toolbar .trix-button:not(:first-child) {
  border-left: 1px solid var(--pico-muted-border-color);
}

[data-theme="dark"] trix-toolbar .trix-button:hover:not(:disabled) {
  background-color: var(--pico-secondary-background);
  color: var(--pico-color);
}

[data-theme="dark"] trix-toolbar .trix-button.trix-active {
  background-color: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
}

[data-theme="dark"] trix-toolbar .trix-button--icon::before {
  opacity: 0.7;
  filter: invert(1);
}

[data-theme="dark"] trix-toolbar .trix-button--icon.trix-active::before {
  opacity: 1;
}

[data-theme="dark"] trix-toolbar .trix-dialog {
  background-color: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-top: none;
}

[data-theme="dark"] trix-toolbar .trix-input--dialog {
  background-color: var(--pico-form-element-background-color);
  border: 1px solid var(--pico-form-element-border-color);
  color: var(--pico-color);
}

/* Hide file attachment button (we don't want uploads in Trix) */
trix-toolbar .trix-button--icon-attach {
  display: none;
}

/* ===========================================
   Font Size Toggle
   =========================================== */
html[data-font-size="small"] { font-size: 14px; }
html[data-font-size="medium"] { font-size: 16px; }
html[data-font-size="large"] { font-size: 20px; }

/* Comments and Ratings */
.rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

.rating-stars .star {
    font-size: 1.25rem;
    line-height: 1;
}

.rating-stars .star.filled {
    color: #f59e0b;
}

.rating-stars .star.empty {
    color: #d1d5db;
}

.rating-stars .rating-value {
    margin-left: 0.5rem;
    font-weight: 600;
}

.aggregate-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.rating-count {
    color: var(--secondary);
    font-size: 0.875rem;
}

/* Rating input (star picker) */
.rating-input {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 0;
    border: none;
    padding: 0;
    margin: 0.5rem 0;
}

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

.rating-input label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #d1d5db;
    transition: color 0.1s;
    padding: 0 0.125rem;
    margin: 0;
}

.rating-input label:hover,
.rating-input label:hover ~ label,
.rating-input input[type="radio"]:checked ~ label {
    color: #f59e0b;
}

.rating-input label[for="rating-0"] {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    color: var(--secondary);
}

/* Comments */
.comments-section {
    margin-top: 2rem;
}

.comment-form {
    margin-bottom: 2rem;
}

.comment-form textarea {
    resize: vertical;
    min-height: 100px;
}

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

.comment {
    padding: 1rem;
    border: 1px solid var(--muted-border-color);
    border-radius: var(--border-radius);
    margin: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-author .avatar {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--secondary);
    font-size: 0.875rem;
}

.comment-body {
    margin: 0.5rem 0;
}

.comment-body p {
    margin: 0;
    white-space: pre-wrap;
}

.comment-actions {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--muted-border-color);
}

.comment-actions button.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.no-comments {
    color: var(--secondary);
    text-align: center;
    padding: 2rem 0;
}

.login-prompt {
    padding: 1rem;
    background: var(--card-background-color);
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 1rem;
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Recipe Scaler Controls */
.recipe-scaler {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card-background-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.scaler-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scaler-controls .scaler-label {
    margin: 0;
    font-weight: 600;
}

.scaler-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    margin: 0;
    font-size: 1.25rem;
    font-weight: bold;
    line-height: 1;
    border-radius: var(--border-radius);
}

#servings-input {
    width: 4rem;
    text-align: center;
    margin: 0;
    padding: 0.5rem;
}

.scaler-reset {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    display: none;
}

.unit-toggle {
    display: flex;
    align-items: center;
}

.unit-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
}

.scale-locked-notice {
    color: var(--secondary);
    font-style: italic;
}

.scaling-notes {
    flex-basis: 100%;
    margin-top: 0.5rem;
}

.scaling-notes summary {
    cursor: pointer;
    color: var(--secondary);
    font-size: 0.875rem;
}

/* Highlight changed quantities */
.ingredient-quantity.scaled {
    background: var(--primary-focus);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

.ingredient-unit.converted {
    background: var(--secondary-focus);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

/* Mobile adjustments for scaler */
@media (max-width: 576px) {
    .recipe-scaler {
        flex-direction: column;
        align-items: stretch;
    }

    .scaler-controls {
        justify-content: center;
    }

    .unit-toggle {
        justify-content: center;
    }
}

/* ===========================================
   Button Utility Classes
   =========================================== */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin: 0;
}

.btn-md {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    margin: 0;
}

/* ===========================================
   Admin Action Buttons
   =========================================== */
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.admin-actions a[role="button"],
.admin-actions button {
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-icon {
    padding: 0.375rem 0.5rem;
    margin: 0;
    font-size: 1rem;
    line-height: 1;
    min-width: 2.25rem;
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* Tighter spacing for nav icon buttons */
.nav-links li:has(.btn-icon) {
    margin-left: -0.25rem;
}

/* ===========================================
   Browse Page Grids
   =========================================== */
.category-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.cuisine-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cuisine-grid a {
    min-width: 140px;
    flex: 1 1 auto;
    text-align: center;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ===========================================
   Mobile Navigation (Hamburger Menu)
   =========================================== */
/* Use high specificity to override Pico CSS button defaults */
header nav > button.nav-toggle,
nav > button.nav-toggle,
button.nav-toggle {
    display: none !important;
    background: transparent !important;
    border: none !important;
    font-size: 1.5rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: var(--color);
    width: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Ensure header has relative positioning for dropdown */
header.container {
    position: relative;
}

/* Desktop: nav-links always visible as flex row */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 768px) {
    header nav > button.nav-toggle,
    nav > button.nav-toggle,
    button.nav-toggle {
        display: block !important;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        background: var(--card-background-color);
        flex-direction: column;
        padding: 1rem;
        margin: 0;
        border-radius: 0 0 var(--border-radius) var(--border-radius);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links li {
        margin: 0.5rem 0;
        padding: 0;
    }

    .nav-links li a,
    .nav-links li button {
        display: block;
        width: 100%;
        text-align: left;
    }

    .nav-links li form {
        margin: 0;
    }
}

/* ===========================================
   Recipe Action Buttons (consistent styling)
   =========================================== */
.recipe-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}

/* Make forms inside recipe-actions inline and override Pico defaults */
.recipe-actions form {
    display: inline !important;
    margin: 0 !important;
}

/* Ensure buttons in recipe-actions are auto-width, not full-width */
.recipe-actions button,
.recipe-actions a[role="button"],
.recipe-actions form button {
    width: auto !important;
    margin: 0 !important;
}

/* Classification chips on recipe pages */
.classification-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Pill-shaped classification tags */
.classification-chips a[role="button"] {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
}

/* ===========================================
   Toast Notifications
   =========================================== */
.toast {
    position: fixed;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--primary-inverse, #fff);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    z-index: 1001;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toastFadeInOut 2.5s ease-in-out forwards;
}

@keyframes toastFadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-1rem); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-0.5rem); }
}

/* ===========================================
   Dietary Features: Allergens, Substitutions
   =========================================== */

/* Allergen Warnings */
.allergen-warnings {
    margin: 0.75rem 0;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.allergen-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    margin: 0.125rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.allergen-danger {
    background: #fee2e2;
    color: #991b1b;
}

.allergen-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Dietary Mode Badges */
.dietary-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.dietary-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #d1fae5;
    color: #065f46;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Ingredient Allergen Icons */
.ingredient-allergen-icon {
    margin-left: 0.25rem;
    font-size: 0.875rem;
    cursor: help;
}

/* Ingredient Substitutions */
.ingredient-substitutions {
    margin-top: 0.25rem;
}

.substitution-toggle {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.btn-xs {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    margin: 0;
}

.substitution-list {
    margin: 0.5rem 0 0 1rem;
    padding: 0.5rem;
    background: var(--card-background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--muted-border-color);
}

.substitution-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--muted-border-color);
}

.substitution-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.substitution-item:first-child {
    padding-top: 0;
}

.substitution-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0;
}

.substitution-select input[type="checkbox"] {
    margin: 0;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.substitution-select input[type="checkbox"]:checked + strong {
    color: var(--primary);
}

.substitution-item.selected {
    background: rgba(var(--primary-rgb, 156, 163, 175), 0.08);
    margin: 0 -0.5rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
}

.substitution-notes {
    margin-left: 1.5rem;
    display: block;
}

.substitution-ratio {
    color: var(--secondary);
    font-weight: normal;
    margin-left: 0.25rem;
}

.works-in {
    color: #059669;
}

.not-for {
    color: #dc2626;
}

/* Admin Substitution/Allergen Pages */
.keyword-count {
    color: var(--secondary);
    font-size: 0.875rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Admin pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

/* ===========================================
   Dietary Preferences Dropdown (Recipe Pages)
   =========================================== */
.dietary-preferences-dropdown {
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    background: var(--card-background-color);
}

.dietary-preferences-dropdown summary {
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--card-background-color);
    color: var(--color);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    list-style: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dietary-preferences-dropdown summary::-webkit-details-marker {
    display: none;
}

.dietary-preferences-dropdown[open] summary {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-bottom-color: var(--muted-border-color);
}

.dietary-preferences-dropdown summary:hover {
    background: rgba(var(--primary-rgb, 156, 163, 175), 0.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.dietary-preferences-dropdown .dropdown-icon {
    font-size: 1.5rem;
}

.dietary-preferences-dropdown .preference-count {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(var(--primary-rgb, 156, 163, 175), 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
}

.dietary-preferences-dropdown .dropdown-content {
    padding: 1.25rem;
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.dietary-preferences-dropdown .dropdown-hint {
    margin-bottom: 1rem;
    color: var(--secondary);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--muted-border-color);
}

/* Compact checkbox grid for recipe page dropdown */
.checkbox-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem 1rem;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: background 0.15s;
}

.checkbox-inline:hover {
    background: rgba(var(--primary-rgb, 156, 163, 175), 0.08);
}

.checkbox-inline input[type="checkbox"] {
    margin: 0;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.checkbox-inline input[type="checkbox"]:checked + * {
    font-weight: 600;
}

/* Option icon and text layout */
.option-icon {
    flex-shrink: 0;
    width: 1.5em;
    text-align: center;
}

.option-text {
    flex: 1;
}

/* Account page checkbox grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
}

/* Ingredient warning highlight (allergen matches user preferences) */
.ingredient-allergen-warning {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

/* Cooking time adjustment note */
.cooking-time-note {
    display: inline-block;
    color: #a8a8a8;
    background: #2a2a2a;
    padding: 0.125rem 0.375rem;
    border-radius: var(--border-radius);
    margin-top: 0.25rem;
}

/* Dietary preference fieldsets on account page */
.dietary-preferences-dropdown fieldset,
form fieldset {
    border: 1px solid var(--muted-border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.dietary-preferences-dropdown fieldset legend,
form fieldset legend {
    padding: 0 0.5rem;
    font-weight: 500;
}

/* Muted text utility */
.muted {
    color: var(--secondary);
}

/* ===========================================
   Original Scan Display
   =========================================== */
.original-scan-section {
    margin: 1rem 0;
}

.original-scan-details {
    border: 1px solid var(--muted-border-color);
    border-radius: var(--border-radius);
    background: var(--card-background-color);
}

.original-scan-details summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.original-scan-details summary:hover {
    background: rgba(0, 0, 0, 0.05);
}

.original-scan-details .scan-icon {
    font-size: 1.25rem;
}

.original-scan-details .scan-hint {
    color: var(--secondary);
    font-weight: normal;
    margin-left: 0.25rem;
}

.original-scan-details .scan-content {
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--muted-border-color);
}

.original-scan-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===========================================
   Homepage Styles
   =========================================== */

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

.hero-section h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero-section p {
  color: var(--pico-muted-color);
  font-size: 1.25rem;
  margin-bottom: 0;
}

/* Section headers with View all link */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

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

.view-all {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
  text-decoration: none;
}

.view-all:hover {
  color: var(--pico-primary);
}

/* Recipe grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Recipe cards */
.recipe-card {
  background: var(--pico-card-background-color);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--pico-muted-border-color);
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  border-color: var(--pico-primary);
}

.recipe-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.recipe-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: var(--pico-muted-border-color);
}

.recipe-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.recipe-card:hover .recipe-image img {
  transform: scale(1.05);
}

.recipe-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--pico-muted-border-color) 0%, var(--pico-card-background-color) 100%);
}

.recipe-info {
  padding: 1rem;
}

.recipe-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.recipe-description {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.recipe-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}

.recipe-time::before {
  content: "⏱ ";
}

.recipe-difficulty {
  text-transform: capitalize;
}

/* Featured and Recent sections */
.featured-section,
.recent-section {
  margin-bottom: 3rem;
}

.featured-section h2,
.recent-section h2,
.categories-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Category grid */
.categories-section {
  margin-bottom: 3rem;
}

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

.category-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--pico-card-background-color);
  border-radius: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 1px solid var(--pico-muted-border-color);
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--pico-primary);
}

.category-name {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.category-desc {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

/* CTA section */
.cta-section {
  background: var(--pico-card-background-color);
  border-radius: 1rem;
  padding: 2.5rem;
  text-align: center;
  margin: 3rem 0;
  border: 1px solid var(--pico-muted-border-color);
}

.cta-content h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.cta-content p {
  color: var(--pico-muted-color);
  margin-bottom: 1.5rem;
}

.cta-content a[role="button"] {
  display: inline-block;
  padding: 0.75rem 2rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .hero-section h1 {
    font-size: 2rem;
  }
  
  .recipe-grid {
    grid-template-columns: 1fr;
  }
  
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .section-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .cta-section {
    padding: 1.5rem;
  }
}

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

/* ===========================================
   About Page Styles
   =========================================== */

.about-page {
  max-width: 800px;
  margin: 0 auto;
}

.about-header {
  text-align: center;
  margin-bottom: 2rem;
}

.about-header h1 {
  margin-bottom: 0.5rem;
}

.about-header .tagline {
  color: var(--pico-muted-color);
  font-size: 1.25rem;
  font-style: italic;
  margin-bottom: 0;
}

.about-story,
.about-mission,
.about-contribute,
.about-features,
.about-contact {
  margin-bottom: 2.5rem;
}

.about-story h2,
.about-mission h2,
.about-contribute h2,
.about-features h2,
.about-contact h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  padding-bottom: 0.5rem;
}

.belief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.belief-card {
  padding: 1.25rem;
  background: var(--pico-card-background-color);
  border-radius: 0.75rem;
  border: 1px solid var(--pico-muted-border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.belief-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--pico-primary);
}

.belief-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

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

.about-features ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0;
}

.about-features ul li::marker {
  content: none;
}

.about-features li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
  line-height: 1.6;
}

.about-features li:first-child {
  padding-top: 0;
}

.about-features li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.about-thanks {
  text-align: center;
  padding: 2rem;
  background: var(--pico-card-background-color);
  border-radius: 1rem;
  margin-top: 2rem;
}

.thanks-note {
  font-style: italic;
  color: var(--pico-muted-color);
  font-size: 1.1rem;
  margin-bottom: 0;
}

/* ===========================================
   Embed Recipe Section
   =========================================== */
.embed-section {
  margin-top: 1rem;
}

.embed-section details summary {
  cursor: pointer;
  font-weight: 500;
}

.embed-section .embed-icon {
  margin-right: 0.5rem;
}

.embed-content {
  margin-top: 1rem;
}

.embed-code-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.embed-code-textarea {
  flex: 1;
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  padding: 0.75rem;
  border-radius: var(--border-radius);
  resize: none;
}

.copy-embed-btn {
  white-space: nowrap;
  align-self: stretch;
}

@media (max-width: 576px) {
  .embed-code-wrapper {
    flex-direction: column;
  }

  .embed-code-textarea {
    width: 100%;
  }

  .copy-embed-btn {
    width: 100%;
  }
}

/* ===========================================
   Admin Form Collapsible Sections
   =========================================== */

/* Style collapsible details/summary sections in admin forms */
details.admin-section {
  margin-bottom: 1rem;
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

details.admin-section > summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  background: var(--pico-card-background-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
}

details.admin-section > summary:hover {
  background: var(--pico-card-sectionning-background-color);
}

details.admin-section > summary::marker,
details.admin-section > summary::-webkit-details-marker {
  display: none;
}

details.admin-section > summary::after {
  content: "▶";
  font-size: 0.8rem;
  transition: transform 0.2s ease;
  color: var(--pico-muted-color);
}

details.admin-section[open] > summary::after {
  transform: rotate(90deg);
}

details.admin-section > summary strong {
  font-weight: inherit;
}

details.admin-section > div {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--pico-form-element-border-color);
}

/* Dark mode adjustments */
[data-theme="dark"] details.admin-section {
  border-color: var(--pico-form-element-border-color);
}

[data-theme="dark"] details.admin-section > summary {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] details.admin-section > summary:hover {
  background: rgba(255, 255, 255, 0.06);
}
