/* RM Nurse centralized UI components v1.0.0
 * Opt-in component classes. Existing unconverted pages remain unchanged.
 */

/* Theme-driven actions. --rm-theme and --rm-theme-rgb are defined by header_rm_nurse.php. */
.rm-action-btn,
.btn-rm-theme,
.btn-outline-rm-theme,
.btn-danger,
.btn-outline-danger,
.btn-outline-secondary {
    border-radius: .5rem;
    min-height: 44px;
    font-weight: 600;
}

.btn-rm-theme {
    background: var(--rm-theme) !important;
    border-color: var(--rm-theme) !important;
    color: #fff !important;
}
.btn-rm-theme:hover { filter: brightness(.95); color: #fff !important; }
.btn-rm-theme:focus,
.btn-rm-theme:focus-visible,
.btn-outline-rm-theme:focus,
.btn-outline-rm-theme:focus-visible {
    box-shadow: 0 0 0 .25rem rgba(var(--rm-theme-rgb), .25) !important;
}
.btn-outline-rm-theme {
    background: transparent !important;
    border-color: var(--rm-theme) !important;
    color: var(--rm-theme) !important;
}
.btn-outline-rm-theme:hover {
    background: var(--rm-theme) !important;
    color: #fff !important;
}
.btn-rm-theme:disabled,
.btn-rm-theme.disabled { opacity: .65; filter: none; }

/* Independent functional block. */
.rm-ui-card { overflow: visible; }
.rm-ui-card .card-body { min-width: 0; }
.rm-ui-card-title { margin-bottom: 1rem; overflow-wrap: anywhere; }

/* Each wide table receives its own mobile slider. */
.rm-ui-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: scroll !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    padding-bottom: .35rem;
}
.rm-ui-table-scroll > table {
    width: max-content;
    min-width: 760px;
    margin-bottom: 0;
}
.rm-ui-table-scroll:focus {
    outline: 2px solid rgba(var(--rm-theme-rgb), .35);
    outline-offset: 2px;
}
.rm-ui-table-scroll::-webkit-scrollbar { height: 12px; }
.rm-ui-table-scroll::-webkit-scrollbar-track { background: #eef1f4; border-radius: 8px; }
.rm-ui-table-scroll::-webkit-scrollbar-thumb { background: #8b949e; border-radius: 8px; }

/* Standard list header and count badge. */
.rm-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}
.rm-list-title { margin: 0; font-weight: 700; }
.rm-list-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(var(--rm-theme-rgb), .10);
    border: 1px solid rgba(var(--rm-theme-rgb), .25);
    border-radius: 999px;
    color: var(--rm-theme);
    font-size: .75rem;
    padding: .2rem .5rem;
    white-space: nowrap;
}

/* Pagination: summary left, controls and page size bottom-right. */
.rm-pagination-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    padding-top: .75rem;
}
.rm-page-summary { color: #6c757d; font-size: .875rem; }
.rm-pagination-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    flex-wrap: wrap;
    margin-left: auto;
}
.rm-page-size-label {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
    white-space: nowrap;
}
.rm-page-size { width: auto; min-width: 72px; }
.rm-pagination-actions .btn { min-width: 74px; }

/* Common utilities. */
.rm-action-wrap { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rm-required { color: #dc3545; font-weight: 700; }
.readonly-field,
.form-control[readonly],
.form-select[readonly],
textarea[readonly] {
    background-color: #e9ecef !important;
    cursor: not-allowed;
    opacity: 1;
}

@media (max-width: 767.98px) {
    .rm-ui-card .card-body { padding: .85rem; }
    .rm-ui-table-scroll { max-width: calc(100vw - 2.2rem); }
    .rm-ui-table-scroll > table { min-width: 760px; }
    .rm-pagination-nav,
    .rm-pagination-actions { width: 100%; }
    .rm-page-summary { width: 100%; text-align: center; }
    .rm-pagination-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-left: 0;
    }
    .rm-page-size-label { grid-column: 1 / -1; justify-content: flex-end; }
    .rm-pagination-actions .btn { width: 100%; min-height: 44px; }
    .rm-action-wrap .btn { flex: 1 1 auto; }
    .rm-ui-card .form-control,
    .rm-ui-card .form-select,
    .rm-ui-card button,
    .rm-ui-card input { font-size: 16px; }
}

@media (max-width: 359.98px) {
    .rm-pagination-actions { grid-template-columns: 1fr; }
    .rm-page-size-label { grid-column: 1; }
}
