/**
 * AST Case Manager - Print Stylesheet
 * Optimized for printing case reports, mutabakat, and lists
 * Version: 2.1.0
 */

@media print {
    /* ==========================================================================
       Global Print Resets
    ========================================================================== */
    * {
        /* Remove backgrounds to save ink */
        background: transparent !important;
        color: #000 !important; /* Black text for best contrast */
        box-shadow: none !important;
        text-shadow: none !important;
    }

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

    @page :first {
        margin-top: 2cm;
    }

    /* ==========================================================================
       Hide Non-Essential Elements
    ========================================================================== */
    .ast-notification,
    .ast-loading-overlay,
    .no-print,
    .screen-only,
    .ast-actions,
    .holographic-button,
    button,
    .button,
    input[type="submit"],
    input[type="button"],
    .nav-tab-wrapper,
    .subsubsub,
    #adminmenu,
    #adminmenuback,
    #adminmenuwrap,
    #wpadminbar,
    #wpfooter,
    .update-nag,
    .notice,
    .error,
    .updated,
    .ast-filter-controls,
    .filter-section,
    .export-buttons,
    #editModal,
    .modal,
    .wp-heading-inline + .page-title-action,
    .page-title-action {
        display: none !important;
    }

    /* ==========================================================================
       Layout Adjustments
    ========================================================================== */
    body {
        font-size: 12pt !important;
        line-height: 1.5 !important;
        font-family: 'Times New Roman', Times, serif !important;
    }

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

    /* ==========================================================================
       Typography for Print
    ========================================================================== */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        font-weight: bold !important;
        margin-top: 1em !important;
        margin-bottom: 0.5em !important;
    }

    h1 {
        font-size: 24pt !important;
        border-bottom: 2pt solid #000 !important;
        padding-bottom: 5pt !important;
    }

    h2 {
        font-size: 18pt !important;
    }

    h3 {
        font-size: 14pt !important;
    }

    p, li, td, th {
        font-size: 11pt !important;
        orphans: 3 !important;
        widows: 3 !important;
    }

    /* ==========================================================================
       Table Styling for Print
    ========================================================================== */
    .holographic-table,
    .wp-list-table,
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto !important;
        border: 1pt solid #000 !important;
    }

    .holographic-table thead,
    .wp-list-table thead,
    table thead {
        display: table-header-group !important; /* Repeat header on each page */
        background: #f0f0f0 !important;
    }

    .holographic-table tbody,
    .wp-list-table tbody,
    table tbody {
        display: table-row-group !important;
    }

    .holographic-table th,
    .holographic-table td,
    .wp-list-table th,
    .wp-list-table td,
    table th,
    table td {
        border: 0.5pt solid #000 !important;
        padding: 4pt 8pt !important;
        background: transparent !important;
        text-align: left !important;
        vertical-align: top !important;
    }

    .holographic-table th,
    .wp-list-table th,
    table th {
        font-weight: bold !important;
        background-color: #e0e0e0 !important;
        font-size: 10pt !important;
    }

    /* Prevent rows from breaking across pages */
    .holographic-table tr,
    .wp-list-table tr,
    table tr {
        page-break-inside: avoid !important;
        page-break-after: auto !important;
    }

    /* Mobile card view - convert to table for print */
    @media screen and (max-width: 768px) {
        .holographic-table tbody,
        .holographic-table tr,
        .holographic-table td {
            display: table !important;
            width: 100% !important;
        }
    }

    /* ==========================================================================
       Specific Component Styling
    ========================================================================== */

    /* Summary Cards */
    .ozet-kart,
    .summary-card {
        page-break-inside: avoid !important;
        border: 1pt solid #000 !important;
        padding: 8pt !important;
        margin-bottom: 12pt !important;
        background: #f9f9f9 !important;
    }

    .ozet-kart h3,
    .summary-card h3 {
        margin-top: 0 !important;
        font-size: 12pt !important;
        border-bottom: 1pt solid #000 !important;
        padding-bottom: 4pt !important;
    }

    /* Stats Section */
    .stats-container,
    .ozet-kartlar {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-bottom: 20pt !important;
    }

    .stat-card,
    .ozet-kart {
        flex: 1 1 30% !important;
        margin: 5pt !important;
        min-width: 150pt !important;
    }

    /* Mutabakat Table Specific */
    .mutabakat-tablosu th:nth-child(3),
    .mutabakat-tablosu th:nth-child(4) {
        text-align: right !important;
    }

    .mutabakat-tablosu td:nth-child(3),
    .mutabakat-tablosu td:nth-child(4) {
        text-align: right !important;
        font-weight: bold !important;
    }

    .mutabakat-tablosu .positive {
        color: #000 !important;
    }

    .mutabakat-tablosu .negative {
        color: #000 !important;
        font-weight: bold !important;
    }

    .mutabakat-tablosu .positive::before {
        content: "(+) ";
    }

    .mutabakat-tablosu .negative::before {
        content: "(-) ";
    }

    /* Accordion - Expand all for print */
    .accordion-item {
        page-break-inside: avoid !important;
        margin-bottom: 10pt !important;
        border: 1pt solid #000 !important;
    }

    .accordion-header {
        display: block !important;
        font-weight: bold !important;
        padding: 8pt !important;
        background: #e0e0e0 !important;
        border-bottom: 1pt solid #000 !important;
    }

    .accordion-content {
        display: block !important; /* Always show content when printing */
        padding: 8pt !important;
    }

    /* ==========================================================================
       Links and References
    ========================================================================== */
    a {
        text-decoration: underline !important;
        color: #000 !important;
    }

    /* Show URL after links (optional - comment out if not needed) */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt !important;
        font-style: italic !important;
    }

    /* But not for internal anchors */
    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "" !important;
    }

    /* ==========================================================================
       Form Elements (for form printing if needed)
    ========================================================================== */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        border: none !important;
        border-bottom: 1pt solid #000 !important;
        padding: 2pt !important;
        background: transparent !important;
    }

    /* Show form values */
    input[type="text"],
    input[type="number"],
    input[type="date"] {
        height: auto !important;
        line-height: normal !important;
    }

    /* ==========================================================================
       Footer and Header for Print
    ========================================================================== */
    .print-header {
        display: block !important;
        text-align: center !important;
        margin-bottom: 20pt !important;
        padding-bottom: 10pt !important;
        border-bottom: 2pt solid #000 !important;
    }

    .print-footer {
        display: block !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        text-align: center !important;
        font-size: 9pt !important;
        border-top: 1pt solid #000 !important;
        padding-top: 5pt !important;
    }

    /* Page numbers (browser will handle) */
    .page-break {
        page-break-before: always !important;
    }

    /* ==========================================================================
       Color Adjustments for Important States
    ========================================================================== */
    .odendi-badge,
    .status-paid {
        border: 1pt solid #000 !important;
        padding: 2pt 4pt !important;
        font-weight: bold !important;
    }

    .odendi-badge::after {
        content: " ✓" !important;
    }

    .odenmedi-badge,
    .status-unpaid {
        border: 1pt solid #000 !important;
        padding: 2pt 4pt !important;
        font-style: italic !important;
    }

    .odenmedi-badge::after {
        content: " ✗" !important;
    }

    /* ==========================================================================
       Images and Media
    ========================================================================== */
    img {
        max-width: 100% !important;
        page-break-inside: avoid !important;
    }

    /* Hide decorative images */
    img.decoration,
    .holographic-bg,
    .glow-effect {
        display: none !important;
    }

    /* ==========================================================================
       Utility Classes
    ========================================================================== */
    .print-only {
        display: block !important;
    }

    .page-break-before {
        page-break-before: always !important;
    }

    .page-break-after {
        page-break-after: always !important;
    }

    .avoid-break {
        page-break-inside: avoid !important;
    }

    /* ==========================================================================
       Responsive Print Layout
    ========================================================================== */
    .container,
    .wrap,
    .content {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ==========================================================================
       Special Print-Only Elements
    ========================================================================== */
    /* Add print date */
    body::after {
        content: "Yazdırma Tarihi: " attr(data-print-date);
        position: fixed;
        bottom: 10pt;
        right: 10pt;
        font-size: 9pt;
        font-style: italic;
    }
}

/* ==========================================================================
   Print Button Styling (for screen only)
========================================================================== */
@media screen {
    .print-button {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 5px;
        cursor: pointer;
        font-size: 14px;
        transition: all 0.3s ease;
        margin: 10px 5px;
    }

    .print-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    }

    .print-button:active {
        transform: translateY(0);
    }

    .print-preview-button {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    }
}