/* ============================================================
   MEDOCS patient help widget, version 1 (patient-help.js).
   Job: every style the widget needs, so it does not lean on the
   product's Bootstrap or fonts. Every class starts with "mph-".
   Each top-level piece (the window, the top bar link, the footer
   line) carries .mph-root, which holds the colours and a reset.
   Mobile first: the window is full screen below 576px.
   ============================================================ */

.mph-root {
    --mph-primary: #4f46e5;
    --mph-primary-dark: #4338ca;
    --mph-primary-soft: #eef2ff;
    --mph-text: #1f2937;
    --mph-muted: #4b5563;
    --mph-border: #d1d5db;
    --mph-bg: #f8fafc;
    --mph-danger: #b91c1c;
    --mph-danger-soft: #fef2f2;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--mph-text);
    text-align: left;
    letter-spacing: normal;
    text-transform: none;
}
.mph-root *, .mph-root *::before, .mph-root *::after { box-sizing: border-box; }
.mph-root button, .mph-root input, .mph-root textarea, .mph-root label { font: inherit; color: inherit; margin: 0; letter-spacing: normal; text-transform: none; }
.mph-root h2, .mph-root h3, .mph-root p, .mph-root ul, .mph-root li { margin: 0; padding: 0; }
.mph-root ul { list-style: none; }
.mph-root [hidden] { display: none !important; }

html.mph-open, html.mph-open body { overflow: hidden; }

.mph-sr {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.mph-i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Links on the product's page ---------- */
.mph-linkbtn {
    display: inline; padding: 0; border: 0; background: none; cursor: pointer;
    color: var(--mph-primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}
.mph-linkbtn:hover { color: var(--mph-primary-dark); }
.mph-root .mph-linkbtn:focus-visible, .mph-root .mph-a:focus-visible, .mph-root .mph-btn:focus-visible, .mph-root .mph-icon-btn:focus-visible {
    outline: 3px solid var(--mph-primary); outline-offset: 2px; border-radius: 4px;
}
.mph-topbar-link { font-size: 15px; padding: 6px 4px; background: none; border: 0; }
.mph-root.mph-footer-line { margin: 8px 0 0; font-size: 14px; color: var(--mph-muted); }
.mph-a { color: var(--mph-primary); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.mph-a:hover { color: var(--mph-primary-dark); }

/* ---------- The window ---------- */
.mph-backdrop {
    position: fixed; inset: 0; z-index: 2147483000; background: rgba(15, 23, 42, .55);
    display: flex; align-items: stretch; justify-content: center; padding: 0;
    animation: mph-fade .15s ease;
}
.mph-dialog {
    position: relative; width: 100%; height: 100%;
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 0;
}
.mph-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid #e5e7eb; flex: 0 0 auto;
}
.mph-title { font-size: 20px; font-weight: 700; line-height: 1.3; }
.mph-title:focus { outline: none; }
.mph-title:focus-visible { outline: 3px solid var(--mph-primary); outline-offset: 2px; }
.mph-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; flex: 0 0 44px; padding: 0;
    border: 0; border-radius: 10px; background: none; color: var(--mph-muted); cursor: pointer;
}
.mph-icon-btn:hover { background: #f1f5f9; color: var(--mph-text); }
.mph-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; }

/* ---------- Quick answers ---------- */
.mph-quick { background: var(--mph-bg); border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; margin-bottom: 20px; }
.mph-qa-list { display: grid; gap: 10px; }
.mph-qa strong { display: block; font-weight: 700; }
.mph-qa span { display: block; color: var(--mph-muted); font-size: 15px; }

/* ---------- Form ---------- */
.mph-root .mph-sub { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.mph-field { margin-bottom: 16px; }
.mph-label { display: block; font-weight: 600; margin-bottom: 6px; }
.mph-input {
    display: block; width: 100%; padding: 12px; border: 1.5px solid var(--mph-border); border-radius: 10px;
    background: #fff; color: var(--mph-text); font-size: 16px; line-height: 1.45;
}
.mph-input:focus { outline: none; border-color: var(--mph-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .2); }
.mph-input[aria-invalid="true"] { border-color: var(--mph-danger); }
.mph-textarea { resize: vertical; min-height: 130px; }
.mph-under { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-top: 4px; }
.mph-count { margin-left: auto; font-size: 13px; color: var(--mph-muted); white-space: nowrap; }
.mph-err { color: var(--mph-danger); font-size: 14px; margin-top: 4px; }
.mph-under .mph-err { margin-top: 0; }
.mph-hint { font-size: 14px; color: var(--mph-muted); margin-top: 6px; }
.mph-root .mph-note { font-size: 14px; color: var(--mph-muted); margin-top: 8px; }

.mph-pinned { border: 1px solid #fecaca; background: var(--mph-danger-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; }
.mph-pin-msg { margin-top: 2px; word-break: break-word; }
.mph-pin-meta { font-size: 13px; color: var(--mph-muted); margin-top: 4px; word-break: break-all; }

.mph-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px; padding: 10px 18px; border: 1.5px solid transparent; border-radius: 10px;
    font-weight: 600; font-size: 15px; line-height: 1.3; cursor: pointer; text-decoration: none;
    background: #fff; color: var(--mph-text);
}
.mph-btn:disabled { opacity: .6; cursor: default; }
.mph-root .mph-btn-primary, .mph-root .mph-btn-primary:hover, .mph-root .mph-btn-primary:focus { background: var(--mph-primary); border-color: var(--mph-primary); color: #fff; }
.mph-root .mph-btn-primary:hover:not(:disabled) { background: var(--mph-primary-dark); border-color: var(--mph-primary-dark); }
.mph-btn-outline { border-color: #cbd5e1; color: #334155; }
.mph-btn-outline:hover:not(:disabled) { background: #f1f5f9; }
.mph-polish-btn { margin-top: 10px; }
.mph-suggest { margin-top: 10px; border: 1px solid #c7d2fe; background: var(--mph-primary-soft); border-radius: 10px; padding: 12px; }
.mph-root .mph-suggest-text { margin: 6px 0 10px; white-space: pre-wrap; word-break: break-word; }
.mph-suggest-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.mph-attach { cursor: pointer; }
.mph-file-input:focus-visible + .mph-attach { outline: 3px solid var(--mph-primary); outline-offset: 2px; }
.mph-files { margin-top: 8px; display: grid; gap: 6px; }
.mph-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 8px; }
.mph-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.mph-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.mph-disclosure { font-size: 14px; color: var(--mph-muted); margin-bottom: 14px; }
.mph-root .mph-disc-list { margin-top: 8px; display: grid; gap: 4px; }
.mph-root .mph-disc-list { list-style: disc; padding-left: 18px; }

.mph-send-error { border: 1px solid #fecaca; background: var(--mph-danger-soft); color: var(--mph-danger); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.mph-actions { display: flex; }
.mph-send { width: 100%; }

.mph-done { padding: 24px 4px; text-align: center; }
.mph-done:focus { outline: none; }
.mph-root .mph-done-text { font-size: 18px; font-weight: 600; margin-bottom: 18px; }

@keyframes mph-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Larger screens: a centred window ---------- */
@media (min-width: 576px) {
    .mph-backdrop { align-items: center; padding: 24px; }
    .mph-dialog {
        width: 600px; max-width: 100%; height: auto; max-height: calc(100vh - 48px);
        border-radius: 18px; box-shadow: 0 30px 80px rgba(15, 23, 42, .35);
    }
    .mph-head { padding: 16px 20px; }
    .mph-body { padding: 20px; }
    .mph-actions { justify-content: flex-end; }
    .mph-send { width: auto; min-width: 140px; }
}

@media (prefers-reduced-motion: reduce) {
    .mph-backdrop { animation: none; }
}
