/* =========================================
   ROLE PERMISSIONS PAGE  (Add / Edit Role)
   ========================================= */

.rp-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Breadcrumb ───────────────────────── */
.rp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #6b7280;
    margin-bottom: 2px;
}

.rp-breadcrumb-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.rp-breadcrumb-link:hover {
    text-decoration: underline;
}

.rp-breadcrumb-sep {
    color: #9ca3af;
}

.rp-breadcrumb-current {
    color: #374151;
    font-weight: 500;
}

/* ── Page header ─────────────────────── */
.rp-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.rp-page-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.rp-page-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
    font-weight: 400;
}

/* ── Cards ───────────────────────────── */
.rp-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #ebebeb;
    overflow: hidden;
}

.rp-card-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.rp-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 2px;
}

.rp-card-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
}

.rp-card-body {
    padding: 20px;
}

.rp-card-body-noPad {
    padding: 0;
}

/* ── Role Details form ────────────────── */
.rp-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    align-items: start;
}

.rp-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rp-helper-text {
    font-size: 11.5px;
    color: #854d0e;
    line-height: 1.35;
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    margin-top: 3px;
}

.rp-helper-text svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    margin-top: 1px;
    stroke: #ca8a04;
}

.rp-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
}

.rp-label .required-star {
    color: #ef4444;
    margin-left: 2px;
}

.rp-input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #1f2937;
    outline: none;
    transition: border-color 0.15s;
    height: 38px;
    box-sizing: border-box;
    width: 100%;
}

.rp-input:focus {
    border-color: #9CA3AF;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.2);
    outline: none;
}

.rp-input-readonly {
    background-color: #f3f4f6 !important;
    cursor: not-allowed !important;
    color: #6b7280 !important;
}

.rp-form-group .dialog-dropdown.rp-input-readonly,
.rp-form-group .dialog-dropdown.rz-state-disabled {
    background-color: #f3f4f6 !important;
    border-color: #d1d5db !important;
    cursor: not-allowed !important;
}

.rp-form-group .dialog-dropdown.rp-input-readonly .rz-dropdown-label,
.rp-form-group .dialog-dropdown.rz-state-disabled .rz-dropdown-label {
    color: #6b7280 !important;
    cursor: not-allowed !important;
}

.rp-form-group .dialog-dropdown.rp-input-readonly .rz-dropdown-trigger,
.rp-form-group .dialog-dropdown.rz-state-disabled .rz-dropdown-trigger {
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

/* ── Permission table ─────────────────── */
.rp-permission-error {
    margin: 12px 20px 0;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 12.5px;
}

.rp-perm-table {
    width: 100%;
    border-collapse: collapse;
}

.rp-perm-table thead tr {
    border-bottom: 1px solid #e1e5ea;
    background-color: #f8fafc;
}

.rp-perm-table th {
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #555555;
    background-color: #f8fafc;
    border-bottom: 1px solid #e1e5ea;
    white-space: nowrap;
    text-align: center;
}

.rp-perm-module-col {
    text-align: left !important;
    padding-left: 20px !important;
    width: 36%;
}

.rp-perm-check-col {
    width: calc(64% / 5);
    min-width: 80px;
}

.rp-perm-table td {
    padding: 12px 16px;
    font-size: 13px;
    color: #1f2937;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
    text-align: center;
}

.rp-perm-table tbody tr:last-child td {
    border-bottom: none;
}

.rp-perm-table tbody tr:hover td {
    background-color: #fafafa;
}

.rp-perm-module-name {
    text-align: left !important;
    padding-left: 20px !important;
    font-weight: 500;
    color: #374151;
}

.rp-perm-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.rp-perm-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

.rp-perm-na {
    color: #d1d5db;
    font-size: 16px;
    font-weight: 400;
}

/* ── Section Header Row ──────────────── */
.rp-section-header-row td {
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    background-color: #f8fafc;
    border-top: 1px solid #e1e5ea !important;
    border-bottom: 1px solid #e1e5ea !important;
    vertical-align: middle;
    text-align: center;
}

.rp-section-header-cell {
    text-align: left !important;
    padding-left: 20px !important;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: 0.1px;
}

.rp-section-clickable {
    cursor: pointer;
    user-select: none;
}

.rp-section-clickable:hover {
    background-color: #f1f5f9 !important;
}

.rp-section-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rp-section-chevron {
    color: #64748b;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.rp-section-chevron.expanded {
    transform: rotate(90deg);
}

/* ── Single Section Row (e.g. PMR Management) ─── */
.rp-single-section-row td {
    padding: 12px 16px;
    font-size: 13px;
    color: #1f2937;
    background-color: #ffffff;
    border-bottom: 1px solid #e1e5ea !important;
    border-top: none;
    vertical-align: middle;
    text-align: center;
}

.rp-single-section-name {
    text-align: left !important;
    padding-left: 20px !important;
    font-weight: 600;
    color: #1e293b;
}

.rp-single-section-row:hover td {
    background-color: #fafafa;
}

/* ── Submodule Rows (inside section) ──── */
.rp-submodule-row td {
    padding: 10px 16px;
    font-size: 13px;
    color: #374151;
    background-color: #ffffff;
    border-top: none !important;
    border-bottom: none !important;
    vertical-align: middle;
    text-align: center;
}

.rp-submodule-row:hover td {
    background-color: #fafafa;
}

/* Submodule name indented to the right side */
.rp-submodule-name {
    text-align: left !important;
    padding-left: 38px !important;
    font-weight: 400;
    color: #374151;
}

/* Last submodule row in a section has bottom separator line before next section */
.rp-submodule-row.rp-section-last td {
    border-bottom: 1px solid #e1e5ea !important;
}

/* ── Footer ──────────────────────────── */
.rp-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 4px;
}

.rp-cancel-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s;
}

.rp-cancel-btn:hover {
    background-color: #f9fafb;
}

.rp-save-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 22px;
    border: none;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.rp-save-btn:hover {
    opacity: 0.88;
}

/* ── Responsive ──────────────────────── */
@media (max-width: 600px) {

    .rp-perm-table th,
    .rp-perm-table td {
        padding: 10px 8px;
        font-size: 11.5px;
    }

    .rp-perm-module-col,
    .rp-perm-module-name {
        padding-left: 12px !important;
    }
}

/* ── Active-Users Info Banner ─────────── */
.rp-role-note {
    margin-top: 16px;
}

.rp-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background-color: #FEF9C3;
    border: 1px solid #FACC15;
    border-left: 4px solid #EAB308;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: #854D0E;
    margin-top: 4px;
}

.rp-info-icon {
    width: 18px;
    height: 18px;
    stroke: #CA8A04;
    stroke-width: 2;
    flex-shrink: 0;
    margin-top: 2px;
}

.rp-info-text {
    line-height: 1.55;
    color: #854D0E;
}