/**
 * Print Styles for Documentation
 *
 * Optimized styles for printing documentation pages
 * @package WebtronDocs
 */

/* ============================================================================
   General Print Styles
   ============================================================================ */

@media print {
    /* Reset page margins */
    @page {
        margin: 2cm;
        size: A4;
    }

    /* Base typography */
    * {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        font-family: Georgia, "Times New Roman", serif;
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
        background: #fff;
    }

    /* Remove unnecessary elements */
    header,
    footer,
    nav,
    aside,
    .wp-site-blocks > header,
    .wp-site-blocks > footer,
    .wp-block-navigation,
    .navigation,
    .sidebar,
    .widget,
    .comments,
    .comment-respond,
    .search-form,
    .skip-link,
    button:not(.webtron-api-reference button):not(.webtron-changelog button),
    input[type="button"],
    input[type="submit"],
    .button,
    .btn {
        display: none !important;
    }

    /* Hide interactive elements */
    .webtron-tabs-nav,
    .webtron-api-copy-endpoint,
    .webtron-api-copy-code,
    .webtron-code-highlight-copy,
    .webtron-callout-toggle,
    .webtron-changelog-toggle,
    .webtron-changelog-download {
        display: none !important;
    }

    /* Show all content (expand collapsed sections) */
    .webtron-tabs-panel,
    .webtron-callout-content,
    .webtron-changelog-version-content,
    .webtron-api-example,
    [hidden],
    .hidden {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important;
    }

    /* ========================================================================
       Typography
       ======================================================================== */

    h1 {
        font-size: 24pt;
        font-weight: bold;
        margin-top: 0;
        margin-bottom: 12pt;
        page-break-after: avoid;
    }

    h2 {
        font-size: 20pt;
        font-weight: bold;
        margin-top: 18pt;
        margin-bottom: 10pt;
        page-break-after: avoid;
        border-bottom: 2pt solid #000;
        padding-bottom: 4pt;
    }

    h3 {
        font-size: 16pt;
        font-weight: bold;
        margin-top: 14pt;
        margin-bottom: 8pt;
        page-break-after: avoid;
    }

    h4 {
        font-size: 14pt;
        font-weight: bold;
        margin-top: 12pt;
        margin-bottom: 6pt;
        page-break-after: avoid;
    }

    h5, h6 {
        font-size: 12pt;
        font-weight: bold;
        margin-top: 10pt;
        margin-bottom: 6pt;
        page-break-after: avoid;
    }

    p {
        margin: 0 0 10pt 0;
        orphans: 3;
        widows: 3;
    }

    /* ========================================================================
       Links
       ======================================================================== */

    a {
        color: #000;
        text-decoration: underline;
    }

    /* Show URLs after links */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }

    /* Don't show URLs for internal links */
    a[href^="#"]:after,
    a[href^="/"]:after {
        content: "";
    }

    /* ========================================================================
       Lists
       ======================================================================== */

    ul, ol {
        margin: 0 0 10pt 20pt;
        padding: 0;
    }

    li {
        margin-bottom: 4pt;
    }

    /* ========================================================================
       Code Blocks
       ======================================================================== */

    code, pre {
        font-family: "Courier New", Courier, monospace;
        font-size: 10pt;
        border: 1pt solid #ccc;
        background: #f5f5f5 !important;
        color: #000 !important;
    }

    pre {
        padding: 8pt;
        margin: 10pt 0;
        white-space: pre-wrap;
        word-wrap: break-word;
        page-break-inside: avoid;
    }

    code {
        padding: 2pt 4pt;
    }

    pre code {
        border: none;
        padding: 0;
        background: transparent !important;
    }

    /* Code highlighting - ensure readability */
    .webtron-code-highlight pre {
        border: 1pt solid #000;
    }

    .webtron-code-highlight-header {
        display: block !important;
        border-bottom: 1pt solid #ccc;
        padding-bottom: 4pt;
        margin-bottom: 8pt;
    }

    .webtron-code-highlight-filename {
        font-weight: bold;
    }

    /* Remove syntax highlighting colors for better print */
    .token {
        color: #000 !important;
    }

    /* ========================================================================
       Tables
       ======================================================================== */

    table {
        width: 100%;
        border-collapse: collapse;
        margin: 10pt 0;
        page-break-inside: avoid;
    }

    th, td {
        padding: 6pt;
        border: 1pt solid #000;
        text-align: left;
    }

    th {
        font-weight: bold;
        background: #e0e0e0 !important;
    }

    /* ========================================================================
       Callout Blocks
       ======================================================================== */

    .webtron-callout {
        margin: 10pt 0;
        padding: 10pt;
        border: 2pt solid #000;
        page-break-inside: avoid;
    }

    .webtron-callout-header {
        font-weight: bold;
        margin-bottom: 6pt;
    }

    .webtron-callout-type-warning {
        border-left: 4pt solid #000;
    }

    .webtron-callout-type-danger {
        border: 2pt solid #000;
        background: #f0f0f0 !important;
    }

    /* ========================================================================
       Tabs Block
       ======================================================================== */

    .webtron-tabs-panel {
        page-break-inside: avoid;
        border-top: 1pt solid #ccc;
        padding-top: 10pt;
        margin-top: 10pt;
    }

    .webtron-tabs-panel:first-child {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }

    /* Add tab label before content */
    .webtron-tabs-panel::before {
        content: attr(aria-labelledby);
        display: block;
        font-weight: bold;
        font-size: 11pt;
        margin-bottom: 6pt;
    }

    /* ========================================================================
       API Reference Block
       ======================================================================== */

    .webtron-api-reference {
        page-break-inside: avoid;
        border: 2pt solid #000;
        padding: 10pt;
        margin: 10pt 0;
    }

    .webtron-api-method {
        display: inline-block;
        padding: 2pt 6pt;
        margin-right: 6pt;
        border: 1pt solid #000;
        font-weight: bold;
    }

    .webtron-api-endpoint {
        font-family: "Courier New", Courier, monospace;
        font-weight: bold;
    }

    .webtron-api-deprecation {
        border: 2pt solid #000;
        padding: 8pt;
        margin-bottom: 10pt;
        background: #f0f0f0 !important;
    }

    .webtron-api-parameter,
    .webtron-api-response {
        border: 1pt solid #ccc;
        padding: 6pt;
        margin: 6pt 0;
    }

    .webtron-api-example {
        display: block !important;
        page-break-inside: avoid;
        margin: 10pt 0;
    }

    .webtron-api-examples-tabs {
        display: none !important;
    }

    /* Label each example */
    .webtron-api-example:not(:first-child)::before {
        content: "Alternative Example";
        display: block;
        font-weight: bold;
        margin-bottom: 6pt;
    }

    /* ========================================================================
       Changelog Block
       ======================================================================== */

    .webtron-changelog-version {
        page-break-inside: avoid;
        border: 1pt solid #000;
        padding: 10pt;
        margin: 10pt 0;
    }

    .webtron-changelog-version:before {
        display: none !important;
    }

    .webtron-changelog-version-number {
        font-size: 16pt;
        font-weight: bold;
    }

    .webtron-changelog-release-type {
        border: 1pt solid #000;
        padding: 2pt 6pt;
        background: #e0e0e0 !important;
    }

    .webtron-changelog-version-content {
        display: block !important;
    }

    .webtron-changelog-change-badge {
        display: inline-block;
        padding: 2pt 4pt;
        margin-right: 4pt;
        border: 1pt solid #000;
        font-weight: bold;
    }

    /* ========================================================================
       Comparison Table Block
       ======================================================================== */

    .webtron-comparison-table {
        page-break-inside: avoid;
        margin: 10pt 0;
    }

    .webtron-comparison-table-header.is-highlighted {
        background: #e0e0e0 !important;
        border: 1pt solid #000;
    }

    .webtron-comparison-table-badge {
        border: 1pt solid #000;
        padding: 2pt 4pt;
        background: #fff !important;
    }

    .webtron-comparison-table-cell.is-highlighted {
        background: #f5f5f5 !important;
    }

    /* ========================================================================
       Images
       ======================================================================== */

    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }

    figure {
        margin: 10pt 0;
        page-break-inside: avoid;
    }

    figcaption {
        font-size: 10pt;
        font-style: italic;
        margin-top: 4pt;
    }

    /* ========================================================================
       Page Breaks
       ======================================================================== */

    /* Avoid breaks after headings */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* Avoid breaks before headings */
    h2, h3, h4, h5, h6 {
        page-break-before: auto;
    }

    /* Avoid breaks inside elements */
    blockquote,
    pre,
    figure,
    table,
    .webtron-callout,
    .webtron-code-highlight,
    .webtron-api-reference,
    .webtron-changelog-version,
    .webtron-comparison-table {
        page-break-inside: avoid;
    }

    /* ========================================================================
       Utility Classes
       ======================================================================== */

    .page-break-before {
        page-break-before: always;
    }

    .page-break-after {
        page-break-after: always;
    }

    .no-print {
        display: none !important;
    }

    /* ========================================================================
       WordPress Core Blocks
       ======================================================================== */

    .wp-block-image {
        page-break-inside: avoid;
    }

    .wp-block-quote {
        border-left: 4pt solid #000;
        padding-left: 10pt;
        margin: 10pt 0;
        font-style: italic;
    }

    .wp-block-separator {
        border-top: 1pt solid #000;
        margin: 15pt 0;
    }

    /* ========================================================================
       Footer Information
       ======================================================================== */

    /* Add page URL at bottom of first page */
    body::after {
        content: "Source: " attr(data-url);
        display: block;
        margin-top: 20pt;
        padding-top: 10pt;
        border-top: 1pt solid #ccc;
        font-size: 9pt;
        color: #666;
    }
}
