/* =====================================================
   HMS PRESCRIPTION VIEW
===================================================== */

.hms-prescription {
    max-width: 800px;
    margin: 30px auto;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    font-family: Arial, sans-serif;
    color: #222;
}

/* ================= HEADER ================= */

.rx-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.rx-hospital {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hms-logo {
    width: 60px;
    height: auto;
}

.rx-hospital h1 {
    margin: 0;
    font-size: 20px;
}

.rx-hospital p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.rx-doctor {
    text-align: right;
    font-size: 14px;
    line-height: 1.6;
}

/* ================= PATIENT ================= */

.rx-patient {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 10px;
}

/* ================= HEADINGS ================= */

.hms-prescription h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.hms-prescription h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

/* ================= TABLE ================= */

.hms-prescription table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.hms-prescription th {
    background: #f3f4f6;
    font-weight: 600;
}

.hms-prescription th,
.hms-prescription td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    font-size: 14px;
}

/* ================= PRINT BUTTON ================= */

.hms-print-btn {
    background: #2b7cff;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.hms-print-btn:hover {
    background: #1e5ed6;
}

/* ================= SIGNATURE ================= */

.rx-signature {
    margin-top: 60px;
    text-align: right;
}

.rx-signature strong {
    font-size: 14px;
}

/* ================= HR ================= */

.hms-prescription hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

/* =====================================================
   PRINT MODE
===================================================== */

@media print {

    body * {
        visibility: hidden;
    }

    .hms-prescription,
    .hms-prescription * {
        visibility: visible;
    }

    .hms-prescription {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
    }

    .no-print {
        display: none !important;
    }

    .hms-print-btn {
        display: none !important;
    }

}


@media print {

    /* Reset everything */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
    }

    header,
    footer,
    .hms-topbar,
    #wpadminbar {
        display: none !important;
    }

    /* Hide everything except prescription */
    body * {
        visibility: hidden;
    }

    .hms-prescription,
    .hms-prescription * {
        visibility: visible;
    }

    /* ✅ CENTERED PAGE WITH PROPER MARGINS */
    .hms-prescription {
        position: relative; /* 🔥 change from absolute */
        width: 100%;
        max-width: 800px;   /* A4-friendly width */

        margin: 10px auto;  /* top + center */
        padding: 10px;

        box-shadow: none;
        border-radius: 0;
    }

    /* Remove print button */
    .no-print,
    .hms-print-btn {
        display: none !important;
    }

    /* ✅ CONTROL PRINT PAGE MARGINS */
    @page {
        size: A4;
        margin: 10mm;
    }
}

.rx-signature p {
    margin-bottom: 5px;
}

.hms-prescription p {
    margin-bottom: 10px;
}