:root, [data-theme="light"] {
    --bg-primary: #faf8f5;
    --bg-secondary: #f0ebe4;
    --bg-card: #ffffff;
    --text-primary: #3d3428;
    --text-secondary: #6b5d4d;
    --text-muted: #9a8b7a;
    --accent: #5d4a2f;
    --accent-hover: #7a6340;
    --border: #e0d8cc;
    --shadow: rgba(61, 52, 40, 0.15);
    --keto: #5a7d4a;
    --diabetic: #4a6b8a;
    --celiac: #8a6b4a;
    --vegan: #4a8a5a;
    --vegetarian: #6a8a4a;
    --warning: #a68040;
}

[data-theme="dark"] {
    --bg-primary: #1c1916;
    --bg-secondary: #262220;
    --bg-card: #2e2926;
    --text-primary: #f5f0e6;
    --text-secondary: #b8a99a;
    --text-muted: #7a6f64;
    --accent: #c9a86c;
    --accent-hover: #ddb87a;
    --border: #3d3632;
    --shadow: rgba(0, 0, 0, 0.5);
    --keto: #7a9e6a;
    --diabetic: #6a8fb8;
    --celiac: #b08a6a;
    --vegan: #6ab07a;
    --vegetarian: #8ab06a;
    --warning: #c9a86c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--border) var(--bg-primary); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg-primary); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.hidden { display: none !important; }
.icon { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

/* Reusable input style */
.input-inset, .search-input, .simple-textarea,
.form-group input, .form-group select, .form-group textarea,
.builder-input input, .builder-input textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-top-color: var(--text-muted);
    border-left-color: var(--text-muted);
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}

.search-input:focus, .simple-textarea:focus,
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.builder-input input:focus, .builder-input textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.search-input::placeholder, .simple-textarea::placeholder,
.form-group input::placeholder, .form-group textarea::placeholder,
.builder-input input::placeholder, .builder-input textarea::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    padding: 0.875rem 2rem;
    background: var(--accent);
    color: var(--bg-card);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s ease;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    padding: 0.875rem 2rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }

/* Badge system - unified */
.badge, .popup-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 2px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}
.popup-badge { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.badge-keto, .popup-badge-keto { background: rgba(126, 184, 126, 0.15); color: var(--keto); }
.badge-diabetic, .popup-badge-diabetic { background: rgba(107, 155, 209, 0.15); color: var(--diabetic); }
.badge-celiac, .popup-badge-celiac { background: rgba(176, 138, 106, 0.15); color: var(--celiac); }
.badge-vegan, .popup-badge-vegan { background: rgba(106, 176, 122, 0.15); color: var(--vegan); }
.badge-vegetarian, .popup-badge-vegetarian { background: rgba(138, 176, 106, 0.15); color: var(--vegetarian); }
.badge-warning { background: rgba(212, 160, 84, 0.15); color: var(--warning); }
.badge-safe { background: rgba(93, 168, 120, 0.15); color: var(--keto); }

/* Layout */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}
.clear-btn:hover { color: var(--accent); }

.search-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.search-input { padding: 0.6rem 0.75rem; font-size: 0.9rem; }

.filter-section { margin-bottom: 1rem; }
.filter-section h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.filter-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    user-select: none;
}
.filter-toggle::after {
    content: '';
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform 0.2s ease;
}
.filter-section:not(.collapsed) .filter-toggle::after { transform: rotate(180deg); }
.filter-section.collapsed .filter-group { display: none; }

.filter-group { display: flex; flex-direction: column; gap: 0.5rem; }

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.filter-checkbox:hover { color: var(--text-primary); }
.filter-checkbox input { accent-color: var(--accent); width: 14px; height: 14px; }

.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 900px;
    margin-left: calc(260px + ((100vw - 260px - 900px) / 2));
    margin-right: auto;
}

header { position: relative; margin-bottom: 2rem; }

.logo-bg {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 300px;
    background: url('../images/ashworth_eats.png') center/contain no-repeat;
}
[data-theme="dark"] .logo-bg { background-image: url('../images/ashworth_eats_dark.png'); }
.logo-spacer { height: 185px; }

.recipe-count { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Recipe Groups */
.recipe-group { margin-bottom: 2rem; }
.recipe-group-header {
    font-size: 1rem;
    font-weight: 400;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.recipe-group-header::after {
    content: '';
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--accent);
    transition: transform 0.2s ease;
}
.recipe-group:not(.collapsed) .recipe-group-header::after { transform: rotate(180deg); }
.recipe-group.collapsed .recipes-grid { display: none; }

.recipes-grid { position: relative; display: flex; flex-direction: column; gap: 2px; }

.recipe-card {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    gap: 0.5rem;
}
.recipe-card:hover { background: var(--bg-secondary); border-left-color: var(--accent); }
.recipe-card.filtered-out { display: none; }

.recipe-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
.recipe-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
    opacity: 0.5;
    transition: all 0.15s ease;
}
.recipe-action-btn:hover, .recipe-action-btn.active { opacity: 1; }
.recipe-action-btn.favorite-btn.active { color: #e25555; }
.recipe-action-btn.made-btn.active { color: var(--keto); }
.recipe-action-btn.trylater-btn.active { color: #5b9bd5; }

.recipe-title { color: var(--text-primary); font-size: 0.95rem; flex: 1; }

.recipe-indicators { display: flex; gap: 0.5rem; flex-shrink: 0; margin-left: 1rem; }
.indicator { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
.indicator .icon { width: 16px; height: 16px; }
.indicator-keto { color: var(--keto); }
.indicator-diabetic { color: var(--diabetic); }
.indicator-celiac { color: var(--celiac); }
.indicator-vegan { color: var(--vegan); }
.indicator-vegetarian { color: var(--vegetarian); }
.indicator-warning { color: var(--warning); }
.indicator-safe { color: var(--keto); }
.indicator-pending { color: #f59e0b; }

.preview-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: 0.5rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.preview-btn:hover {
    color: var(--accent);
    background: var(--bg-secondary);
}
.preview-btn .icon { width: 18px; height: 18px; }

/* Tip Cards */
.tip-card { background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary)); border-left-color: var(--accent); }
.tip-card:hover { border-left-color: var(--keto); }
.tip-icon { color: var(--accent); font-size: 1.1rem; flex-shrink: 0; }

/* Popup Card */
.recipe-popup {
    position: fixed;
    z-index: 100;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px var(--shadow);
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    pointer-events: none;
}
.recipe-popup.visible { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; cursor: pointer; }

.popup-header { font-size: 1.1rem; font-weight: 500; color: var(--accent); margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.popup-description { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.75rem; line-height: 1.5; }
.popup-section { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.popup-tag { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8rem; color: var(--text-secondary); background: var(--bg-secondary); padding: 0.2rem 0.5rem; border-radius: 2px; }
.popup-tag .icon, .popup-badge .icon { width: 12px; height: 12px; }
.popup-meta { font-size: 0.8rem; color: var(--text-muted); }
.popup-warning { font-size: 0.8rem; color: var(--warning); background: rgba(212, 160, 84, 0.1); padding: 0.4rem 0.6rem; border-radius: 2px; }
.popup-safe { font-size: 0.8rem; color: var(--keto); background: rgba(93, 168, 120, 0.1); padding: 0.4rem 0.6rem; border-radius: 2px; }
.popup-nutrition { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0.5rem 0; }
.popup-nutrition .nutrition-item { font-size: 0.75rem; color: var(--text-secondary); }
.popup-footer { display: flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.popup-footer .icon { width: 12px; height: 12px; }
.popup-hint { font-size: 0.7rem; color: var(--text-muted); text-align: center; margin-top: 0.75rem; font-style: italic; }

/* Recipe Detail */
.recipe-detail { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.back-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

.detail-title { background: var(--bg-card); padding: 1.5rem; margin-bottom: 1rem; }
.detail-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.detail-title h1 { color: var(--accent); font-weight: 400; font-size: 1.8rem; margin: 0; }
.detail-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.detail-actions .recipe-action-btn { width: 32px; height: 32px; }
.detail-actions .recipe-action-btn .icon { width: 20px; height: 20px; }
.detail-description { color: var(--text-secondary); font-size: 0.95rem; margin: 0.5rem 0 0 0; font-style: italic; }

.detail-meta { background: var(--bg-card); padding: 1.25rem; margin-bottom: 1.5rem; border-left: 3px solid var(--accent); }
.detail-badges { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.detail-info { display: flex; flex-wrap: wrap; gap: 1.5rem; }

.detail-nutrition { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.nutrition-label { font-size: 0.85rem; color: var(--text-muted); margin-right: 0.5rem; }
.nutrition-item { font-size: 0.9rem; color: var(--text-secondary); }
.nutrition-item strong { color: var(--accent); }
.meta-item { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; color: var(--text-secondary); }

/* Recipe Content */
#recipe-content { background: var(--bg-card); padding: 2rem; border-radius: 2px; }
#recipe-content > *:first-child { margin-top: 0; }
#recipe-content h1 { color: var(--accent); font-weight: 400; font-size: 2rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
#recipe-content h2 { color: var(--text-primary); font-weight: 400; font-size: 1.3rem; margin: 2rem 0 1rem; text-transform: uppercase; letter-spacing: 0.1em; }
#recipe-content h3 { color: var(--text-secondary); font-weight: 400; font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }
#recipe-content p { margin-bottom: 1rem; color: var(--text-secondary); }
#recipe-content ul, #recipe-content ol { margin: 1rem 0 1rem 1.5rem; color: var(--text-secondary); }
#recipe-content li { margin-bottom: 0.5rem; }
#recipe-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
#recipe-content strong { color: var(--text-primary); }
#recipe-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
#recipe-content th, #recipe-content td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
#recipe-content th { color: var(--text-primary); font-weight: 500; }
#recipe-content td { color: var(--text-secondary); }

/* Fixed image (recipe detail & upload) */
.recipe-image-fixed, .image-upload-fixed {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
    z-index: 10;
}
.recipe-image-fixed img { width: 100%; height: auto; border-radius: 4px; box-shadow: 0 8px 24px var(--shadow); }
.image-ai-note { position: absolute; bottom: -1.5rem; left: 0; right: 0; font-size: 0.7rem; color: var(--text-muted); text-align: center; font-style: italic; }

/* Author's Notes */
.author-notes {
    position: relative;
    background: var(--bg-secondary);
    padding: 2rem 2rem 1.5rem 3.5rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    border-left: 3px solid var(--accent);
}
.author-notes .quote-mark { position: absolute; top: 0.5rem; left: 0.75rem; font-size: 4rem; font-family: Georgia, serif; color: var(--accent); opacity: 0.3; line-height: 1; }
.author-notes-text { font-style: italic; color: var(--text-secondary); }
.author-notes-text p { margin-bottom: 0.75rem; }
.author-notes-text p:last-child { margin-bottom: 0; }
.author-notes-attribution { text-align: right; margin-top: 1rem; font-style: normal; font-weight: 500; color: var(--text-primary); }

.tip-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--text-muted); }
.tip-link:hover { border-bottom-color: var(--accent); }

.endnote { scroll-margin-top: 2rem; }
.endnote + .endnote { border-top: 1px solid var(--border); }

footer { text-align: center; padding: 2rem 0; margin-top: 3rem; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 0.85rem; }
.loading { text-align: center; padding: 2rem; color: var(--text-secondary); }
.error { background: #3d2a2a; border-left: 3px solid #c75050; padding: 1rem; color: #e8a0a0; }
.no-results { text-align: center; padding: 3rem; color: var(--text-muted); }

/* Site Menu */
.site-menu { position: fixed; top: 1rem; right: 1rem; z-index: 1000; display: flex; align-items: center; gap: 0.5rem; }

.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.2s ease;
}
.hamburger-btn:hover { border-color: var(--accent); }
.hamburger-btn span { display: block; width: 100%; height: 2px; background: var(--text-secondary); transition: all 0.2s ease; }
.hamburger-btn:hover span { background: var(--accent); }

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}
.menu-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.menu-section { padding: 0.75rem; }
.menu-section h4 { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.menu-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; cursor: pointer; font-size: 0.85rem; color: var(--text-secondary); transition: color 0.15s ease; }
.menu-option:hover { color: var(--text-primary); }
.menu-option input { accent-color: var(--accent); }

.copyright-link { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.copyright-link:hover { color: var(--accent); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.modal-content { position: relative; background: var(--bg-card); padding: 2rem; max-width: 480px; width: 90%; border: 1px solid var(--border); box-shadow: 0 8px 32px var(--shadow); }
.modal-content h3 { color: var(--accent); font-weight: 400; font-size: 1.2rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.modal-content p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.75rem; line-height: 1.6; }

.alert-buttons { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.modal-close-btn, .modal-cancel-btn { background: var(--accent); color: var(--bg-card); border: none; padding: 0.5rem 1.5rem; cursor: pointer; font-size: 0.9rem; transition: background 0.2s ease; }
.modal-close-btn:hover { background: var(--accent-hover); }
.modal-cancel-btn { background: var(--text-muted); }
.modal-cancel-btn:hover { background: var(--text-secondary); }

.alert-modal-content { text-align: center; min-width: 320px; max-width: 420px; }
.alert-icon { font-size: 3rem; margin-bottom: 1rem; line-height: 1; }
.alert-modal-content h3 { border-bottom: none; padding-bottom: 0.5rem; margin-bottom: 0.5rem; }
.alert-modal-content p { margin-bottom: 1.5rem; }
.alert-modal-content.alert-success .alert-icon::before { content: "OK"; color: #22c55e; }
.alert-modal-content.alert-success h3 { color: #22c55e; }
.alert-modal-content.alert-error .alert-icon::before { content: "X"; color: #ef4444; }
.alert-modal-content.alert-error h3 { color: #ef4444; }
.alert-modal-content.alert-warning .alert-icon::before { content: "!"; color: #f59e0b; }
.alert-modal-content.alert-warning h3 { color: #f59e0b; }

/* Submit Form */
.submit-recipe-btn { width: 60%; margin-left: 1rem; padding: 0.375rem 0.5rem; background: var(--accent); color: var(--bg-card); border: none; cursor: pointer; font-size: 0.8rem; font-weight: 500; transition: background 0.2s ease; }
.submit-recipe-btn:hover { background: var(--accent-hover); }

.image-upload-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1024 / 1536;
    border: 2px dashed var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    overflow: hidden;
}
.image-upload-area:hover, .image-upload-area.drag-over { border-color: var(--accent); background: var(--bg-card); }
.upload-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; }
.upload-icon { font-size: 3rem; color: var(--text-muted); line-height: 1; }
.upload-placeholder p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.image-preview { width: 100%; height: 100%; object-fit: cover; }
.image-preview:not(.hidden) + .upload-placeholder, .image-preview:not(.hidden) ~ .upload-placeholder { display: none; }
.remove-image-btn { position: absolute; top: 0.5rem; right: 0.5rem; width: 28px; height: 28px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: white; border: none; cursor: pointer; font-size: 1.2rem; line-height: 1; display: none; align-items: center; justify-content: center; transition: background 0.2s ease; }
.remove-image-btn:not(.hidden) { display: flex; }
.remove-image-btn:hover { background: rgba(197, 48, 48, 0.9); }

.recipe-submit { max-width: 800px; margin: 0 auto; padding: 2rem; }
.submit-header { text-align: center; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.submit-header h1 { color: var(--accent); font-weight: 400; font-size: 2rem; margin-bottom: 0.5rem; }
.submit-header p { color: var(--text-secondary); font-size: 1rem; }

.mode-toggle { display: flex; justify-content: center; gap: 0; margin-top: 1.5rem; }
.mode-btn { padding: 0.625rem 1.5rem; background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border); cursor: pointer; font-size: 0.9rem; transition: all 0.2s ease; }
.mode-btn:first-child { border-radius: 4px 0 0 4px; border-right: none; }
.mode-btn:last-child { border-radius: 0 4px 4px 0; }
.mode-btn:hover { background: var(--bg-card); }
.mode-btn.active { background: var(--accent); color: var(--bg-card); border-color: var(--accent); }

.simple-mode, .auth-view { max-width: 800px; margin: 0 auto; }

.simple-mode-intro, .advanced-mode-intro {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.simple-mode-intro p, .advanced-mode-intro p { color: var(--text-secondary); margin: 0 0 0.75rem 0; line-height: 1.6; }
.simple-mode-intro p:last-child, .advanced-mode-intro p:last-child { margin-bottom: 0; }
.simple-note, .advanced-note { font-size: 0.9rem; color: var(--text-muted); font-style: italic; }

.simple-user-info { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.simple-user-info .form-group { flex: 1; }
.simple-textarea { min-height: 400px; padding: 1.25rem; font-size: 1rem; line-height: 1.6; resize: vertical; margin-bottom: 1.5rem; }

.recipe-form { display: flex; flex-direction: column; gap: 2rem; }
.form-section { background: var(--bg-card); padding: 1.5rem; border: 1px solid var(--border); }
.form-section h2 { color: var(--text-primary); font-weight: 500; font-size: 1.1rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.form-row:last-child { margin-bottom: 0; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.form-group.full-width { flex-basis: 100%; }
.form-group label { color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; }
.label-note { font-weight: 400; font-style: italic; color: var(--text-muted); }

/* Chip Input */
.chip-input { display: flex; flex-direction: column; gap: 0.5rem; }
.chip-container { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 32px; }
.chip-container:empty::before { content: 'None selected'; color: var(--text-muted); font-style: italic; font-size: 0.85rem; }
.chip { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.5rem 0.375rem 0.75rem; background: var(--accent); color: var(--bg-card); border-radius: 100px; font-size: 0.8rem; font-weight: 500; }
.chip-remove { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; background: rgba(255, 255, 255, 0.2); border: none; border-radius: 50%; color: inherit; cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 0; transition: background 0.2s ease; }
.chip-remove:hover { background: rgba(255, 255, 255, 0.4); }
.chip-select { padding: 0.5rem; background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); font-size: 0.9rem; cursor: pointer; max-width: 200px; }
.chip-select:focus { outline: none; border-color: var(--accent); }

/* List Builder */
.list-builder { display: flex; flex-direction: column; gap: 1rem; }
.builder-list { display: flex; flex-direction: column; gap: 0.5rem; }
.builder-list:empty::before { content: 'No items added yet'; color: var(--text-muted); font-style: italic; font-size: 0.9rem; padding: 1rem; text-align: center; background: var(--bg-secondary); border: 1px dashed var(--border); }
.builder-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem; background: var(--bg-secondary); border: 1px solid var(--border); }
.builder-item .item-number { color: var(--accent); font-weight: 600; min-width: 24px; }
.builder-item .item-text { flex: 1; color: var(--text-secondary); line-height: 1.5; }
.builder-item .remove-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.25rem; font-size: 1.2rem; line-height: 1; opacity: 0.6; transition: opacity 0.2s ease, color 0.2s ease; }
.builder-item .remove-btn:hover { opacity: 1; color: #c53030; }
.builder-input { display: flex; gap: 0.75rem; align-items: flex-start; }
.builder-input input, .builder-input textarea { flex: 1; }
.add-btn { padding: 0.75rem 1.25rem; background: var(--accent); color: var(--bg-card); border: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; white-space: nowrap; transition: background 0.2s ease; }
.add-btn:hover { background: var(--accent-hover); }

.form-actions { display: flex; justify-content: flex-end; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Print */
.print-btn { width: 32px; height: 28px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 3px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; color: var(--text-secondary); transition: border-color 0.2s ease, color 0.2s ease; }
.print-btn:hover { border-color: var(--accent); color: var(--accent); }
.print-btn.hidden { display: none; }
#print-card { display: none; }

/* User Link */
.user-link { display: flex; align-items: center; padding: 0.375rem 0.75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 3px; color: var(--text-primary); text-decoration: none; font-size: 0.875rem; transition: all 0.2s ease; white-space: nowrap; }
.user-link:hover { border-color: var(--accent); color: var(--accent); }
.user-link.logged-in { background: var(--accent); border-color: var(--accent); color: var(--bg-card); }
.user-link.logged-in:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Auth */
.auth-view { max-width: 400px; padding: 2rem; }
.auth-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 2rem; }
.auth-form-container h1 { font-size: 1.5rem; color: var(--text-primary); margin-bottom: 1.5rem; text-align: center; }
.auth-form .form-group { margin-bottom: 1rem; }
.auth-form label { display: block; font-weight: 500; margin-bottom: 0.375rem; color: var(--text-primary); }
.auth-form input { padding: 0.625rem 0.75rem; border-radius: 4px; }
.auth-form small { display: block; color: var(--text-muted); font-size: 0.75rem; margin-top: 0.25rem; }
.auth-form .form-actions { margin-top: 1.5rem; }
.auth-form .btn-primary { width: 100%; }
.auth-error { background: #ffebee; border: 1px solid #ef9a9a; color: #c62828; padding: 0.75rem; border-radius: 4px; margin-top: 1rem; font-size: 0.875rem; }
[data-theme="dark"] .auth-error { background: #3d2020; border-color: #6d3030; color: #ef9a9a; }
.auth-switch { text-align: center; margin-top: 1.5rem; color: var(--text-secondary); font-size: 0.875rem; }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.logged-in-message { text-align: center; color: var(--text-secondary); margin-bottom: 1.5rem; }
.logged-in-message strong { color: var(--text-primary); }
#logged-in-container .form-actions { text-align: center; }
#logged-in-container .btn-secondary { display: inline-block; }

/* Responsive */
@media (max-width: 1500px) { .recipe-image-fixed, .image-upload-fixed { width: 300px; } }
@media (max-width: 1300px) { .recipe-image-fixed, .image-upload-fixed { position: static; transform: none; width: 100%; max-width: 400px; margin: 0 auto 1.5rem auto; } }
@media (max-width: 1160px) { .main-content { margin-left: calc(260px + 2rem); } }
@media (max-width: 900px) { .sidebar { width: 220px; } .main-content { margin-left: calc(220px + 2rem); padding: 1.5rem; } }
@media (max-width: 700px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
    .main-content { margin-left: 0; padding: 1rem; }
    .logo-bg { width: 420px; height: 210px; }
    .logo-spacer { height: 180px; }
    .recipe-popup { width: calc(100vw - 2rem); left: 1rem !important; }
    #recipe-content { padding: 1.25rem; }
}
@media (max-width: 600px) {
    .recipe-submit { padding: 1rem; }
    .form-row, .builder-input { flex-direction: column; }
    .add-btn, .btn-primary, .btn-secondary { width: 100%; }
    .form-actions { flex-direction: column-reverse; }
}

/* Print */
@media print {
    @page { size: 6in 4in landscape; margin: 0.25in; }
    body > *:not(#print-card) { display: none !important; }
    #print-card { display: block !important; position: absolute; left: 0.1in; top: 0.1in; width: 5.5in; height: 3.5in; border: 1px solid #000; padding: 0.08in; font-family: Georgia, serif; font-size: 6.75pt; line-height: 1.2; color: #000; background: #fff; overflow: hidden; }
    .print-header-table { width: 100%; border-collapse: collapse; margin-bottom: 0.05in; }
    .print-header-table td { border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; padding: 0.02in 0.06in; vertical-align: middle; }
    .print-header-table td:first-child { border-left: 3px solid #333; }
    .print-title { font-size: 9pt; font-weight: bold; }
    .print-meta { font-size: 6pt; color: #666; text-align: right; white-space: nowrap; }
    .print-content-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
    .print-content-table td { vertical-align: top; padding: 0.03in; border-right: 1px solid #ccc; overflow: hidden; }
    .print-content-table td:last-child { border-right: none; }
    .print-col-image { width: 1.2in; }
    .print-col-ingredients { width: 1.85in; }
    .print-col-method { width: auto; }
    .print-card-image { width: 100%; max-height: 1.5in; border-radius: 4px; object-fit: contain; }
    .print-content-table ul, .print-content-table ol { margin: 0; padding-left: 0.12in; }
    .print-content-table li { margin-bottom: 1pt; }
}
