/* Print Button Styles */
.print-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin-bottom: 20px;
    background-color: var(--wb-green);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-family: inherit;
    transition: background-color 0.3s ease;
}

.print-button:hover {
    background-color: var(--wb-green-opaque);
}

.print-button:active {
    transform: translateY(1px);
}

.print-button svg {
    width: 20px;
    height: 20px;
}

/* Print Media Styles */
@media print {
    /* Hide everything by default */
    body * {
        visibility: hidden;
    }

    /* Show only the main content and print header */
    #wb-main-post-content,
    #wb-main-post-content * {
        visibility: visible;
    }

    .print-header,
    .print-header * {
        visibility: visible;
    }

    /* Hide sidebar and other elements */
    .sidebar,
    .content-right,
    header,
    footer,
    nav,
    .navigation,
    .menu,
    .comments-area {
        display: none !important;
    }

    /* Position the content */
    .content-inner {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .content-left {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #wb-main-post-content {
        position: absolute;
        left: 0;
        top: 80px; /* Adjust based on logo height */
        width: 100%;
        padding: 0 20px;
        box-sizing: border-box;
    }

    /* Print header with logo */
    .print-header {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        text-align: center;
        border-bottom: 2px solid #ddd;
        padding: 20px 20px 15px;
        margin-bottom: 30px;
        box-sizing: border-box;
    }

    .print-header img {
        max-height: 50px;
        width: auto;
        margin-bottom: 10px;
    }

    .print-header .print-site-name {
        font-size: 14px;
        color: #666;
        margin: 5px 0 0 0;
    }

    /* Hide the print button itself */
    .print-button {
        display: none !important;
    }

    /* Typography adjustments for print */
    #wb-main-post-content h1 {
        font-size: 24pt !important;
        margin-top: 0 !important;
        margin-bottom: 10pt !important;
        color: black !important;
    }

    #wb-main-post-content h5 {
        font-size: 10pt !important;
        color: #666 !important;
        margin-bottom: 5pt !important;
    }

    #wb-main-post-content .post_lead {
        font-size: 14pt !important;
        line-height: 1.4 !important;
        color: #333 !important;
        margin-bottom: 10pt !important;
    }

    #wb-main-post-content .post_date {
        font-size: 10pt !important;
        color: #666 !important;
        margin-bottom: 15pt !important;
    }

    /* Ensure images and media are properly sized */
    #wb-main-post-content img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }

    #wb-main-post-content .wb-featured-image {
        margin-bottom: 20pt !important;
        page-break-inside: avoid;
    }

    #wb-main-post-content .wb-featured-image-caption {
        font-size: 9pt !important;
        color: #666 !important;
        font-style: italic;
        margin-top: 5pt !important;
    }

    #wb-main-post-content video,
    #wb-main-post-content iframe {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Content styling for print */
    #wb-main-post-content {
        background: white !important;
        color: black !important;
        font-size: 11pt !important;
        line-height: 1.5 !important;
    }

    #wb-main-post-content p {
        margin-bottom: 10pt !important;
        orphans: 3;
        widows: 3;
    }

    /* Ensure links are visible */
    #wb-main-post-content a {
        color: black !important;
        text-decoration: underline !important;
    }

    /* Show link URLs after the link text */
    #wb-main-post-content a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }

    /* Don't show URLs for internal anchor links */
    #wb-main-post-content a[href^="#"]:after,
    #wb-main-post-content a[href^="javascript:"]:after {
        content: "";
    }

    /* Page break handling */
    #wb-main-post-content h1,
    #wb-main-post-content h2,
    #wb-main-post-content h3,
    #wb-main-post-content h4,
    #wb-main-post-content h5,
    #wb-main-post-content h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    #wb-main-post-content blockquote,
    #wb-main-post-content pre,
    #wb-main-post-content table {
        page-break-inside: avoid;
    }

    /* Table styling for print */
    #wb-main-post-content table {
        border-collapse: collapse !important;
        width: 100% !important;
    }

    #wb-main-post-content th,
    #wb-main-post-content td {
        border: 1px solid #ddd !important;
        padding: 8pt !important;
    }

    #wb-main-post-content th {
        background-color: #f5f5f5 !important;
        font-weight: bold !important;
    }
}

/* Page setup for printing */
@page {
    size: A4;
    margin: 1.5cm;
}
