/* Rich select (form field type "richselect"): a custom dropdown whose options show an image, a title,
   a description and small tags. The trigger reuses the shared .mat-input base for a consistent look. */
.mat-rs { position: relative; }

.mat-rs-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.mat-rs-current { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.mat-rs-placeholder { color: #999; }
.mat-rs-cur-img { width: 28px; height: 28px; border-radius: 6px; background: #eee center/cover no-repeat; flex: none; }
.mat-rs-cur-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-rs-chev { flex: none; opacity: .6; font-size: 12px; }

.mat-rs-menu {
    position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px);
    background: #fff; border: 1px solid var(--line, #d5d5d5); border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .16);
}
/* Scroll region holds the options; on desktop it caps the dropdown height. */
.mat-rs-scroll { max-height: 340px; overflow: auto; padding: 6px; }
/* Bottom-sheet header (title + ✕) — desktop hides it; mobile shows it. */
.mat-rs-sheet-head { display: none; }
.mat-rs-close {
    border: 0; background: none; cursor: pointer; font-size: 22px; line-height: 1;
    color: inherit; padding: 4px 8px; border-radius: 8px; flex: none;
}
.mat-rs-close:hover { background: rgba(0, 0, 0, .06); }
/* Shared full-screen dim behind the mobile dialog. z-index sits above the floating language
   selector (.mat-lang--overlay is z-index 1300) so it, too, is covered by the dim/overlay. */
.mat-rs-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 2000; }
.mat-rs-opt {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    background: none; border: 0; border-radius: 8px; padding: 10px; cursor: pointer; font: inherit; color: inherit;
}
.mat-rs-opt:hover { background: rgba(0, 0, 0, .05); }
.mat-rs-opt[aria-selected="true"] { background: rgba(37, 99, 235, .1); }
.mat-rs-opt-img { width: 56px; height: 56px; border-radius: 8px; background: #eee center/cover no-repeat; flex: none; }
.mat-rs-opt-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mat-rs-opt-title { font-weight: 600; }
.mat-rs-opt-desc { font-size: 13px; color: #666; line-height: 1.4; }
.mat-rs-opt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.mat-rs-tag { font-size: 11px; font-weight: 600; background: rgba(0, 0, 0, .06); color: #444; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* Mobile: present the dropdown as a FULL-SCREEN dialog with a header + ✕ close (same as the
   datepicker). The wrapper gets .mat-rs-modal via JS while open. The menu fills the screen, so the
   options use the whole height and only scroll if they genuinely overflow. */
@media (max-width: 600px) {
    .mat-rs-modal .mat-rs-menu {
        position: fixed; inset: 0; top: 0;
        z-index: 2001;
        height: 100vh; height: 100dvh; max-height: none;
        border: 0; border-radius: 0;
        box-shadow: none;
        display: flex; flex-direction: column; overflow: hidden;
    }
    .mat-rs-modal .mat-rs-sheet-head {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        padding: 16px 12px 14px 16px; border-bottom: 1px solid #ececec; flex: 0 0 auto;
    }
    .mat-rs-sheet-title { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mat-rs-modal .mat-rs-scroll {
        max-height: none; flex: 1 1 auto; min-height: 0;
        padding: 8px 8px max(10px, env(safe-area-inset-bottom));
        -webkit-overflow-scrolling: touch;
    }
    /* Bigger, more tappable option rows. */
    .mat-rs-modal .mat-rs-opt { padding: 14px; }
    .mat-rs-modal .mat-rs-opt-img { width: 64px; height: 64px; }
}

/* Multi-select: a tick box in front of every option. Drawn rather than a real <input>, because the
   option is already a <button> and a checkbox inside it would fight it for the click. */
.mat-rs[data-rs-multi] .mat-rs-opt { position: relative; padding-left: 40px; }
.mat-rs[data-rs-multi] .mat-rs-opt::before {
    content: ""; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; border: 1.5px solid #c7ccd6; border-radius: 4px; background: #fff;
}
.mat-rs[data-rs-multi] .mat-rs-opt.on::before { background: #2563eb; border-color: #2563eb; }
.mat-rs[data-rs-multi] .mat-rs-opt.on::after {
    content: ""; position: absolute; left: 19px; top: 50%; margin-top: -5px;
    width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
