/* Personal Weekly Chronicle - Print Styles */

/* Print-specific optimizations for newspaper printing */

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

    /* Page setup */
    @page {
        margin: 1.5cm;
        size: A4 portrait;
    }

    /* Hide non-printable elements */
    .top-nav,
    .formatting-toolbar,
    .btn-icon,
    .btn-primary,
    .btn-secondary,
    .btn-add-article,
    .btn-delete,
    .toolbar-btn,
    .add-article-section,
    .mood-tracker,
    [x-show="editMode"],
    .modal-overlay {
        display: none !important;
    }

    /* Body and container */
    body {
        font-size: 11pt;
        line-height: 1.5;
        font-family: Georgia, 'Times New Roman', serif;
    }

    .app-container {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .newspaper-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    /* Masthead */
    .masthead {
        border-bottom: 3pt solid black;
        padding-bottom: 0.5cm;
        margin-bottom: 0.8cm;
        page-break-after: avoid;
    }

    .masthead-top {
        font-size: 8pt;
        margin-bottom: 0.3cm;
    }

    .newspaper-title {
        font-size: 28pt;
        font-weight: bold;
        letter-spacing: 2pt;
        margin: 0.3cm 0;
        page-break-after: avoid;
    }

    .tagline {
        font-size: 10pt;
        font-style: italic;
        margin-top: 0.2cm;
    }

    .masthead-border {
        height: 1pt;
        background-color: black;
        margin-top: 0.3cm;
    }

    /* Content grid */
    .content-grid {
        display: block;
        width: 100%;
    }

    .main-content {
        width: 100%;
        float: none;
    }

    /* Articles */
    .article {
        page-break-inside: avoid;
        margin-bottom: 0.8cm;
        padding-bottom: 0.5cm;
        border-bottom: 1pt solid black;
    }

    .article:last-child {
        border-bottom: none;
    }

    .article.edit-mode {
        border: none;
        padding: 0;
        background: none;
    }

    .article-headline {
        font-weight: bold;
        line-height: 1.2;
        margin-bottom: 0.2cm;
        page-break-after: avoid;
    }

    .lead-article .article-headline {
        font-size: 20pt;
        border-bottom: 2pt solid black;
        padding-bottom: 0.2cm;
    }

    .secondary-article .article-headline {
        font-size: 16pt;
    }

    .standard-article .article-headline {
        font-size: 14pt;
    }

    .article-meta {
        font-size: 9pt;
        margin-bottom: 0.3cm;
        font-style: italic;
    }

    .article-body {
        font-size: 11pt;
        line-height: 1.6;
        text-align: justify;
        hyphens: auto;
        column-count: 1;
    }

    .lead-article .article-body {
        font-size: 12pt;
    }

    /* Drop cap for lead article */
    .lead-article .article-body::first-letter {
        font-size: 3em;
        font-weight: bold;
        float: left;
        line-height: 0.9;
        margin: 0.05em 0.1em 0 0;
    }

    /* Images */
    .article-image {
        page-break-inside: avoid;
        margin: 0.5cm 0;
    }

    .article-image img {
        max-width: 100%;
        height: auto;
        border: 1pt solid black;
    }

    .image-caption {
        font-size: 9pt;
        font-style: italic;
        margin-top: 0.2cm;
        padding: 0.2cm;
        background: none;
        border-top: 1pt solid black;
    }

    /* Articles row */
    .articles-row {
        display: block;
        width: 100%;
    }

    .articles-row .article {
        width: 100%;
        float: none;
        margin-bottom: 0.8cm;
    }

    /* Sidebar */
    .sidebar {
        width: 100%;
        float: none;
        page-break-before: always;
        margin-top: 1cm;
    }

    .sidebar-section {
        background: none;
        border: 2pt solid black;
        padding: 0.5cm;
        margin-bottom: 0.5cm;
        page-break-inside: avoid;
    }

    .sidebar-title {
        font-size: 12pt;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 1pt;
        margin-bottom: 0.3cm;
        padding-bottom: 0.2cm;
        border-bottom: 1pt solid black;
    }

    .highlights-content,
    .notes-content {
        font-size: 10pt;
        line-height: 1.5;
    }

    .highlights-content ul {
        padding-left: 0.5cm;
    }

    .highlights-content li {
        margin-bottom: 0.2cm;
    }

    /* Statistics */
    .word-count {
        border: 1pt solid black;
    }

    .stat-item {
        font-size: 10pt;
        padding: 0.2cm 0;
        border-bottom: 1pt solid black;
    }

    .stat-item:last-child {
        border-bottom: none;
    }

    /* Footer */
    .newspaper-footer {
        border-top: 2pt solid black;
        padding-top: 0.5cm;
        margin-top: 1cm;
        page-break-inside: avoid;
    }

    .footer-content {
        font-size: 9pt;
        text-align: center;
    }

    .footer-note {
        font-style: italic;
        margin-top: 0.2cm;
    }

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

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 8pt;
    }

    /* Prevent orphans and widows */
    p, .article-body {
        orphans: 3;
        widows: 3;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    /* Table of contents style for multiple articles */
    .article + .article {
        margin-top: 0.8cm;
    }

    /* Ensure proper spacing */
    * {
        margin: 0;
        padding: 0;
    }

    /* Override any theme-specific styles */
    .theme-classic,
    .theme-modern,
    .theme-minimal,
    .theme-dark {
        background: white !important;
        color: black !important;
    }

    /* Print quality improvements */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Ensure text is crisp */
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Column layout for longer articles (optional) */
    @media print and (min-width: 21cm) {
        .article-body {
            column-count: 2;
            column-gap: 0.8cm;
            column-rule: 1pt solid black;
        }

        .lead-article .article-body {
            column-count: 1;
        }
    }

    /* Page breaks */
    .lead-article {
        page-break-after: avoid;
    }

    .sidebar {
        page-break-before: auto;
    }

    /* Ensure volume and date info is visible */
    .volume-info,
    .date-info {
        font-weight: bold;
    }
}

/* Print preview mode (for testing) */
@media screen {
    .print-preview {
        max-width: 21cm;
        min-height: 29.7cm;
        margin: 2cm auto;
        background: white;
        box-shadow: 0 0 1cm rgba(0, 0, 0, 0.5);
        padding: 1.5cm;
    }
}
