/* ══════════════════════════════════════════════════════════════════
   patient.css  —  Patient Page Styles
   Scope prefix: pf-*  (patient filter)  |  pmc-* (patient mobile card)
   ══════════════════════════════════════════════════════════════════ */

/* ── Page wrapper ──────────────────────────────────────────────── */
.patients-page {
    width: 100%;
    padding: 0;
    margin: 0;
}


/* ══════════════════════════════════════════════════════════════════
   PATIENT FILTER PANEL  (pf-*)
   ══════════════════════════════════════════════════════════════════ */

/* ── Panel shell ──────────────────────────────────────────────── */
.pf-panel {
    background: var(--mud-palette-surface, #ffffff);
    border: 1px solid var(--mud-palette-lines-default, #E2E8F0);
    border-radius: 14px;
    margin: 0 12px 16px 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
    transition: box-shadow .2s;
}

.pf-panel:focus-within {
    box-shadow: 0 2px 8px rgba(15, 23, 42, .09);
}

/* ── Panel header ─────────────────────────────────────────────── */
.pf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 0 20px;
}

.pf-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--mud-palette-text-secondary, #475569);
    letter-spacing: .01em;
}

/* Active-filter count pill */
.pf-active-badge {
    display: inline-flex;
    align-items: center;
    background: #EEF6FF;
    color: var(--mud-palette-primary, #1976d2);
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    padding: 1px 8px;
    margin-right: 2px;
    border: 1px solid #BFDBFE;
}

/* Reset button */
.pf-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: background .15s, color .15s;
    font-family: inherit;
}

.pf-reset-btn:hover {
    background: #F1F5F9;
    color: #334155;
}

/* ── Main two-column grid ─────────────────────────────────────── */
/*  Desktop:  [search-group  65%] [date-group  35%]               */
.pf-grid {
    display: grid;
    grid-template-columns: minmax(0, 65fr) minmax(0, 35fr);
    align-items: end;
    padding: 14px 20px 20px 20px;
    gap: 0;
}

/* ── Search group: 3 equal fields ────────────────────────────── */
.pf-search-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;

    /* separator toward the date group (physical left in RTL) */
    padding-left: 20px;
    border-left: 1px solid var(--mud-palette-lines-default, #EEF2F7);
}

/* ── Date group ───────────────────────────────────────────────── */
.pf-date-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding-right: 20px;
}

/* The three date input fields side by side */
.pf-date-trio {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* ── Generic field wrapper (label + control) ──────────────────── */
.pf-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

/* Size hints for date inputs (keeps them compact) */
.pf-field--day   { max-width: 72px;  }
.pf-field--month { max-width: 76px;  }
.pf-field--year  { max-width: 90px;  }
.pf-field--action { flex-shrink: 0;  }

/* ── Field label ──────────────────────────────────────────────── */
.pf-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--mud-palette-text-secondary, #475569);
    text-align: right;
    white-space: nowrap;
    letter-spacing: .01em;
    line-height: 1.5;           /* ≈ 18px — used by .pf-label-spacer */
    user-select: none;
}

/* ── Invisible spacer — pushes the search button down by one
      label height so it aligns with the bottoms of the inputs ── */
.pf-label-spacer {
    display: block;
    height: 18px;               /* must match .pf-label line-height * font-size */
    visibility: hidden;
    pointer-events: none;
    user-select: none;
}

/* ── Search / submit button ───────────────────────────────────── */
.pf-search-btn {
    width: 100%;
    height: 38px !important;
    min-width: 88px;
    font-weight: 700 !important;
    font-size: 13.5px !important;
    border-radius: 8px !important;
    white-space: nowrap;
    letter-spacing: .02em;
}

/* ── Simple single-row filter layout (1–2 fields, no date group) ── */
.pf-simple {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 10px 20px 16px 20px;
}

.pf-simple .pf-field { flex: 2; min-width: 180px; }
.pf-simple .pf-field--sm { flex: 1; min-width: 140px; }

/* ── MudTextField visual tweaks inside the filter panel ─────── */
.pf-panel .mud-input-outlined .mud-notched-outline {
    border-color: #DDE3EC;
    border-radius: 8px;
    transition: border-color .15s;
}

.pf-panel .mud-input-outlined:hover .mud-notched-outline {
    border-color: #94a3b8;
}

.pf-panel .mud-input-outlined.mud-input-focused .mud-notched-outline {
    border-color: var(--mud-palette-primary, #1976d2);
}

.pf-panel .mud-input-root {
    font-size: 13px;
    height: 38px;
}

.pf-panel .mud-input-adornment-start {
    color: #94a3b8;
}

/* ── Placeholder colour ───────────────────────────────────────── */
.pf-panel .mud-input input::placeholder {
    color: #b0bec5;
    font-size: 12.5px;
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════════════════ */

/* ── Tablet  (≤ 1100 px):  stack the two groups vertically ───── */
@media (max-width: 1100px) {
    .pf-grid {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 12px 16px 18px 16px;
    }

    .pf-search-group {
        border-left: none;
        border-bottom: 1px solid #EEF2F7;
        padding-left: 0;
        padding-bottom: 14px;
        margin-bottom: 14px;
    }

    .pf-date-group {
        padding-right: 0;
    }

    .pf-field--day,
    .pf-field--month,
    .pf-field--year {
        flex: 1;
        max-width: 120px;
    }
}

/* ── Small tablet / large phone  (≤ 768 px) ──────────────────── */
@media (max-width: 768px) {
    .pf-panel {
        margin: 0 10px 14px 10px;
    }

    .pf-header {
        padding: 10px 16px 0 16px;
    }

    .pf-grid {
        padding: 12px 16px 16px 16px;
    }

    /* Allow date trio + button to wrap if needed */
    .pf-date-group {
        flex-wrap: wrap;
        gap: 10px;
    }

    .pf-date-trio {
        flex-wrap: wrap;
        flex: 1 1 100%;
    }

    .pf-field--day,
    .pf-field--month,
    .pf-field--year {
        flex: 1;
        max-width: none;
        min-width: 64px;
    }

    .pf-field--action {
        flex: 1 1 100%;
    }

    /* Remove spacer on mobile — button fills the row */
    .pf-label-spacer {
        display: none;
    }

    .pf-search-btn {
        width: 100%;
        height: 40px !important;
    }
}

/* ── Mobile  (≤ 600 px): everything vertical ─────────────────── */
@media (max-width: 600px) {
    .pf-panel {
        margin: 0 8px 12px 8px;
    }

    .pf-header {
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 14px 0 14px;
    }

    .pf-grid {
        padding: 10px 14px 14px 14px;
    }

    /* Search fields stack vertically */
    .pf-search-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pf-date-group {
        gap: 8px;
    }
}


/* ══════════════════════════════════════════════════════════════════
   MOBILE PATIENT CARDS  (pmc-*)
   Shown below 960 px via <MudHidden Breakpoint="Breakpoint.MdAndUp">
   ══════════════════════════════════════════════════════════════════ */

.patient-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 10px 16px 10px;
}

.patient-mobile-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    background: #ffffff;
}

.pmc-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pmc-avatar {
    width: 40px !important;
    height: 40px !important;
    font-size: 15px !important;
    flex-shrink: 0;
}

.pmc-id {
    flex: 1;
    min-width: 0;
}

.pmc-name {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pmc-mrn {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.pmc-status {
    flex-shrink: 0;
}

.pmc-divider {
    margin: 10px 0;
}

.pmc-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pmc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    flex-wrap: wrap;
}

.pmc-row .chip-list {
    flex: 1;
}

/* ردیف داروی کارت موبایل: متن کشیده، منوی سه‌نقطه در انتها */
.pmc-drug-row {
    flex-wrap: nowrap;
}

.pmc-drug-row .pmc-drug-text {
    flex: 1;
    min-width: 0;
}

.pmc-drug-row .pmc-drug-menu {
    flex-shrink: 0;
    margin-inline-start: auto;
}

.pmc-row .mud-icon-root {
    font-size: 18px;
    color: #64748b;
}

.patient-cards-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
}
