/* public/css/print.css - Complete Print Styles for Hospital Management System */

@media print {
    /* Reset and Base Styles */
    * {
        box-shadow: none !important;
        border-radius: 0 !important;
        background-image: none !important;
        text-shadow: none !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        font-family: 'Times New Roman', serif !important;
        font-size: 12pt !important;
        line-height: 1.4 !important;
        color: black !important;
    }

    /* Hide UI Elements */
    nav,
    header:not(.hospital-header),
    .navbar,
    .sidebar,
    .navigation,
    .menu,
    .footer,
    .print\\:hidden,
    button:not(.print\\:block),
    .btn,
    .button,
    .action-buttons,
    .actions,
    .pagination,
    .filters,
    .search-bar,
    .breadcrumb,
    .breadcrumbs,
    .alert:not(.print\\:block),
    .notification,
    .toast,
    .modal,
    .dropdown,
    .tabs,
    .tab-navigation,
    .back-link,
    .edit-link,
    .delete-link,
    .cancel-link,
    .form-actions,
    .action-bar,
    .toolbar,
    .status-bar,
    .loading,
    .spinner,
    .authenticated-layout nav,
    .authenticated-layout header:not(.hospital-header),
    .inertia-link,
    .router-link,
    [class*="hover:"],
    [class*="focus:"],
    [class*="active:"],
    [data-headlessui-state],
    .headlessui-portal-root {
        display: none !important;
    }

    /* Show Main Content */
    main,
    .main-content,
    .content,
    .invoice-content,
    .prescription-content,
    .print-content,
    .invoice-details,
    .prescription-details,
    .patient-info,
    .medicine-list,
    .invoice-items,
    .totals,
    .summary,
    .payment-history {
        display: block !important;
        visibility: visible !important;
        margin: 0 !important;
        padding: 20px !important;
        background: white !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    /* Page Settings */
    @page {
        margin: 1cm;
        size: A4;
    }

    /* Page Breaks */
    .page-break {
        page-break-before: always;
    }

    .no-page-break,
    .invoice-header,
    .hospital-header,
    .patient-info,
    .invoice-totals,
    .grand-total {
        page-break-inside: avoid;
    }

    /* Hospital Header */
    .hospital-header,
    .print-only {
        display: block !important;
        visibility: visible !important;
    }
    
    .hospital-header {
        text-align: center !important;
        margin-bottom: 20px !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 15px !important;
    }

    .hospital-name {
        font-size: 20pt !important;
        font-weight: bold !important;
        margin-bottom: 5px !important;
        color: black !important;
    }

    .hospital-address {
        font-size: 11pt !important;
        margin-bottom: 10px !important;
        color: black !important;
    }

    /* Typography */
    h1 {
        font-size: 18pt !important;
        margin: 0 0 10px 0 !important;
        page-break-after: avoid;
        color: black !important;
        font-weight: bold !important;
    }

    h2 {
        font-size: 16pt !important;
        margin: 15px 0 8px 0 !important;
        page-break-after: avoid;
        color: black !important;
        font-weight: bold !important;
    }

    h3 {
        font-size: 14pt !important;
        margin: 12px 0 6px 0 !important;
        page-break-after: avoid;
        color: black !important;
        font-weight: bold !important;
    }

    h4, h5, h6 {
        font-size: 12pt !important;
        margin: 10px 0 5px 0 !important;
        page-break-after: avoid;
        color: black !important;
        font-weight: bold !important;
    }

    p {
        margin: 5px 0 !important;
        color: black !important;
    }

    /* Tables */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 10px 0 !important;
        font-size: 11pt !important;
        page-break-inside: auto;
    }

    th, td {
        border: 1px solid #000 !important;
        padding: 8px !important;
        text-align: left !important;
        vertical-align: top !important;
        color: black !important;
        background: white !important;
    }

    /* Invoice Tables - Vertical Grid Lines Only */
    .invoice-items table th,
    .invoice-items table td {
        border-top: none !important;
        border-bottom: none !important;
        border-left: 1px solid #000 !important;
        border-right: 1px solid #000 !important;
    }

    /* First column - left border */
    .invoice-items table th:first-child,
    .invoice-items table td:first-child {
        border-left: 1px solid #000 !important;
    }

    /* Last column - right border */
    .invoice-items table th:last-child,
    .invoice-items table td:last-child {
        border-right: 1px solid #000 !important;
    }

    /* Header row - keep top and bottom borders */
    .invoice-items table thead th {
        border-top: 1px solid #000 !important;
        border-bottom: 1px solid #000 !important;
    }

    /* Last row - keep bottom border */
    .invoice-items table tbody tr:last-child td {
        border-bottom: 1px solid #000 !important;
    }

    th {
        background-color: #f5f5f5 !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }

    tbody tr {
        page-break-inside: avoid;
    }

    /* Medicine Table Specific */
    .medicine-table th,
    .medicine-table td {
        font-size: 10pt !important;
        padding: 6px !important;
    }

    .dosage,
    .frequency,
    .duration {
        font-weight: bold !important;
    }

    /* Status Badges - Force Colors */
    .badge,
    .status-badge,
    [class*="rounded-full"],
    .bg-green-100,
    .text-green-800,
    .bg-blue-100,
    .text-blue-800,
    .bg-yellow-100,
    .text-yellow-800,
    .bg-red-100,
    .text-red-800,
    .bg-gray-100,
    .text-gray-800 {
        border: 1px solid #000 !important;
        padding: 2px 6px !important;
        font-size: 10pt !important;
        font-weight: bold !important;
        color: black !important;
        background: white !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Invoice Specific Styles */
    .invoice-header {
        border-bottom: 2px solid #000 !important;
        padding-bottom: 10px !important;
        margin-bottom: 15px !important;
    }

    .invoice-totals {
        border-top: 2px solid #000 !important;
        padding-top: 10px !important;
        margin-top: 15px !important;
    }

    .grand-total {
        font-size: 14pt !important;
        font-weight: bold !important;
        border-top: 2px solid #000 !important;
        padding-top: 5px !important;
        margin-top: 10px !important;
    }

    /* Currency and Numbers */
    .currency,
    .amount,
    .total {
        font-weight: bold !important;
        text-align: right !important;
        color: black !important;
    }

    /* Date Formatting */
    .date {
        font-family: monospace !important;
        color: black !important;
    }

    /* Links */
    a {
        text-decoration: none !important;
        color: black !important;
    }

    /* Images */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Flex and Grid Layouts */
    .grid {
        display: block !important;
    }

    .grid > div {
        display: block !important;
        margin-bottom: 10px !important;
        page-break-inside: avoid;
    }

    .flex {
        display: block !important;
    }

    .flex > * {
        display: block !important;
        margin-bottom: 5px !important;
    }

    /* Force specific elements to show */
    .print\\:block {
        display: block !important;
    }

    .print\\:inline {
        display: inline !important;
    }

    .print\\:inline-block {
        display: inline-block !important;
    }

    /* Force text colors */
    .print\\:text-black {
        color: black !important;
    }

    .print\\:no-underline {
        text-decoration: none !important;
    }

    /* Prescription Specific Styles */
    .prescription-content {
        font-size: 12pt !important;
    }

    .prescription-content .patient-info {
        margin: 15px 0 !important;
        padding: 10px !important;
        border: 1px solid #000 !important;
    }

    .prescription-content .signature-area {
        margin-top: 40px !important;
        display: flex !important;
        justify-content: space-between !important;
    }

    .prescription-content .signature-line {
        border-top: 1px solid #000 !important;
        padding-top: 10px !important;
        width: 200px !important;
        text-align: center !important;
    }

    /* Payment History - Force Hidden in Print */
    .payment-history {
        display: none !important;
        visibility: hidden !important;
    }

    .payment-history table {
        display: none !important;
    }

    .payment-history .payment-summary {
        display: none !important;
    }

    /* List Styles */
    .list-content h2 {
        margin: 10px 0 !important;
        text-align: center !important;
    }

    /* Remove shadows and effects */
    .shadow,
    .shadow-sm,
    .shadow-md,
    .shadow-lg,
    .shadow-xl {
        box-shadow: none !important;
    }

    /* Text Sizes for Print */
    .text-xs { font-size: 9pt !important; }
    .text-sm { font-size: 10pt !important; }
    .text-base { font-size: 11pt !important; }
    .text-lg { font-size: 12pt !important; }
    .text-xl { font-size: 14pt !important; }
    .text-2xl { font-size: 16pt !important; }
    .text-3xl { font-size: 18pt !important; }

    /* Spacing Adjustments */
    .p-1 { padding: 2px !important; }
    .p-2 { padding: 4px !important; }
    .p-3 { padding: 6px !important; }
    .p-4 { padding: 8px !important; }
    .p-6 { padding: 12px !important; }
    .p-8 { padding: 16px !important; }

    .m-1 { margin: 2px !important; }
    .m-2 { margin: 4px !important; }
    .m-3 { margin: 6px !important; }
    .m-4 { margin: 8px !important; }
    .m-6 { margin: 12px !important; }
    .m-8 { margin: 16px !important; }

    /* Border adjustments */
    .border {
        border: 1px solid #000 !important;
    }

    .border-t {
        border-top: 1px solid #000 !important;
    }

    .border-b {
        border-bottom: 1px solid #000 !important;
    }

    .border-2 {
        border: 2px solid #000 !important;
    }

    /* Background colors for print */
    .bg-gray-50,
    .bg-gray-100 {
        background: #f8f8f8 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }

    /* Ensure important content is visible */
    .invoice-items,
    .prescription-details,
    .patient-details,
    .medicine-details {
        display: block !important;
        visibility: visible !important;
    }

    /* Form elements (if any need to be printed) */
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
        padding: 2px !important;
    }

    /* Footer for pages */
    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 10pt;
        border-top: 1px solid #000;
        padding: 5px;
        background: white;
    }

    /* Watermark or background text (if needed) */
    .watermark {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-45deg);
        font-size: 72pt;
        color: #f0f0f0;
        z-index: -1;
        opacity: 0.1;
    }

    /* Specific overrides for Vue/Tailwind classes */
    .space-y-1 > * + * { margin-top: 2px !important; }
    .space-y-2 > * + * { margin-top: 4px !important; }
    .space-y-4 > * + * { margin-top: 8px !important; }
    .space-x-2 > * + * { margin-left: 4px !important; }

    /* Ensure text is readable */
    .text-gray-500,
    .text-gray-600,
    .text-gray-700,
    .text-gray-800,
    .text-gray-900 {
        color: black !important;
    }

    /* Make sure dividers are visible */
    .divide-y > * + * {
        border-top: 1px solid #000 !important;
    }

    .divide-gray-200 > * + * {
        border-color: #000 !important;
    }
}

/* Print button styling when not printing */
@media screen {
    .print-only {
        display: none !important;
    }
    
    .hospital-header {
        display: none !important;
    }

    .print-button {
        background-color: #6b7280;
        color: white;
        border: none;
        padding: 8px 16px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .print-button:hover {
        background-color: #4b5563;
    }

    .print-button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
}
