/* MLB Analytics Textbook - Print Styles */

@media print {
    /* Hide non-essential elements */
    .navbar,
    .sidebar,
    .sidebar-toggle,
    .sidebar-backdrop,
    .page-toc-wrapper,
    .chapter-nav,
    .reading-progress,
    .btn-copy,
    .code-tabs,
    .exercise-hints button,
    .exercise-solution button,
    #darkModeToggle,
    #searchForm,
    .hero-section,
    .features-section,
    .cta-section,
    .site-footer,
    .breadcrumb {
        display: none !important;
    }

    /* Reset layout */
    body {
        font-size: 11pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
        margin: 0;
        padding: 0;
    }

    .chapter-content-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }

    .chapter-content {
        max-width: 100%;
        padding: 0;
    }

    /* Typography */
    h1 {
        font-size: 24pt;
        page-break-after: avoid;
    }

    h2 {
        font-size: 18pt;
        page-break-after: avoid;
        border-bottom: 1pt solid #ccc;
    }

    h3 {
        font-size: 14pt;
        page-break-after: avoid;
    }

    h4, h5, h6 {
        font-size: 12pt;
        page-break-after: avoid;
    }

    p, li {
        orphans: 3;
        widows: 3;
    }

    /* Links */
    a {
        color: #000;
        text-decoration: none;
    }

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

    /* Code blocks */
    pre {
        background: #f5f5f5 !important;
        border: 1pt solid #ccc;
        padding: 10pt;
        font-size: 9pt;
        white-space: pre-wrap;
        word-wrap: break-word;
        page-break-inside: avoid;
    }

    code {
        font-size: 9pt;
        background: #f5f5f5;
        padding: 1pt 3pt;
    }

    .code-block-wrapper {
        page-break-inside: avoid;
        margin: 12pt 0;
        box-shadow: none !important;
    }

    .code-block-header {
        background: #e9ecef !important;
        color: #000 !important;
        padding: 6pt 10pt;
    }

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

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

    th {
        background: #f5f5f5;
    }

    /* Cards and boxes */
    .card,
    .exercise-card,
    .toc-card {
        border: 1pt solid #ccc;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .card-header,
    .exercise-header {
        background: #f5f5f5 !important;
    }

    /* Badges */
    .badge {
        border: 1pt solid #ccc;
        background: #f5f5f5 !important;
        color: #000 !important;
    }

    /* Exercise hints and solutions - show collapsed content */
    .collapse {
        display: block !important;
        visibility: visible !important;
        height: auto !important;
    }

    .hints-content,
    .solution-warning {
        border: 1pt solid #ccc;
        background: #f9f9f9 !important;
    }

    /* Page breaks */
    .content-section {
        page-break-inside: avoid;
    }

    .chapter-header {
        page-break-after: avoid;
    }

    /* Header with chapter info on each page */
    @page {
        margin: 2cm;
        @top-center {
            content: "MLB Analytics Textbook";
        }
        @bottom-center {
            content: "Page " counter(page);
        }
    }

    /* First page */
    @page :first {
        @top-center {
            content: none;
        }
    }

    /* Images */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Alert boxes */
    .alert {
        border: 1pt solid #ccc;
        background: #f9f9f9 !important;
        color: #000 !important;
    }
}
