/* ============================================
   Print Styles
   Developed by MD ROCK MUNNA
   ============================================ */

@media print {

    /* ============ PAGE SETUP ============ */
    @page {
        size: A4;
        margin: 15mm 12mm;
    }

    @page :first {
        margin-top: 10mm;
    }

    /* ============ RESET ============ */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    body {
        font-family: 'Hind Siliguri', 'SolaimanLipi', Arial, sans-serif !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        background: #fff !important;
        color: #000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ============ HIDE ELEMENTS ============ */
    .no-print,
    .no-print *,
    .btn,
    button,
    .topbar,
    .admin-sidebar,
    .admin-topbar,
    .admin-footer,
    .mobile-nav,
    .site-header,
    .site-footer,
    .mobile-nav,
    .notif-wrapper,
    .topbar-actions,
    .sidebar-menu,
    .menu-toggle,
    nav,
    header,
    footer {
        display: none !important;
    }

    /* ============ LINKS ============ */
    a {
        text-decoration: none !important;
        color: #000 !important;
    }

    a[href]:after {
        content: "" !important;
    }

    /* ============ LAYOUT ============ */
    .admin-wrap,
    .admin-main {
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        width: 100% !important;
    }

    .admin-content,
    .container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    /* ============ CARDS ============ */
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
        margin-bottom: 10px !important;
        border-radius: 4px !important;
        padding: 10px !important;
    }

    /* ============ TABLES ============ */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto;
    }

    table thead {
        display: table-header-group;
    }

    table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    table th,
    table td {
        border: 1px solid #000 !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
        color: #000 !important;
        background: #fff !important;
    }

    table th {
        background: #f0f0f0 !important;
        font-weight: 700 !important;
        -webkit-print-color-adjust: exact !important;
    }

    table .data-table th,
    table .data-table td {
        border: 1px solid #333 !important;
    }

    /* ============ BADGES (convert to text) ============ */
    .badge {
        background: transparent !important;
        color: #000 !important;
        border: none !important;
        padding: 0 !important;
        font-weight: 600 !important;
    }

    /* ============ HEADINGS ============ */
    h1, h2, h3, h4, h5, h6 {
        color: #000 !important;
        page-break-after: avoid;
        font-weight: 700 !important;
    }

    h1 { font-size: 20px !important; }
    h2 { font-size: 16px !important; }
    h3 { font-size: 14px !important; }

    /* ============ COLORS ============ */
    .text-primary,
    .text-success,
    .text-danger,
    .text-warning,
    .text-info {
        color: #000 !important;
    }

    /* ============ GRID ============ */
    .grid {
        display: block !important;
    }

    .grid-2 > *,
    .grid-3 > *,
    .grid-4 > * {
        display: block !important;
        width: 100% !important;
        margin-bottom: 8px !important;
    }

    /* ============ STAT CARDS ============ */
    .stat-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }

    /* ============ HIDE SPECIFIC ELEMENTS ============ */
    .sidebar,
    .action-buttons,
    .filters,
    .pagination,
    .search-box,
    .sort-options {
        display: none !important;
    }

    /* ============ INVOICE / MEMO SPECIFIC ============ */
    .print-header {
        text-align: center;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }

    .print-header h1 {
        margin: 0 0 5px !important;
        font-size: 22px !important;
        color: #000 !important;
    }

    .print-header .tagline {
        font-style: italic;
        font-size: 12px;
    }

    .print-info {
        display: flex;
        justify-content: space-between;
        margin: 10px 0;
        font-size: 11px;
    }

    .print-signatures {
        display: flex;
        justify-content: space-between;
        margin-top: 50px;
        page-break-inside: avoid;
    }

    .print-signatures div {
        text-align: center;
        border-top: 1px solid #000;
        padding-top: 5px;
        min-width: 150px;
        font-size: 11px;
    }

    .qr-box {
        text-align: center;
        margin: 15px 0;
    }

    .qr-box img {
        max-width: 120px;
    }

    .print-footer {
        margin-top: 30px;
        padding-top: 10px;
        border-top: 1px solid #999;
        text-align: center;
        font-size: 10px;
        color: #666;
    }

    /* ============ PAGE BREAKS ============ */
    .page-break {
        page-break-before: always;
    }

    .avoid-break {
        page-break-inside: avoid;
    }

    /* ============ SPECIFIC SECTIONS ============ */
    .no-print-section {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }
}

/* Elements hidden on screen but visible on print */
.print-only {
    display: none;
}

/* Screen print button */
.print-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-btn:hover {
    background: #15803d;
}

.print-btn i {
    font-size: 18px;
}

@media print {
    .print-btn {
        display: none !important;
    }
}

/* ============ THERMAL PRINT (80mm) ============ */
@media print and (max-width: 80mm) {
    @page {
        size: 80mm auto;
        margin: 2mm;
    }

    body {
        width: 76mm !important;
        font-size: 11px !important;
    }

    table th,
    table td {
        padding: 2px 3px !important;
        font-size: 10px !important;
    }

    .print-signatures {
        margin-top: 20px;
    }

    .print-signatures div {
        min-width: 60px;
        font-size: 9px;
    }
}