/**
 * WP Recipe Print Styles
 * Стилі для друку рецептів
 */
  
/* Загальні стилі для кнопки друку */
#printBtn {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

#printBtn:hover {
    opacity: 0.8;
}

#printBtn.loading {
    opacity: 0.6;
    cursor: wait;
}

/* Стилі для друку */
@media print {
    /* Приховуємо непотрібні елементи при друку */
    header,
    footer,
    nav,
    .site-header,
    .site-footer,
    .navigation,
    .sidebar,
    .widget,
    .comments,
    .comment-form,
    .social-share,
    .interaction-button,
    .advertisement,
    .ad,
    .popup,
    .modal,
    #wpadminbar,
    .no-print,
    .su-posts,
    .su-posts-teaser-loop,
    div[class*="su-post"] {
        display: none !important;
    }
    
    /* Приховуємо broken зображення */
    img[src=""],
    img:not([src]) {
        display: none !important;
    }
    
    /* Оптимізація сторінки для друку */
    * {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    body {
        margin: 0;
        padding: 20px;
        font-family: Rubik, Arial, sans-serif;
        font-size: 12pt;
        line-height: 1.6;
        color: #000 !important;
    }
    
    /* Заголовки */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
        color: #000 !important;
    }
    
    h1 {
        font-size: 24pt;
        margin-bottom: 10pt;
    }
    
    h2 {
        font-size: 18pt;
        margin-top: 15pt;
        margin-bottom: 8pt;
    }
    
    h3 {
        font-size: 14pt;
        margin-top: 12pt;
        margin-bottom: 6pt;
    }
    
    /* Параграфи */
    p {
        margin: 0 0 10pt 0;
        orphans: 3;
        widows: 3;
    }
    
    /* Зображення - НЕ перевизначаємо margin та display для inline стилів */
    img {
        page-break-inside: avoid;
        page-break-after: avoid;
    }
    
    /* Списки */
    ul, ol {
        margin: 10pt 0;
        padding-left: 20pt;
    }
    
    li {
        margin-bottom: 5pt;
        page-break-inside: avoid;
    }
    
    /* Таблиці */
    table {
        border-collapse: collapse;
        width: 100%;
        page-break-inside: avoid;
        margin: 10pt 0;
    }
    
    table, th, td {
        border: 1px solid #000;
    }
    
    th, td {
        padding: 8pt;
        text-align: left;
    }
    
    th {
        background-color: #f0f0f0 !important;
        font-weight: bold;
    }
    
    /* Розриви сторінок */
    .page-break {
        page-break-before: always;
    }
    
    .page-break-after {
        page-break-after: always;
    }
    
    .no-page-break {
        page-break-inside: avoid;
    }
    
    /* Блоки рецепту */
    .recipe-meta,
    .recipe-ingredients,
    .recipe-instructions {
        page-break-inside: avoid;
        margin-bottom: 15pt;
    }
    
    .recipe-ingredients {
        border: 1pt solid #000;
        padding: 10pt;
        margin-top: 15pt;
    }
    
    .recipe-instructions {
        margin-top: 15pt;
    }
    
    /* Посилання */
    a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        font-style: italic;
    }
    
    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "";
    }
    
    /* Форматування дати та автора */
    .entry-meta,
    .post-meta {
        font-size: 10pt;
        margin-bottom: 15pt;
        color: #666 !important;
    }
    
    /* Підвал сторінки при друку */
    .print-footer {
        position: fixed;
        bottom: 0;
        width: 100%;
        text-align: center;
        font-size: 9pt;
        color: #666 !important;
        border-top: 1pt solid #ccc;
        padding-top: 5pt;
        margin-top: 20pt;
    }
}

/* Стилі для окремої сторінки друку */
.print-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: Rubik, Arial, sans-serif;
}

.print-page .print-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #000;
}

.print-page .print-title {
    font-size: 32px;
    margin-bottom: 10px;
    color: #000;
}

.print-page .print-meta {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

.print-page .print-content {
    line-height: 1.8;
    font-size: 16px;
}

.print-page .print-image {
    text-align: center;
    margin: 20px 0;
}

.print-page .print-image img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
}

.print-page .recipe-section {
    margin-bottom: 30px;
}

.print-page .recipe-section h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #000;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
}

.print-page .ingredients-list,
.print-page .instructions-list {
    padding-left: 25px;
}

.print-page .ingredients-list li,
.print-page .instructions-list li {
    margin-bottom: 10px;
}

.print-page .print-footer-info {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ccc;
    text-align: center;
    font-size: 12px;
    color: #999;
}

/* Модальне вікно для вибору опцій друку */
.print-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.print-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.print-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.print-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e5e5;
}

.print-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.print-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.print-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.print-modal-body {
    padding: 25px;
}

.print-option {
    margin-bottom: 15px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.print-option:hover {
    border-color: #9E0909;
    background: #fff9f9;
}

.print-option:last-child {
    margin-bottom: 0;
}

.print-option label {
    display: flex;
    padding: 18px;
    cursor: pointer;
    margin: 0;
    flex-direction: row;
    align-content: flex-start;
    flex-wrap: wrap;
}

.print-option input[type="radio"] {
    margin-top: 3px;
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #9E0909;
}

.print-option input[type="radio"]:checked ~ .option-title {
    color: #9E0909;
    font-weight: 600;
}

.print-option label > span {
    display: block;
}

.option-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    transition: all 0.2s ease;
}

.option-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.print-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid #e5e5e5;
    background: #f9f9f9;
    border-radius: 0 0 12px 12px;
}

.print-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.print-btn-cancel {
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
}

.print-btn-cancel:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: #333;
}

.print-btn-primary {
    background: #9E0909;
    color: #fff;
}

.print-btn-primary:hover {
    background: #850707;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(158, 9, 9, 0.3);
}

body.print-modal-open {
    overflow: hidden;
}

/* Адаптив для мобільних */
@media (max-width: 600px) {
    .print-modal-content {
        width: 95%;
        max-width: none;
    }
    
    .print-modal-header,
    .print-modal-body,
    .print-modal-footer {
        padding: 15px 20px;
    }
    
    .print-modal-header h3 {
        font-size: 18px;
    }
    
    .print-option label {
        padding: 15px;
    }
    
    .option-title {
        font-size: 15px;
    }
    
    .option-desc {
        font-size: 12px;
    }
}
