/**
 * Print Optimization CSS
 * 6.3 - Print optimization for reports
 */

@media print {
    /* Reset */
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Hide non-essential elements */
    .no-print,
    .navbar,
    .footer,
    .sidebar,
    .btn,
    button,
    .chat-widget-container,
    .modal,
    .dropdown-menu,
    .tooltip,
    .popover {
        display: none !important;
    }

    /* Page Setup */
    @page {
        size: A4;
        margin: 2cm 1.5cm;
    }

    /* Typography */
    body {
        font-size: 12pt;
        line-height: 1.5;
        font-family: "Times New Roman", serif;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    /* Tables */
    table {
        width: 100%;
        border-collapse: collapse;
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    thead {
        display: table-header-group;
    }

    tfoot {
        display: table-footer-group;
    }

    th, td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }

    /* Charts - Convert to static images */
    canvas,
    .chart-container {
        page-break-inside: avoid;
        max-width: 100%;
        height: auto !important;
    }

    /* Images */
    img {
        max-width: 100%;
        height: auto;
        page-break-inside: avoid;
    }

    /* Report Sections */
    .report-section {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .report-page-break {
        page-break-before: always;
    }

    /* Headers and Footers */
    .report-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: 10px;
        border-bottom: 2px solid #000;
    }

    .report-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px;
        border-top: 2px solid #000;
        text-align: center;
        font-size: 10pt;
    }

    /* Watermarks */
    .report-watermark {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-45deg);
        font-size: 72pt;
        color: rgba(0, 0, 0, 0.1);
        z-index: -1;
    }

    /* Page Numbers */
    .page-number::after {
        content: "Sayfa " counter(page);
    }

    /* Column Layout */
    .report-columns {
        column-count: 2;
        column-gap: 20px;
        column-rule: 1px solid #ddd;
    }

    /* Avoid breaks */
    .no-break {
        page-break-inside: avoid;
    }

    /* Force breaks */
    .force-break {
        page-break-before: always;
    }

    /* Print-only content */
    .print-only {
        display: block !important;
    }

    .screen-only {
        display: none !important;
    }

    /* Colors - convert to grayscale safe */
    .bg-primary,
    .bg-success,
    .bg-danger,
    .bg-warning,
    .bg-info {
        background: #f0f0f0 !important;
        border: 1px solid #ddd !important;
    }

    /* Links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }

    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "";
    }

    /* Report Metadata */
    .report-meta {
        font-size: 10pt;
        color: #666;
        margin-bottom: 10px;
    }
}

/* Print Preview Styles */
@media screen {
    .print-preview {
        width: 210mm;
        min-height: 297mm;
        margin: 20px auto;
        padding: 20mm 15mm;
        background: white;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }

    .print-preview .print-only {
        display: block;
    }
}

/* Print Button Styles */
.print-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: #007aff;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.3s;
}

.print-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
