/* ============================================
   Cooking Protocol - Print Stylesheet (A4 Optimized)
   بهینه‌سازی شده برای چاپ روی یک صفحه A4
   ساختار شبیه کتابچه دستورهای آشپزی
   ============================================ */

/* اطمینان از چاپ رنگ‌ها و تصاویر در تمام مرورگرها */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* تنظیمات صفحه A4 - فقط در حالت چاپ واقعی */
@media print {
    @page {
        size: A4 portrait;
        margin: 15mm 15mm 18mm 15mm;
        @top-center {
            content: "Calorito | Clinical Nutriple";
            font-family: "Vazirmatn", "Tahoma", sans-serif;
            font-size: 7pt;
            color: #999;
        }
        @bottom-left {
            content: counter(page);
            font-family: "Tahoma", sans-serif;
            font-size: 9pt;
            color: #d63638;
            font-weight: 700;
        }
        @bottom-right {
            content: "Calorito | Clinical Nutriple";
            font-family: "Vazirmatn", "Tahoma", sans-serif;
            font-size: 7pt;
            color: #999;
        }
    }

    /* ============================================
       مخفی کردن عناصر غیرضروری هنگام چاپ
       ============================================ */
    body * {
        visibility: hidden;
    }

    .cpfp-single-recipe,
    .cpfp-single-recipe * {
        visibility: visible;
    }

    /* مخفی کردن کامل عناصر غیرضروری */
    .cpfp-print-bar,
    .cpfp-print-btn,
    .cpfp-back-link,
    header,
    footer,
    .site-header,
    .site-footer,
    .sidebar,
    .widget,
    nav,
    .navigation,
    .menu,
    .nav-menu,
    #wpadminbar,
    .wpadminbar,
    .comments-area,
    .comment-respond,
    .cpfp-credit-icon,
    .cpfp-app-header,
    .cpfp-recipes-app,
    .cpfp-recipes-grid,
    .cpfp-no-results,
    .cpfp-loading,
    .cpfp-load-more-wrap,
    .cpfp-filters-wrap,
    .cpfp-search-box,
    .cpfp-results-info,
    /* مخفی کردن breadcrumb و نویگیتور */
    .breadcrumb,
    .breadcrumbs,
    .breadcrumb-trail,
    .breadcrumb-area,
    .nav-breadcrumb,
    .breadcrumb-nav,
    .yoast-breadcrumb,
    .yoast-breadcrumbs,
    .rank-math-breadcrumb,
    .rank-math-breadcrumbs,
    .breadcrumbs-area,
    .breadcrumb-wrapper,
    .breadcrumb-container,
    .navx,
    .nav-header,
    .header-nav,
    .site-breadcrumb,
    .breadcrumbs-wrapper,
    .path,
    .breadcrumb-list,
    .navi,
    .nav-wrap,
    .top-bar,
    .topbar,
    .header-top,
    .page-header,
    .entry-header,
    .entry-meta,
    .post-meta,
    .post-thumbnail,
    .cat-links,
    .tags-links,
    .entry-footer,
    .post-navigation,
    .pagination,
    .screen-reader-text {
        display: none !important;
    }

    /* مخفی کردن همه nav و header که ممکن است breadcrumb باشند */
    body > nav,
    body > header,
    .site > header,
    .site > nav,
    #header,
    #nav,
    #navigation,
    #breadcrumb,
    #breadcrumbs {
        display: none !important;
    }

    /* ============================================
       تنظیمات بدنه - مطابق کتابچه
       ============================================ */
    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        font-family: "Vazirmatn", "Tahoma", "IRANSans", Arial, sans-serif !important;
        font-size: 10pt !important;
        line-height: 1.6 !important;
        color: #1a1a1a !important;
        direction: rtl !important;
        text-align: right;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cpfp-single-recipe {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        font-size: 10pt !important;
        line-height: 1.6 !important;
        direction: rtl !important;
        text-align: right;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ============================================
       هرو دستور - ساختار عمودی شبیه کتابچه
       هدر وسط‌چین → تصویر تمام‌عرض → اطلاعات سریع
       ============================================ */
    .cpfp-recipe-hero {
        margin-bottom: 4mm !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 0 3mm 0 !important;
        border-bottom: 2pt solid #d63638 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        background: #fff !important;
    }

    .cpfp-recipe-hero-inner {
        display: flex !important;
        flex-direction: column !important;
        gap: 3mm !important;
        align-items: stretch !important;
    }

    /* بخش هدر (تگ‌ها + عنوان + خلاصه) - وسط‌چین */
    .cpfp-recipe-hero-info-col {
        padding: 0 !important;
        order: 1 !important;
        text-align: center !important;
        display: block !important;
        justify-content: flex-start !important;
    }

    /* تگ‌های نوع غذا - وسط‌چین و رنگی */
    .cpfp-recipe-types {
        margin: 0 0 2mm 0 !important;
        gap: 1mm !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    .cpfp-recipe-types .cpfp-badge {
        display: inline-block !important;
        font-size: 7pt !important;
        padding: 0.8mm 2.5mm !important;
        border-radius: 8pt !important;
        margin: 0.3mm !important;
        font-weight: 600 !important;
        color: #fff !important;
        background: #d63638 !important;
        text-decoration: none !important;
    }

    /* رنگ‌بندی تگ‌ها بر اساس نوع غذا - مطابق کتابچه */
    .cpfp-recipe-types .cpfp-badge-breakfast,
    .cpfp-badge-breakfast { background: #ff9800 !important; }
    .cpfp-recipe-types .cpfp-badge-persian,
    .cpfp-badge-persian { background: #6200ea !important; }
    .cpfp-recipe-types .cpfp-badge-stew,
    .cpfp-badge-stew { background: #795548 !important; }
    .cpfp-recipe-types .cpfp-badge-kebab,
    .cpfp-badge-kebab { background: #d50000 !important; }
    .cpfp-recipe-types .cpfp-badge-italian,
    .cpfp-badge-italian { background: #ff6f00 !important; }
    .cpfp-recipe-types .cpfp-badge-seafood,
    .cpfp-badge-seafood { background: #00695c !important; }
    .cpfp-recipe-types .cpfp-badge-salad,
    .cpfp-badge-salad { background: #558b2f !important; }
    .cpfp-recipe-types .cpfp-badge-soup,
    .cpfp-badge-soup { background: #e65100 !important; }
    .cpfp-recipe-types .cpfp-badge-dessert,
    .cpfp-badge-dessert { background: #c2185b !important; }
    .cpfp-recipe-types .cpfp-badge-ketogenic,
    .cpfp-badge-ketogenic { background: #455a64 !important; }
    .cpfp-recipe-types .cpfp-badge-vegan,
    .cpfp-badge-vegan { background: #2e7d32 !important; }
    .cpfp-recipe-types .cpfp-badge-vegetarian,
    .cpfp-badge-vegetarian { background: #43a047 !important; }
    .cpfp-recipe-types .cpfp-badge-low-carb,
    .cpfp-badge-low-carb { background: #1565c0 !important; }
    .cpfp-recipe-types .cpfp-badge-high-protein,
    .cpfp-badge-high-protein { background: #b71c1c !important; }
    .cpfp-recipe-types .cpfp-badge-low-protein,
    .cpfp-badge-low-protein { background: #00838f !important; }
    .cpfp-recipe-types .cpfp-badge-gluten-free,
    .cpfp-badge-gluten-free { background: #6a1b9a !important; }
    .cpfp-recipe-types .cpfp-badge-diabetic,
    .cpfp-badge-diabetic { background: #00695c !important; }
    .cpfp-recipe-types .cpfp-badge-renal,
    .cpfp-badge-renal { background: #37474f !important; }
    .cpfp-recipe-types .cpfp-badge-low-sodium,
    .cpfp-badge-low-sodium { background: #0277bd !important; }
    .cpfp-recipe-types .cpfp-badge-low-potassium,
    .cpfp-badge-low-potassium { background: #00838f !important; }
    .cpfp-recipe-types .cpfp-badge-low-phosphorus,
    .cpfp-badge-low-phosphorus { background: #4527a0 !important; }

    /* عنوان دستور - بزرگ، قرمز، وسط‌چین */
    .cpfp-recipe-title {
        font-size: 18pt !important;
        font-weight: 800 !important;
        color: #d63638 !important;
        margin: 0 0 2mm !important;
        line-height: 1.3 !important;
        text-align: center !important;
    }

    .cpfp-recipe-excerpt {
        font-size: 9pt !important;
        margin: 0 0 2mm !important;
        line-height: 1.5 !important;
        color: #666 !important;
        text-align: center !important;
        font-style: italic !important;
    }

    /* ============================================
       تصویر غذا - تمام‌عرض (مطابق کتابچه)
       ارتفاع صریح به mm، بدون z-index/position:relative
       ============================================ */
    .cpfp-recipe-hero-image-col {
        display: block !important;
        width: 100% !important;
        height: 60mm !important;
        min-height: 60mm !important;
        max-height: 60mm !important;
        background: #ffe8e8 !important;
        order: 2 !important;
        overflow: visible !important;
        position: static !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cpfp-recipe-image-wrap {
        display: block !important;
        width: 100% !important;
        height: 60mm !important;
        min-height: 60mm !important;
        max-height: 60mm !important;
        border-radius: 3mm !important;
        overflow: visible !important;
        position: static !important;
        background: #ffe8e8 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* حذف کامل ::before که ایموجی نمایش می‌دهد */
    .cpfp-recipe-image-wrap::before {
        display: none !important;
        content: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    .cpfp-recipe-image {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: 60mm !important;
        min-height: 60mm !important;
        max-height: 60mm !important;
        object-fit: cover !important;
        object-position: center !important;
        position: static !important;
        z-index: auto !important;
        overflow: visible !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cpfp-recipe-image-placeholder {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 60mm !important;
        font-size: 60pt !important;
        color: #d63638 !important;
        opacity: 0.4 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ============================================
       اطلاعات سریع - 4 ستون، باکس صورتی (مطابق کتابچه)
       ============================================ */
    .cpfp-recipe-quick-info {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0 !important;
        padding: 3mm !important;
        margin: 0 0 2mm 0 !important;
        background: linear-gradient(135deg, #fff8f8 0%, #fff 100%) !important;
        border-radius: 3mm !important;
        border: 0.5pt solid #ffe8e8 !important;
        border-top: none !important;
        padding-top: 3mm !important;
        order: 3 !important;
    }

    .cpfp-quick-info-item {
        text-align: center !important;
        padding: 1mm !important;
        border-right: 0.5pt solid #eee !important;
        border-radius: 0 !important;
        background: transparent !important;
        display: block !important;
        gap: 0 !important;
    }

    .cpfp-quick-info-item:last-child {
        border-right: none !important;
    }

    .cpfp-quick-info-icon {
        font-size: 12pt !important;
        width: auto !important;
        text-align: center !important;
        margin-bottom: 0.5mm !important;
    }

    .cpfp-quick-info-content {
        flex: none !important;
        display: block !important;
    }

    .cpfp-quick-info-value {
        font-size: 11pt !important;
        font-weight: 700 !important;
        color: #d63638 !important;
        line-height: 1.2 !important;
        margin: 0.5mm 0 !important;
    }

    .cpfp-quick-info-label {
        font-size: 7pt !important;
        color: #666 !important;
        margin-top: 0 !important;
    }

    .cpfp-stars-display {
        font-size: 11pt !important;
        color: #ffb900 !important;
        letter-spacing: 1pt !important;
    }

    /* ============================================
       بخش‌ها (section) - بدون باکس، فقط عنوان نوار قرمز
       ============================================ */
    .cpfp-recipe-section {
        padding: 0 !important;
        margin-bottom: 3mm !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* عنوان بخش - نوار قرمز با متن سفید (مطابق ingredients-box h4 کتابچه) */
    .cpfp-section-title {
        background: #d63638 !important;
        color: #fff !important;
        font-size: 10pt !important;
        font-weight: 700 !important;
        margin: 0 0 2mm !important;
        padding: 1.5mm 3mm !important;
        border-radius: 2mm !important;
        border-bottom: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 2mm !important;
        line-height: 1.3 !important;
    }

    .cpfp-section-icon {
        font-size: 11pt !important;
        line-height: 1 !important;
    }

    .cpfp-section-sub {
        font-size: 8pt !important;
        font-weight: 400 !important;
        color: rgba(255, 255, 255, 0.9) !important;
        margin-right: auto !important;
    }

    /* ============================================
       جدول تغذیه - 6 ستون با نوار بالا (مطابق کتابچه)
       ============================================ */
    .cpfp-nutrition-section {
        padding: 0 !important;
    }

    .cpfp-nutrition-grid {
        display: grid !important;
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 1.5mm !important;
    }

    .cpfp-nutrition-item {
        text-align: center !important;
        padding: 2mm 1mm !important;
        border: 0.5pt solid #e0e0e0 !important;
        border-radius: 2mm !important;
        background: #fafafa !important;
        position: relative !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* نوار بالا (به جای نوار کناری) - مطابق کتابچه */
    .cpfp-nutrition-item::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 1.5pt !important;
        background: #d63638 !important;
    }

    .cpfp-nutrition-item.cpfp-nutrition-calories::before { background: #ff6b6b !important; }
    .cpfp-nutrition-item.cpfp-nutrition-protein::before { background: #4ecdc4 !important; }
    .cpfp-nutrition-item.cpfp-nutrition-fat::before { background: #f7b731 !important; }
    .cpfp-nutrition-item.cpfp-nutrition-carbs::before { background: #5b9bd5 !important; }
    .cpfp-nutrition-item.cpfp-nutrition-fiber::before { background: #82c91e !important; }
    .cpfp-nutrition-item.cpfp-nutrition-serving::before { background: #8b5cf6 !important; }

    .cpfp-nutrition-icon {
        font-size: 11pt !important;
        margin-bottom: 0.5mm !important;
        line-height: 1 !important;
    }

    .cpfp-nutrition-value {
        font-size: 12pt !important;
        font-weight: 700 !important;
        color: #1a1a1a !important;
        line-height: 1.2 !important;
    }

    .cpfp-nutrition-value span {
        font-size: 7pt !important;
        font-weight: 400 !important;
        color: #666 !important;
    }

    .cpfp-nutrition-label {
        font-size: 7.5pt !important;
        font-weight: 600 !important;
        color: #1a1a1a !important;
        margin-top: 0.5mm !important;
    }

    .cpfp-nutrition-sublabel {
        font-size: 5.5pt !important;
        color: #999 !important;
        margin-top: 0 !important;
    }

    /* ============================================
       دو ستون: مواد اولیه و دستورالعمل
       ستون چپ 42mm، ستون راست 1fr (مطابق کتابچه)
       ============================================ */
    .cpfp-recipe-columns {
        display: grid !important;
        grid-template-columns: 42mm 1fr !important;
        gap: 3mm !important;
        margin-bottom: 3mm !important;
    }

    .cpfp-recipe-columns .cpfp-recipe-section {
        margin-bottom: 0 !important;
    }

    /* ستون مواد اولیه */
    .cpfp-ingredients-list {
        font-size: 8pt !important;
        padding: 0 !important;
        margin: 0 !important;
        line-height: 1.5 !important;
    }

    .cpfp-ingredient-mainlist,
    .cpfp-ingredient-sublist {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .cpfp-ingredient-subtitle {
        font-size: 8pt !important;
        font-weight: 700 !important;
        color: #d63638 !important;
        margin: 1.5mm 0 0.5mm !important;
        padding: 0.5mm 1mm !important;
        background: #fff5f5 !important;
        border-radius: 1mm !important;
    }

    .cpfp-ingredient-subtitle:first-child {
        margin-top: 0 !important;
    }

    .cpfp-ingredient-item {
        padding: 0.5mm 0 !important;
        margin-bottom: 0 !important;
        border-bottom: 0.2pt dotted #ddd !important;
        border-radius: 0 !important;
        display: flex !important;
        align-items: flex-start !important;
        gap: 1.5mm !important;
    }

    .cpfp-ingredient-item:hover {
        background: transparent !important;
    }

    .cpfp-ingredient-item:last-child {
        border-bottom: none !important;
    }

    .cpfp-ingredient-bullet {
        font-size: 7pt !important;
        color: #d63638 !important;
        flex-shrink: 0 !important;
        line-height: 1.5 !important;
    }

    .cpfp-ingredient-text {
        font-size: 8pt !important;
        line-height: 1.5 !important;
        color: #1a1a1a !important;
    }

    /* اطلاعات زمان - باکس کوچک کنار مواد اولیه */
    .cpfp-time-info {
        margin-top: 2mm !important;
        padding: 1.5mm 2mm !important;
        background: #fff !important;
        border-right: 2pt solid #d63638 !important;
        border-radius: 1mm !important;
    }

    .cpfp-time-info-item {
        font-size: 7.5pt !important;
        padding: 0.3mm 0 !important;
        gap: 1.5mm !important;
    }

    .cpfp-time-info-icon {
        font-size: 8pt !important;
    }

    .cpfp-time-info-label {
        color: #666 !important;
    }

    .cpfp-time-info-value {
        color: #1a1a1a !important;
        font-weight: 600 !important;
    }

    /* ============================================
       ستون دستورالعمل
       ============================================ */
    .cpfp-instructions-content {
        font-size: 8.5pt !important;
        line-height: 1.7 !important;
        color: #333 !important;
        text-align: right !important;
    }

    /* پاراگراف معرفی - باکس صورتی با نوار قرمز */
    .cpfp-instructions-content > p:first-child {
        background: #fff8f8 !important;
        padding: 1.5mm 2.5mm !important;
        border-radius: 1mm !important;
        border-right: 2pt solid #d63638 !important;
        margin-bottom: 1.5mm !important;
        font-size: 8pt !important;
        line-height: 1.5 !important;
        color: #444 !important;
    }

    .cpfp-instructions-content > p:first-child strong {
        color: #d63638 !important;
        display: inline !important;
        margin: 0 !important;
    }

    /* هدینگ‌های مراحل - باکس صورتی روشن با نوار قرمز */
    .cpfp-instructions-content h3 {
        color: #d63638 !important;
        background: #fff5f5 !important;
        padding: 0.8mm 2mm !important;
        border-radius: 1mm !important;
        border-right: 1.5pt solid #d63638 !important;
        margin: 1.5mm 0 0.8mm !important;
        font-size: 9.5pt !important;
        font-weight: 700 !important;
        box-shadow: none !important;
        line-height: 1.3 !important;
    }

    .cpfp-instructions-content h3::before {
        display: none !important;
    }

    .cpfp-instructions-content h4 {
        color: #d63638 !important;
        background: transparent !important;
        margin: 1mm 0 0.5mm !important;
        font-size: 8.5pt !important;
        font-weight: 700 !important;
        padding-bottom: 0.3mm !important;
        border-bottom: 0.5pt dotted #d63638 !important;
    }

    /* لیست‌ها */
    .cpfp-instructions-content ol,
    .cpfp-instructions-content ul {
        padding-right: 4mm !important;
        margin: 0 0 1.5mm !important;
    }

    .cpfp-instructions-content li {
        margin-bottom: 0.5mm !important;
        padding-right: 0.5mm !important;
        line-height: 1.6 !important;
        font-size: 8pt !important;
    }

    .cpfp-instructions-content p {
        margin: 0 0 1.5mm !important;
        font-size: 8.5pt !important;
        line-height: 1.7 !important;
    }

    /* نکته حرفه‌ای - باکس سبز */
    .cpfp-instructions-content .cpfp-pro-tip {
        background: #f0f9f0 !important;
        border-right: 2pt solid #2c7a4b !important;
        padding: 1.5mm 2mm !important;
        border-radius: 1mm !important;
        margin: 1.5mm 0 !important;
        font-size: 7.5pt !important;
        line-height: 1.5 !important;
        color: #2e5d3b !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .cpfp-instructions-content .cpfp-pro-tip strong {
        color: #2c7a4b !important;
        font-weight: 700 !important;
        display: inline !important;
        margin: 0 !important;
    }

    .cpfp-instructions-content em {
        color: #d63638 !important;
        font-style: italic !important;
        font-weight: 500 !important;
    }

    .cpfp-instructions-content strong {
        color: #1a1a1a !important;
        font-weight: 700 !important;
    }

    /* ============================================
       نکات تغذیه‌ای - باکس زرد (مطابق tips-box کتابچه)
       ============================================ */
    .cpfp-tips-section {
        background: #fffbe6 !important;
        border: 0.5pt solid #ffe082 !important;
        border-right: 2pt solid #f7b731 !important;
        border-radius: 2mm !important;
        padding: 2mm 3mm !important;
        margin-top: 2mm !important;
    }

    /* عنوان بخش نکات - بدون نوار قرمز، رنگ طلایی */
    .cpfp-tips-section .cpfp-section-title {
        background: transparent !important;
        color: #b8860b !important;
        padding: 0 0 1mm 0 !important;
        margin: 0 0 1mm 0 !important;
        border-bottom: 0.5pt solid #ffe082 !important;
        border-radius: 0 !important;
    }

    .cpfp-tips-section .cpfp-section-icon {
        color: #b8860b !important;
    }

    .cpfp-tips-content {
        font-size: 8pt !important;
        line-height: 1.6 !important;
        color: #1a1a1a !important;
    }

    .cpfp-tips-content p {
        margin: 0 0 1mm !important;
    }

    .cpfp-tips-content strong {
        color: #b8860b !important;
    }

    /* ============================================
       اعتبار پایین
       ============================================ */
    .cpfp-recipe-credit {
        margin-top: 3mm !important;
        margin-bottom: 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .cpfp-credit-card {
        padding: 2mm 3mm !important;
        background: #f0f9f0 !important;
        border: 0.5pt solid #c8e6c9 !important;
        border-right: 2pt solid #2c7a4b !important;
        border-radius: 2mm !important;
        gap: 2mm !important;
        display: flex !important;
        align-items: center !important;
    }

    .cpfp-credit-icon {
        font-size: 14pt !important;
        line-height: 1 !important;
        flex-shrink: 0 !important;
    }

    .cpfp-credit-text {
        flex: 1 !important;
    }

    .cpfp-credit-text p {
        margin: 0 !important;
        color: #2e5d3b !important;
        font-size: 7.5pt !important;
        line-height: 1.5 !important;
    }

    .cpfp-credit-text a,
    .cpfp-credit-text strong {
        color: #2c7a4b !important;
        text-decoration: none !important;
    }

    /* ============================================
       کنترل شکست صفحات
       ============================================ */
    .cpfp-recipe-hero,
    .cpfp-nutrition-section,
    .cpfp-ingredients-section,
    .cpfp-credit-card {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .cpfp-instructions-section {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .cpfp-instructions-content h3,
    .cpfp-instructions-content h4 {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* ============================================
       تنظیمات عمومی چاپ
       ============================================ */
    a {
        color: #1a1a1a !important;
        text-decoration: none !important;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body, .cpfp-single-recipe, .cpfp-recipe-section {
        background: #fff !important;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    p, li {
        orphans: 2 !important;
        widows: 2 !important;
    }

    h1, h2, h3, h4 {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* اعداد فارسی برای لیست‌های مرتب */
    .cpfp-instructions-content ol {
        counter-reset: item !important;
        list-style: none !important;
        padding-right: 0 !important;
    }

    .cpfp-instructions-content ol > li {
        counter-increment: item !important;
        padding-right: 5mm !important;
        position: relative !important;
    }

    .cpfp-instructions-content ol > li::before {
        content: counter(item) "." !important;
        position: absolute !important;
        right: 0 !important;
        font-weight: 700 !important;
        color: #d63638 !important;
        font-size: 8.5pt !important;
    }
}

/* ============================================
   پیش‌نمایش چاپ: وقتی کلاس cpfp-printing فعال است
   (برای نمایش به کاربر قبل از چاپ واقعی)
   ============================================ */
body.cpfp-printing {
    background: #fff !important;
}

body.cpfp-printing * {
    visibility: hidden;
}

body.cpfp-printing .cpfp-single-recipe,
body.cpfp-printing .cpfp-single-recipe * {
    visibility: visible;
}

body.cpfp-printing .cpfp-print-bar,
body.cpfp-printing .cpfp-print-btn,
body.cpfp-printing .cpfp-back-link,
body.cpfp-printing header,
body.cpfp-printing footer,
body.cpfp-printing .site-header,
body.cpfp-printing .site-footer,
body.cpfp-printing .sidebar,
body.cpfp-printing .widget,
body.cpfp-printing nav,
body.cpfp-printing .navigation,
body.cpfp-printing .menu,
body.cpfp-printing .nav-menu,
body.cpfp-printing #wpadminbar,
body.cpfp-printing .wpadminbar,
body.cpfp-printing .comments-area,
body.cpfp-printing .comment-respond,
body.cpfp-printing .cpfp-credit-icon,
body.cpfp-printing .cpfp-app-header,
body.cpfp-printing .cpfp-recipes-app,
body.cpfp-printing .cpfp-recipes-grid,
body.cpfp-printing .cpfp-no-results,
body.cpfp-printing .cpfp-loading,
body.cpfp-printing .cpfp-load-more-wrap,
body.cpfp-printing .cpfp-filters-wrap,
body.cpfp-printing .cpfp-search-box,
body.cpfp-printing .cpfp-results-info,
/* مخفی کردن breadcrumb و نویگیتور */
body.cpfp-printing .breadcrumb,
body.cpfp-printing .breadcrumbs,
body.cpfp-printing .breadcrumb-trail,
body.cpfp-printing .breadcrumb-area,
body.cpfp-printing .nav-breadcrumb,
body.cpfp-printing .breadcrumb-nav,
body.cpfp-printing .yoast-breadcrumb,
body.cpfp-printing .yoast-breadcrumbs,
body.cpfp-printing .rank-math-breadcrumb,
body.cpfp-printing .rank-math-breadcrumbs,
body.cpfp-printing .breadcrumbs-area,
body.cpfp-printing .breadcrumb-wrapper,
body.cpfp-printing .breadcrumb-container,
body.cpfp-printing .navx,
body.cpfp-printing .nav-header,
body.cpfp-printing .header-nav,
body.cpfp-printing .site-breadcrumb,
body.cpfp-printing .breadcrumbs-wrapper,
body.cpfp-printing .path,
body.cpfp-printing .breadcrumb-list,
body.cpfp-printing .navi,
body.cpfp-printing .nav-wrap,
body.cpfp-printing .top-bar,
body.cpfp-printing .topbar,
body.cpfp-printing .header-top,
body.cpfp-printing .page-header,
body.cpfp-printing .entry-header,
body.cpfp-printing .entry-meta,
body.cpfp-printing .post-meta,
body.cpfp-printing .post-thumbnail,
body.cpfp-printing .cat-links,
body.cpfp-printing .tags-links,
body.cpfp-printing .entry-footer,
body.cpfp-printing .post-navigation,
body.cpfp-printing .pagination,
body.cpfp-printing .screen-reader-text {
    display: none !important;
}

/* مخفی کردن همه nav و header که ممکن است breadcrumb باشند */
body.cpfp-printing > nav,
body.cpfp-printing > header,
body.cpfp-printing .site > header,
body.cpfp-printing .site > nav,
body.cpfp-printing #header,
body.cpfp-printing #nav,
body.cpfp-printing #navigation,
body.cpfp-printing #breadcrumb,
body.cpfp-printing #breadcrumbs {
    display: none !important;
}

body.cpfp-printing .cpfp-single-recipe {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

/* ============================================
   قوانین تصویر برای حالت پیش‌نمایش (body.cpfp-printing)
   این قوانین mirror شده از @media print هستند
   تا تصویر قبل از باز شدن دیالوگ چاپ هم درست رندر شود
   ============================================ */
body.cpfp-printing .cpfp-recipe-hero {
    margin-bottom: 4mm !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 0 3mm 0 !important;
    border-bottom: 2pt solid #d63638 !important;
    background: #fff !important;
}

body.cpfp-printing .cpfp-recipe-hero-inner {
    display: flex !important;
    flex-direction: column !important;
    gap: 3mm !important;
    align-items: stretch !important;
}

body.cpfp-printing .cpfp-recipe-hero-info-col {
    padding: 0 !important;
    order: 1 !important;
    text-align: center !important;
    display: block !important;
}

body.cpfp-printing .cpfp-recipe-hero-image-col {
    display: block !important;
    width: 100% !important;
    height: 60mm !important;
    min-height: 60mm !important;
    max-height: 60mm !important;
    background: #ffe8e8 !important;
    order: 2 !important;
    overflow: visible !important;
    position: static !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

body.cpfp-printing .cpfp-recipe-image-wrap {
    display: block !important;
    width: 100% !important;
    height: 60mm !important;
    min-height: 60mm !important;
    max-height: 60mm !important;
    border-radius: 3mm !important;
    overflow: visible !important;
    position: static !important;
    background: #ffe8e8 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

body.cpfp-printing .cpfp-recipe-image-wrap::before {
    display: none !important;
    content: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

body.cpfp-printing .cpfp-recipe-image {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 60mm !important;
    min-height: 60mm !important;
    max-height: 60mm !important;
    object-fit: cover !important;
    object-position: center !important;
    position: static !important;
    z-index: auto !important;
    overflow: visible !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

body.cpfp-printing .cpfp-recipe-image-placeholder {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 60mm !important;
    font-size: 60pt !important;
    color: #d63638 !important;
    opacity: 0.4 !important;
}
