/* =========================================
   ROLE BASED ACCESS PAGE
   ========================================= */

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

.role-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

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

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

.role-add-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.role-add-btn:hover { opacity: 0.88; }

.role-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #ebebeb;
    overflow: hidden;
}

.role-filter-row {
    display: flex;
    justify-content: flex-end;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
}

.role-search-wrapper {
    position: relative;
    width: 220px;
}

.role-search-select {
    width: 100%;
    appearance: none;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 7px 32px 7px 12px;
    font-size: 12.5px;
    color: #9ca3af;
    cursor: pointer;
    outline: none;
}

.role-search-chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #aab0bc;
    font-size: 11px;
}

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

.role-table thead tr { border-bottom: 1px solid #f0f0f0; }

.role-table th {
    padding: 12px 18px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}

.role-table th:nth-child(1),
.role-table td:nth-child(1) {
    width: 24%;
    padding-left: 24px;
    text-align: left;
}

.role-table th:nth-child(2),
.role-table td:nth-child(2) {
    width: 20%;
    text-align: left;
}

.role-table th:nth-child(3),
.role-table td:nth-child(3) {
    width: 20%;
    text-align: center !important;
}

.role-table th:nth-child(4),
.role-table td:nth-child(4) {
    width: 20%;
    text-align: left;
}

.role-table th:nth-child(5),
.role-table td:nth-child(5) {
    width: 16%;
    padding-right: 24px;
    text-align: center !important;
}

.role-table td {
    padding: 13px 18px;
    font-size: 13px;
    color: #1f2937;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
}

.role-table tbody tr:last-child td { border-bottom: none; }
.role-table tbody tr:hover td { background-color: #fafafa; }

/* Render text exactly as stored, preserving multiple consecutive spaces. */
.role-table td.preserve-spaces {
    white-space: pre-wrap;
    word-break: break-word;
}

.role-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
}

    .role-status-badge.active {
        background-color: #E8F6ED;
        color: #16A34A;
    }
.role-status-badge.inactive { background-color: #f3f4f6; color: #6b7280; }

.role-action-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center !important;
}

.role-toggle {
    position: relative;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}

.role-toggle input { opacity: 0; width: 0; height: 0; }

.role-toggle-slider {
    position: absolute;
    inset: 0;
    background-color: #d1d5db;
    border-radius: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.role-toggle input:checked + .role-toggle-slider { background-color: #22c55e; }

.role-toggle-slider::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.role-toggle input:checked + .role-toggle-slider::before { transform: translateX(16px); }

.role-action-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.role-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #d9e0e7;
    background-color: #ffffff;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    box-sizing: border-box;
    padding: 0;
}

.role-icon-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke-width: 2;
}

.role-icon-btn.edit {
    border-color: #d9e0e7;
    background-color: #ffffff;
}

.role-icon-btn.edit:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.role-icon-btn.edit svg {
    stroke: #4a5568;
}

.role-icon-btn.delete {
    border-color: #eaeaea;
    background-color: #ffffff;
}

.role-icon-btn.delete:hover {
    background-color: #fee2e2;
    border-color: #ef4444;
}

.role-icon-btn.delete svg {
    stroke: #ef4444;
}

