/* ==========================================================================
   1. GLOBAL SYSTEM ARCHITECTURE
   ========================================================================== */
.recipe-header-container { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.recipe-title-block { display: flex; flex-direction: column; gap: 12px; width: 100%; margin-bottom: 24px; box-sizing: border-box; }
.recipe-title-block h1 { margin: 0; font-size: 2.25rem; color: var(--color-text-dark); line-height: 1.2; font-weight: 700; }
.recipe-meta-tray { display: flex !important; gap: 12px !important; align-items: center !important; justify-content: flex-start !important; flex-wrap: wrap !important; width: 100%; }
.recipe-meta-tray .btn, .recipe-meta-tray .btn-action, .recipe-meta-tray button, .recipe-meta-tray a { flex: 0 0 auto !important; width: auto !important; white-space: nowrap !important; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.recipe-meta-author { font-size: 0.95rem; color: var(--color-text-muted); white-space: nowrap; }
.recipe-meta-author span { font-weight: 600; color: var(--color-text-dark); }
.recipe-meta-attribution-stack { display: flex; flex-direction: column; gap: 0.15rem; }
.recipe-meta-category { font-size: 0.88rem; opacity: 0.85; color: var(--text-muted, #6c757d); }
.recipe-meta-source { font-size: 0.88rem; opacity: 0.85; color: var(--text-muted, #6c757d); }
.recipe-control-widgets { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.widget-card-panel { background-color: var(--color-bg-card); padding: 12px 16px; border-radius: 8px; border: 1px solid var(--color-border); display: flex; align-items: center; gap: 10px; }
.widget-card-panel span, .widget-card-panel label { font-weight: 700; font-size: 0.9rem; color: var(--color-text-dark); margin: 0; }
.system-toggle-wrapper { display: flex; border: 1px solid var(--color-border-input, #ccc); border-radius: 6px; overflow: hidden; background-color: #f8f9fa; }
.system-toggle-btn { border: none; padding: 6px 14px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; }
.system-toggle-btn.active { font-weight: 700; background-color: var(--color-primary); color: white; }
.system-toggle-btn:not(.active) { font-weight: 600; background-color: transparent; color: var(--color-text-muted); }
.servings-input-spinner { width: 70px; padding: 6px; border-radius: 4px; border: 1px solid var(--color-border-input); font-weight: bold; text-align: center; }
.view-mode-tabs { display: flex; gap: 8px; margin-bottom: 30px; border-bottom: 2px solid var(--color-border); padding-bottom: 10px; }
.view-mode-tabs .tab-btn { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 1rem; transition: color 0.2s ease; }
.view-mode-tabs .tab-btn.active { font-weight: 700; color: var(--color-primary); border-bottom: 3px solid var(--color-primary); margin-bottom: -13px; }
.view-mode-tabs .tab-btn:not(.active) { font-weight: 600; color: var(--color-text-muted); }

.widget-card-panel.unified-control-bar {
    flex-wrap: wrap;
    gap: 12px 20px;
}

.control-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   2. REUSABLE CONTAINER PANELS & SUBHEADINGS
   ========================================================================== */
.recipe-view-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* Master Subheading Base Style */
.recipe-panel-heading {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.15rem;
    color: var(--color-text-dark);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
}

/* Shopping category adjustments using structural hierarchy */
.shopping-category-section .recipe-panel-heading {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 4px;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* Master Ingredient Block Panel */
.recipe-ingredient-card-panel {
    margin-bottom: 30px;
    padding: 24px;
    background-color: var(--color-bg-card);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-sizing: border-box;
}

/* Contextual modifier for small boxes embedded in step-by-step loops */
.recipe-ingredient-card-panel.step-modifier {
    margin-bottom: 0;
    padding: 12px 0 0 0;
    border-radius: 0;
    border: none;
    border-top: 1px dashed var(--color-border);
    background-color: transparent;
}

.step-ingredients-subheading {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
}

/* ==========================================================================
   3. INGREDIENT LIST TYPOGRAPHY CORES
   ========================================================================== */
.recipe-ingredient-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: square;
    color: var(--color-text-label);
    line-height: 1.8;
    font-size: 1rem;
}

/* List Style Variant: Normal item stacks */
.recipe-ingredient-list.standard-list-reset {
    list-style: none;
    padding: 0;
}

.recipe-ingredient-row {
    line-height: 1.8;
    transition: opacity 0.15s ease;
}

/* Row Modifier: Flex Layout for Interactive Checkout Views */
.recipe-ingredient-row.shopping-item-modifier {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

/* Inner Text Tokens */
.ingredient-name { font-weight: 600; }
.scalable-amount { font-weight: 700; }
.scalable-unit-name { font-weight: 400; }

.oz-package-preview {
    font-size: 0.85em;
    color: var(--color-text-muted, #6c757d);
    vertical-align: middle;
    display: inline-block;
    text-decoration: inherit;
    line-height: 1;
}

.crossed-out-text .oz-package-preview {
    text-decoration: line-through;
}

/* Uniform Note Presentation across all three loops */
.ingredient-note {
    font-style: italic;
    color: #626173;
    font-size: 0.9rem;
    font-weight: 400;
}

/* ==========================================================================
   4. CONTEXT-SPECIFIC PANELS
   ========================================================================== */
/* --- Shopping List view --- */
.shopping-category-section { margin-bottom: 24px; }
.shopping-item-content { display: flex; align-items: center; gap: 12px; flex: 2; cursor: pointer; }
.shopping-item-checkbox { width: 19px; height: 18px; cursor: pointer; accent-color: var(--color-primary); flex-shrink: 0; }
.pantry-owned-item { opacity: 0.75; }

.shopping-item-text {
    font-size: 1.05rem;
    color: var(--color-text-dark);
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 4px;
    transition: opacity 0.15s ease;
}

.shopping-item-text > span,
.shopping-item-text > strong {
    vertical-align: middle;
    line-height: 1.4;
}

.shopping-item-text.crossed-out-text {
    opacity: 0.55;
}

.shopping-item-text.crossed-out-text,
.shopping-item-text.crossed-out-text > span,
.shopping-item-text.crossed-out-text > strong {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

/* --- Overview view --- */
.recipe-description-container { margin-bottom: 24px; }
.recipe-description-text { font-size: 1.15rem; line-height: 1.6; font-style: italic; color: var(--color-text-muted); margin-bottom: 12px; margin-top: 0; }
.overview-steps-timeline { margin-bottom: 35px; padding: 0 24px; box-sizing: border-box; width: 100%; }
.overview-steps-timeline ol { padding-left: 20px; line-height: 1.75; color: var(--color-text-dark); font-size: 1.05rem; margin: 0; }
.overview-steps-timeline li { margin-bottom: 14px; padding-left: 6px; }

/* --- Prep View --- */
.step-card { border: 1px solid var(--color-border); padding: 24px; border-radius: 8px; margin-bottom: 24px; background-color: var(--color-bg-card); box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.step-card h3 { margin-top: 0; margin-bottom: 12px; color: var(--color-primary); font-size: 1.3rem; }
.step-instruction { font-size: 1.1rem; font-weight: 500; color: var(--color-text-dark); line-height: 1.6; margin-bottom: 16px; }

/* ==========================================================================
   5. UNIFIED CHEF NOTES FOOTER CARD
   ========================================================================== */
.chef-notes-footer-card {
    border: 1px solid var(--color-border);
    padding: 24px;
    border-radius: 8px;
    background-color: var(--color-bg-card);
    border-top: 4px solid #6c757d;
    margin-top: 24px;
    width: 100%;
    box-sizing: border-box;
}

.chef-notes-heading {
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--color-text-dark);
    font-size: 1.15rem;
}

.chef-notes-footer-text {
    margin: 0;
    line-height: 1.6;
    color: var(--color-text-label);
    font-style: italic;
}

/* ==========================================================================
   6. MULTI-COOKBOOK MODAL CHECKLIST & CSP-SAFE STATES
   ========================================================================== */
.shopping-note-input:disabled {
    opacity: 0.3;
}

.cookbook-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 0 20px 0;
    max-height: 280px;
    overflow-y: auto;
}

.cookbook-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background-color: var(--color-bg-body);
    cursor: pointer;
}

.cookbook-check-row:hover {
    background-color: var(--color-bg-hover, #f1f1f1);
}

.cookbook-check-title {
    flex: 1;
    font-weight: 600;
    color: var(--color-text-dark);
}

.recipe-meta-created,
.recipe-meta-cookbooks {
    font-size: 0.88rem;
    opacity: 0.9;
    color: var(--text-muted, #6c757d);
}

/* ==========================================================================
   7. TABULAR RECIPE NOTATION (TRN) MOBILE-FIRST SPLIT GRID
   ========================================================================== */
.trn-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.trn-header-row,
.trn-step-row {
    display: grid;
    grid-template-columns: minmax(130px, 38%) 1fr;
}

.trn-header-row {
    background-color: var(--color-bg-body, #f8f9fa);
    border-bottom: 2px solid var(--color-border);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.trn-col-head {
    padding: 10px 14px;
}

.trn-col-head:first-child {
    border-right: 1px solid var(--color-border);
}

.trn-step-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.trn-step-row {
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.trn-step-row:last-child {
    border-bottom: none;
}

.trn-step-row:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015);
}

.trn-step-row.is-step-done {
    opacity: 0.5;
    background-color: rgba(22, 163, 74, 0.05);
}

.trn-step-row.is-step-done .trn-action-text {
    text-decoration: line-through;
}

.trn-ingredients-cell {
    padding: 12px 14px;
    border-right: 1px solid var(--color-border);
    font-size: 0.95rem;
    line-height: 1.5;
}

.trn-ingredient-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trn-empty-ingredients {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.trn-action-cell {
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--color-text-dark);
}

.trn-step-badge {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.hide-cell {
    display: none !important;
}

.prep-mode-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.prep-toggle-wrapper {
    display: inline-flex;
    border: 1px solid var(--color-border-input, #ccc);
    border-radius: 6px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.prep-layout-btn {
    border: none;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prep-layout-btn.active {
    background-color: var(--color-primary);
    color: #ffffff;
    font-weight: 700;
}

.prep-layout-btn:not(.active) {
    background-color: transparent;
    color: var(--color-text-muted);
    font-weight: 600;
}


@media (max-width: 36rem) {
    .view-mode-tabs {
        overflow-x: auto;
        gap: 4px;
    }

    .view-mode-tabs .tab-btn {
        padding: 8px 12px;
        font-size: 0.92rem;
        white-space: nowrap;
    }

    .trn-header-row,
    .trn-step-row {
        grid-template-columns: minmax(112px, 42%) 1fr;
    }

    .trn-col-head,
    .trn-ingredients-cell,
    .trn-action-cell {
        padding: 10px 9px;
    }

    .trn-ingredients-cell {
        font-size: 0.88rem;
    }

    .trn-action-cell {
        font-size: 0.92rem;
        gap: 7px;
    }
}

/* ==========================================================================
   8. PRIVATE USER VERDICT TOGGLE & NOTES
   ========================================================================== */
.user-personal-recipe-box {
    margin: 20px 0 6px 0;
    padding: 12px 14px 14px 14px;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 640px;
    min-inline-size: 0;
    box-sizing: border-box;
}

.user-personal-legend {
    padding: 0 8px;
    margin-left: -4px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-dark);
}

.user-personal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.try-status-toggle-wrapper {
    display: inline-flex;
    border: 1px solid var(--color-border-input, #ccc);
    border-radius: 6px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.recipe-meta-tray .try-status-btn {
    border: none;
    border-right: 1px solid var(--color-border-input, #ccc);
    border-radius: 0;
    padding: 5px 12px;
    height: 30px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.recipe-meta-tray .try-status-btn:last-child {
    border-right: none;
}

.try-status-btn:not(.active) {
    background-color: transparent;
    color: var(--color-text-muted);
    font-weight: 600;
}

.try-status-btn.active.is-try-again {
    background-color: #16a34a;
    color: #ffffff;
    font-weight: 700;
}

.try-status-btn.active.is-havent-tried {
    background-color: var(--color-primary);
    color: #ffffff;
    font-weight: 700;
}

.try-status-btn.active.is-not-again {
    background-color: #dc2626;
    color: #ffffff;
    font-weight: 700;
}

.personal-note-status {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.personal-note-status.is-saved {
    color: #16a34a;
}

.personal-note-status.is-error {
    color: #dc2626;
}

.user-personal-note-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-personal-note-label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.user-private-note-textarea {
    width: 100%;
    height: 76px;
    min-height: 76px;
    max-height: 240px;
    field-sizing: fixed;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--color-border-input, #ccc);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--color-text-dark);
    background-color: var(--color-bg-body, #ffffff);
    resize: vertical;
    overflow-y: auto;
    transition: border-color 0.15s ease;
}

.user-private-note-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    height: 76px;
}
