/* ── Prescription Portal – Front-end Styles ────────────────── */

.pm-portal-box {
    max-width: 820px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1d2327;
}

/* Header */
.pm-portal-header { margin-bottom: 24px; }
.pm-portal-header h2 { font-size: 22px; margin: 0 0 6px; color: #1d2327; }
.pm-portal-header p  { color: #666; margin: 0; }
.pm-portal-section-title { font-size: 14px; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin: 20px 0 10px; }

/* ── Search input ───────────────────────────────────────────── */
.pm-portal-search-wrap {
    position: relative;
    margin-bottom: 24px;
}
.pm-portal-search-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #2271b1;
    border-radius: 8px;
    box-sizing: border-box;
    outline: none;
    transition: box-shadow .2s;
}
.pm-portal-search-input:focus {
    box-shadow: 0 0 0 3px rgba(34,113,177,.15);
}

/* Autocomplete suggestions dropdown */
.pm-portal-suggestions {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    z-index: 999;
    max-height: 260px;
    overflow-y: auto;
}
.pm-portal-suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
    transition: background .15s;
}
.pm-portal-suggestion-item:last-child { border-bottom: none; }
.pm-portal-suggestion-item:hover,
.pm-portal-suggestion-item.active { background: #f0f6fc; }
.pm-portal-suggestion-count { color: #888; font-size: 12px; }
.pm-portal-suggestion-highlight { font-weight: 700; color: #2271b1; }

/* ── Patient list ────────────────────────────────────────────── */
.pm-portal-patient-ul {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pm-portal-patient-li { transition: opacity .2s; }
.pm-portal-patient-li.pm-hidden { display: none; }
.pm-portal-patient-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: #1d2327;
    transition: border-color .2s, box-shadow .2s;
}
.pm-portal-patient-link:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34,113,177,.12);
    color: #1d2327;
}
.pm-portal-patient-name { font-weight: 600; font-size: 15px; }
.pm-portal-patient-count {
    background: #e8f0fe;
    color: #2271b1;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ── Prescription cards ──────────────────────────────────────── */
.pm-portal-rx-list { display: flex; flex-direction: column; gap: 12px; }
.pm-portal-rx-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color .2s, box-shadow .2s;
}
.pm-portal-rx-card:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34,113,177,.1);
}
.pm-portal-rx-card-left  { min-width: 120px; }
.pm-portal-rx-card-mid   { flex: 1; }
.pm-portal-rx-card-right { text-align: right; min-width: 130px; }
.pm-portal-rx-no   { font-weight: 700; font-size: 14px; color: #2271b1; }
.pm-portal-rx-date { font-size: 13px; color: #888; margin-top: 2px; }
.pm-portal-rx-diag { font-weight: 600; font-size: 14px; }
.pm-portal-rx-doctor { font-size: 13px; color: #666; margin-top: 2px; }
.pm-portal-rx-price { font-weight: 700; font-size: 15px; color: #c0392b; }

/* ── Buttons ─────────────────────────────────────────────────── */
.pm-portal-btn {
    display: inline-block;
    padding: 7px 16px;
    background: #2271b1;
    color: #fff !important;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    margin-top: 8px;
    transition: background .2s;
}
.pm-portal-btn:hover { background: #135e96; color: #fff !important; }
.pm-portal-back {
    display: inline-block;
    font-size: 13px;
    color: #2271b1;
    text-decoration: none;
    margin-bottom: 16px;
}
.pm-portal-back:hover { text-decoration: underline; }
.pm-portal-print-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.pm-portal-print-btn { margin-top: 0; }

/* ── Prescription detail ─────────────────────────────────────── */
.pm-portal-rx-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.pm-portal-rx-detail-header h2 { margin: 0; font-size: 22px; color: #2271b1; }
.pm-portal-rx-no-large { font-size: 16px; font-weight: 700; margin: 4px 0 0; color: #444; }
.pm-portal-rx-detail-date { text-align: right; color: #555; font-size: 14px; }

.pm-portal-patient-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 14px;
}
.pm-portal-patient-info label { font-weight: 600; color: #555; margin-right: 6px; }
.pm-portal-full { grid-column: 1 / -1; }

/* Medication table */
.pm-portal-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 16px;
}
.pm-portal-items-table th {
    background: #2271b1;
    color: #fff;
    padding: 9px 10px;
    text-align: left;
}
.pm-portal-items-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}
.pm-portal-items-table tr:nth-child(even) td { background: #f9f9f9; }
.pm-portal-items-table tfoot td {
    background: #f0f6fc;
    padding: 10px;
    font-size: 14px;
}
.pm-portal-total-price { color: #c0392b; font-size: 16px; }

.pm-portal-notes {
    background: #fffde7;
    border-left: 4px solid #f1c40f;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 20px;
}
.pm-portal-signature {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    text-align: center;
    font-size: 13px;
    color: #555;
}

/* Login prompt */
.pm-portal-login { text-align: center; padding: 40px; background: #f8f9fa; border-radius: 8px; color: #555; }
.pm-portal-empty { text-align: center; padding: 30px; color: #888; font-size: 14px; }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    .no-print { display: none !important; }
    .pm-portal-box { max-width: 100%; }
    .pm-portal-rx-detail-header { border-color: #000; }
    .pm-portal-items-table th { background: #333 !important; -webkit-print-color-adjust: exact; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .pm-portal-rx-card { flex-direction: column; align-items: flex-start; }
    .pm-portal-rx-card-right { text-align: left; }
    .pm-portal-patient-info { grid-template-columns: 1fr; }
    .pm-portal-items-table { font-size: 11px; }
    .pm-portal-items-table th, .pm-portal-items-table td { padding: 6px 5px; }
}

/* ── Latest patients header + limit selector ─────────────────── */
.pm-portal-latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.pm-portal-limit-form { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #666; }
.pm-portal-limit-select { padding: 4px 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }

/* ── Patient card: two-column info layout ────────────────────── */
.pm-portal-patient-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.pm-portal-patient-info-col { display: flex; flex-direction: column; gap: 2px; }
.pm-portal-patient-right-col { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.pm-portal-patient-meta { font-size: 12px; color: #888; }
.pm-portal-patient-last { font-size: 11px; color: #aaa; }

/* ── Remove price from card (already removed in PHP) ─────────── */
.pm-portal-rx-card-right .pm-portal-rx-price { display: none; }
