/* * This stylesheet only applies when printing the page.
 * It hides UI, formats content for paper, and fixes dark-mode colors.
 */

@media print {

    /* --- PAGE SETUP --- */
    /* Remove browser headers/footers and set margins */
    @page {
        size: auto;
        margin: 0.75in;
    }

    /* --- HIDE ALL UI ELEMENTS --- */

    /* Hide the main navigation header */
    .header-bar {
        display: none !important;
    }

    /* Hide the "Powered by" logos */
    #attribution-section {
        display: none !important;
    }

    /* Hide the "Save as PDF" buttons */
    #btn-save-pdf-top,
    #btn-save-pdf-bottom {
        display: none !important;
    }

    /* Hide all action buttons (Generate, Ask) */
    .card .btn {
        display: none !important;
    }

    /* Hide the small helper text */
    .card small.text-muted {
        display: none !important;
    }

    /* Hide separators */
    .card hr {
        display: none !important;
    }

    /* Hide loading spinners */
    .dash-loading {
        display: none !important;
    }

    /* Hide the "Select News Timeframe" dropdown when it's not relevant */
    #follow-up-timeframe-wrapper[style*="display: none;"] {
        display: none !important;
    }

    /* Hide the switch icons */
    .form-check-input {
        display: none !important;
    }

    /* Hide placeholder text in output areas */
    #market-update-output > p.text-muted,
    #detailed-report-output > p.text-muted {
        display: none !important;
    }


    /* --- FORMAT CONTENT FOR PRINT --- */

    /* Force a white background and black text */
    body, .card, .card-body, .card-header {
        background-color: #ffffff !important;
        background-image: none !important;
        color: #000000 !important;
        box-shadow: none !important;
    }

    .card {
        border: 1px solid #ddd !important;
        page-break-inside: avoid; /* Try to keep cards from splitting across pages */
    }

    /* Ensure all text is black */
    * {
        color: #000000 !important;
    }

    /* Style the labels for inputs */
    .form-label {
        font-weight: bold;
        margin-bottom: 0 !important;
    }

    /* Style the inputs to look like static text */
    .dash-dropdown .Select-control,
    .form-control,
    .form-control[disabled],
    textarea.form-control {
        border: none !important;
        box-shadow: none !important;
        background: none !important;
        padding-left: 0 !important;
        /* Make textareas fully visible */
        height: auto !important;
        resize: none !important;
    }

    /* Show the selected value in dropdowns */
    .dash-dropdown .Select-value-label {
        color: #000000 !important;
    }

    /* Hide dropdown arrows */
    .dash-dropdown .Select-arrow-zone {
        display: none !important;
    }

    /* Make sure selected switch label is visible */
    .custom-purple-switch .form-check-label {
        opacity: 1 !important;
    }

    /* Ensure output areas are fully visible and print all content */
    #market-update-output,
    #detailed-report-output,
    #follow-up-answer-output {
        max-height: none !important; /* Remove max-height */
        overflow-y: visible !important; /* Show all content */
    }

    /* --- FIX LONG URLS --- */
    /* Force links to wrap, preventing overflow */
    a, a[href] {
        word-wrap: break-word !important;
        word-break: break-all !important;
        color: #0000EE !important; /* Optional: make links blue */
        text-decoration: underline !important;
    }
}