/* Recipe Page Styles - Simple & Theme-adaptive */
.recipe-page {
    --recipe-border: var(--card-border, #e0e0e0);
    --recipe-bg: var(--card-background, #fff);
    --recipe-text: var(--body-text-color, #333);
    --recipe-text-muted: var(--body-text-color-secondary, #666);
}

/* Recipe header with overlay */
.recipe-page .recipe-header {
    position: relative;
    margin-bottom: 2rem;
}

.recipe-page .recipe-hero {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.recipe-page .recipe-hero img {
    width: 100% !important;
    height: 400px !important;
    object-fit: cover !important;
    display: block !important;
}

.recipe-page .recipe-overlay {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: linear-gradient(transparent, rgba(0,0,0,0.7)) !important;
    color: white !important;
    padding: 3rem 2rem 2rem !important;
    margin: 0 !important;
}

.recipe-page .recipe-overlay .article-title {
    margin: 0 0 0.5rem 0 !important;
    font-size: 2.5rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

.recipe-page .recipe-overlay .article-title a {
    color: white !important;
    text-decoration: none !important;
}

.recipe-page .recipe-overlay .article-subtitle {
    margin: 0 !important;
    font-size: 1.4rem !important;
    font-weight: 400 !important;
    opacity: 0.9 !important;
    line-height: 1.4 !important;
    color: white !important;
}

.recipe-page .recipe-overlay .article-time {
    margin: 0 !important;
    opacity: 0.8 !important;
    font-size: 0.9rem !important;
    color: white !important;
    position: absolute !important;
    bottom: 2rem !important;
    right: 2rem !important;
}

.recipe-page .recipe-overlay .article-time div {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

@media (max-width: 768px) {
    .recipe-page .recipe-hero img {
        height: 300px !important;
    }

    .recipe-page .recipe-overlay {
        padding: 2rem 1.5rem 1.5rem !important;
    }

    .recipe-page .recipe-overlay .article-title {
        font-size: 2rem !important;
    }

    .recipe-page .recipe-overlay .article-subtitle {
        font-size: 1.2rem !important;
    }

    .recipe-page .recipe-overlay .article-time {
        bottom: 1.5rem !important;
        right: 1.5rem !important;
    }
}

/* Dark theme support */
[data-scheme="dark"] .recipe-page {
    --recipe-border: var(--card-border, #3a3a3a);
    --recipe-bg: var(--card-background, #2a2a2a);
    --recipe-text: var(--body-text-color, #e0e0e0);
    --recipe-text-muted: var(--body-text-color-secondary, #aaa);
}

/* Ingredients List */

/* Ingredients from front matter */
.recipe-ingredients {
    padding: 0;
    margin: 2rem 0;
}

.ingredient-category {
    flex: 1;
    min-width: 0;
}


/* Override any default border styling */
.recipe-page h2,
.recipe-page h3,
.recipe-page .category-title {
    border: none !important;
    border-left: none !important;
    border-right: none !important;
    position: relative;
}

.recipe-page h2::before,
.recipe-page h3::before,
.recipe-page .category-title::before {
    display: none !important;
}

.category-title {
    font-size: inherit;
    font-weight: 600;
    color: var(--recipe-text);
    margin: 0 0 0.75rem 0;
    padding: 0.5rem 0.75rem;
    text-align: left;
    background: #f5f5f5;
    border-radius: 4px;
    position: static;
}

[data-scheme="dark"] .category-title {
    background: #3a3a3a;
}

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

/* Two-column layout for larger screens */
@media (min-width: 768px) {
    .recipe-ingredients {
        display: block;
    }

    .recipe-ingredients h2 {
        margin-bottom: 1rem;
    }

    .ingredient-category {
        display: inline-block;
        width: 45%;
        vertical-align: top;
        margin-right: 5%;
    }

    .ingredient-category:last-child {
        margin-right: 0;
    }
}

.ingredient-item {
    margin: 0.5rem 0;
    padding: 0.5rem 0;
}

.ingredients-list {
    padding-left: 0;
    margin-left: 0;
}

.ingredient-item:hover {
    background: var(--card-background-selected, rgba(0,0,0,0.03));
}

[data-scheme="dark"] .ingredient-item:hover {
    background: var(--card-background-selected, rgba(255,255,255,0.03));
}

.ingredient-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: static;
    font-size: inherit;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px dotted var(--recipe-border);
}

.ingredient-checkbox:last-child {
    border-bottom: none;
}

.ingredient-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    cursor: pointer;
}

.checkmark {
    height: 18px;
    width: 18px;
    background-color: var(--recipe-bg);
    border: 2px solid var(--recipe-text-muted);
    border-radius: 3px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

[data-scheme="dark"] .checkmark {
    border: 2px solid var(--recipe-text-muted);
}

.ingredient-checkbox input[type="checkbox"]:checked ~ .checkmark {
    background-color: var(--accent-color, #4caf50);
    border-color: var(--accent-color, #4caf50);
}

.ingredient-checkbox input[type="checkbox"]:checked ~ .checkmark:after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ingredient-checkbox input[type="checkbox"]:checked ~ .ingredient-name {
    text-decoration: line-through;
    color: var(--recipe-text-muted);
}

.ingredient-name {
    flex: 1;
    transition: all 0.2s;
}

.ingredient-amount {
    color: var(--recipe-text-muted);
    font-weight: 500;
    margin-left: auto;
    flex-shrink: 0;
}

/* Steps styling for ordered lists */
.recipe-page .article-content ol {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
}

.recipe-page .article-content ol li {
    counter-increment: step-counter;
    margin: 1.5rem 0;
    padding: 0 0 0 3rem;
    position: relative;
    line-height: 1.6;
}

.recipe-page .article-content > ol > li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0.5rem;
    background: var(--accent-color, var(--recipe-text));
    color: var(--recipe-bg);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

/* 嵌套列表样式调整 */
.recipe-page .article-content ol li ul li,
.recipe-page .article-content ol li ol li {
    padding-left: 0;
    margin: 0.25rem 0;
}

.recipe-page .article-content ol li ul li::before,
.recipe-page .article-content ol li ol li::before {
    display: none;
}

.recipe-page .article-content ol li p {
    margin: 0.25rem 0;
}

.recipe-page .article-content ol li strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--recipe-text);
}

/* Step images */
.recipe-page .article-content ol li img {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 8px;
    margin: 0.75rem 0;
    display: block;
}

/* Step notes/tips styling - auto detect italic paragraphs in steps */
.recipe-page .article-content ol li p em {
    display: block !important;
    font-size: 1.5rem !important;
    color: #999 !important;
    font-style: italic !important;
    margin: 0.3rem 0 !important;
}

.recipe-page .article-content ol li p em::before {
    content: "* ";
    color: #999;
}

[data-scheme="dark"] .recipe-page .article-content ol li p em {
    color: #aaa !important;
}

[data-scheme="dark"] .recipe-page .article-content ol li p em::before {
    color: #aaa;
}

/* Tips section and blockquotes */
.recipe-page .article-content h2:contains("小贴士") + p,
.recipe-page .article-content h2:contains("来源") + p,
.recipe-page .article-content blockquote {
    background: var(--recipe-bg);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 4px solid var(--accent-color, var(--recipe-text-muted));
}

.recipe-page .article-content blockquote p {
    margin: 0.5rem 0;
}

.recipe-page .article-content blockquote a {
    color: var(--accent-color, var(--recipe-text));
    text-decoration: none;
}

.recipe-page .article-content blockquote a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .recipe-ingredients,
    .recipe-tips {
        padding: 1rem;
    }

    .recipe-page .article-content ol li {
        padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    }

    .recipe-page .article-content > ol > li::before {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.75rem;
        left: 0.5rem;
        top: 0.75rem;
    }
}

@media (max-width: 480px) {
    .ingredient-checkbox {
        font-size: inherit;
        padding: 0.75rem;
    }

    .ingredient-name {
        font-size: inherit;
    }

    .ingredient-amount {
        font-size: inherit;
    }
}