/* The Clearing Codes - Print Stylesheet */
/* Optimized for printing reference cards, guides, and documentation */

@media print {
    /* Reset */
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Page Setup */
    @page {
        margin: 1.5cm;
        size: auto;
    }

    /* Hide Navigation & Decorative Elements */
    nav,
    .bg-gradient,
    .nav-links,
    .nav-button,
    footer,
    .no-print,
    button,
    .btn,
    input,
    textarea,
    select,
    .search-box,
    .search-icon,
    .quick-searches,
    .journal-actions,
    .entry-actions,
    .script-actions,
    .radio-group,
    .checkbox-group {
        display: none !important;
    }

    /* Body */
    body {
        font-family: Georgia, 'Times New Roman', serif;
        font-size: 11pt;
        line-height: 1.5;
        color: black;
        background: white;
        padding: 0;
        margin: 0;
    }

    main {
        padding: 0 !important;
        margin: 0 !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Typography */
    h1 {
        font-size: 24pt;
        font-weight: bold;
        margin-bottom: 12pt;
        page-break-after: avoid;
        border-bottom: 2px solid black;
        padding-bottom: 8pt;
    }

    h2 {
        font-size: 18pt;
        font-weight: bold;
        margin-top: 20pt;
        margin-bottom: 10pt;
        page-break-after: avoid;
    }

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

    p {
        margin-bottom: 8pt;
        orphans: 3;
        widows: 3;
    }

    /* Links */
    a {
        color: black !important;
        text-decoration: underline;
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666 !important;
    }

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

    /* Lists */
    ul, ol {
        margin-bottom: 12pt;
        padding-left: 20pt;
    }

    li {
        margin-bottom: 4pt;
    }

    /* Blockquotes / Commands */
    blockquote,
    .script-quote,
    .command-text,
    .script-content {
        border-left: 3px solid black;
        padding-left: 12pt;
        margin: 12pt 0;
        font-style: italic;
    }

    /* Cards */
    .card,
    .step,
    .result-card,
    .entry-card,
    .script-container,
    .new-entry-section {
        border: 1px solid black !important;
        padding: 12pt;
        margin-bottom: 12pt;
        page-break-inside: avoid;
    }

    /* Tables */
    table {
        width: 100%;
        border-collapse: collapse;
        margin: 12pt 0;
        page-break-inside: avoid;
    }

    th, td {
        border: 1px solid black;
        padding: 8pt;
        text-align: left;
    }

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

    /* Page Breaks */
    .page-break,
    .section-break {
        page-break-after: always;
    }

    h1, h2, h3,
    .step-header,
    .section-title {
        page-break-after: avoid;
    }

    /* Prevent breaking inside important elements */
    .step,
    .command-section,
    .protocol-session,
    .entry-card,
    .result-card,
    ul,
    ol,
    table {
        page-break-inside: avoid;
    }

    /* Print-specific utilities */
    .print-only {
        display: block !important;
    }

    /* Header for each page */
    .print-header {
        position: running(header);
        text-align: center;
        font-size: 9pt;
        color: #666 !important;
        padding-bottom: 8pt;
        border-bottom: 1px solid #ccc;
        margin-bottom: 12pt;
    }

    /* Footer for each page */
    .print-footer {
        position: running(footer);
        text-align: center;
        font-size: 9pt;
        color: #666 !important;
        padding-top: 8pt;
        border-top: 1px solid #ccc;
        margin-top: 12pt;
    }

    /* Journal Entry Styling */
    .entry-date {
        font-weight: bold;
        font-size: 10pt;
    }

    .entry-focus {
        font-size: 14pt;
        font-weight: bold;
        margin-top: 4pt;
    }

    .entry-notes {
        white-space: pre-wrap;
        font-size: 10pt;
        line-height: 1.4;
    }

    .entry-script {
        display: block !important;
        white-space: pre-wrap;
        font-family: 'Courier New', monospace;
        font-size: 9pt;
        line-height: 1.4;
        background: #f5f5f5 !important;
        padding: 8pt;
        margin-top: 8pt;
        border: 1px solid #ddd;
    }

    /* Search Results */
    .result-category {
        font-weight: bold;
        font-size: 10pt;
        text-transform: uppercase;
        letter-spacing: 0.5pt;
    }

    .result-subcategory {
        font-weight: bold;
        font-size: 12pt;
        margin-top: 4pt;
    }

    .result-items {
        display: block;
        margin-top: 8pt;
    }

    .result-item {
        display: inline;
        margin-right: 8pt;
    }

    .result-item:after {
        content: " • ";
    }

    .result-item:last-child:after {
        content: "";
    }

    .result-item.highlight {
        font-weight: bold;
        text-decoration: underline;
    }

    /* Script Container */
    .script-container {
        border: 2px solid black !important;
        page-break-inside: avoid;
    }

    .script-title {
        font-size: 18pt;
        font-weight: bold;
        margin-bottom: 12pt;
    }

    /* Optimize spacing for print */
    .subtitle {
        margin-bottom: 16pt !important;
    }

    .step {
        margin-bottom: 16pt;
    }

    .step-number {
        display: inline-block;
        width: 24pt;
        height: 24pt;
        border: 2px solid black;
        border-radius: 50%;
        text-align: center;
        line-height: 24pt;
        font-weight: bold;
        margin-right: 8pt;
    }

    .step-title {
        display: inline;
        font-size: 14pt;
        font-weight: bold;
    }

    .step-description {
        margin-top: 8pt;
        margin-bottom: 8pt;
        font-style: italic;
    }

    /* Ensure readability */
    .text-secondary,
    .entry-notes,
    .step-description {
        color: #333 !important;
    }

    /* Print-friendly reference card */
    .reference-card {
        border: 2px solid black;
        padding: 16pt;
        margin: 16pt 0;
        page-break-inside: avoid;
    }

    .reference-card-title {
        font-size: 16pt;
        font-weight: bold;
        margin-bottom: 12pt;
        text-align: center;
        border-bottom: 1px solid black;
        padding-bottom: 8pt;
    }

    /* Command boxes */
    .command-box {
        border: 2px solid black;
        padding: 12pt;
        margin: 12pt 0;
        background: #f9f9f9 !important;
        page-break-inside: avoid;
    }

    /* Stats & Metadata */
    .search-stats,
    .privacy-notice {
        display: none !important;
    }

    /* Clean up unnecessary spacing */
    .empty-state,
    .empty-journal,
    .initial-state {
        display: none !important;
    }
}

/* Print-specific reference card layout (for QuickReferenceCard) */
@media print {
    body.reference-card-print {
        font-size: 10pt;
    }

    body.reference-card-print h1 {
        font-size: 20pt;
        text-align: center;
        border-bottom: 3px solid black;
        padding-bottom: 12pt;
        margin-bottom: 16pt;
    }

    body.reference-card-print h2 {
        font-size: 14pt;
        margin-top: 16pt;
        margin-bottom: 8pt;
        border-bottom: 1px solid black;
        padding-bottom: 4pt;
    }

    body.reference-card-print h3 {
        font-size: 12pt;
        margin-top: 12pt;
        margin-bottom: 6pt;
    }

    body.reference-card-print blockquote {
        font-size: 11pt;
        line-height: 1.6;
        border-left: 4px solid black;
        padding-left: 12pt;
        margin: 10pt 0;
    }

    body.reference-card-print ul {
        margin: 8pt 0;
        padding-left: 16pt;
    }

    body.reference-card-print li {
        margin-bottom: 3pt;
    }
}
