/* Role Form Container */
.role_form_container {
    width: 100%;
    max-width: 1536px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header Section */
.role_form_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    width: 100%;
}

.role_form_header_left {
    display: flex;
    align-items: center;
    gap: 0px;
}

.role_form_back_button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #1a1a1a;
    transition: background-color 0.2s ease;
}

.role_form_back_button svg {
    width: 24px;
    height: 24px;
}

.role_form_title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
}

.role_form_header_right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.role_form_cancel_button,
.role_form_save_button {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.5;
    text-transform: capitalize;
}

.role_form_cancel_button {
    background: #ffffff;
    color: var(--primary);
    border-color: var(--primary);
}

.role_form_save_button {
    background: var(--primary);
    color: var(--primary-text);
    border-color: var(--primary);
}

.role_form_save_button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.role_form_save_button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.role_form_save_button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-top-color: transparent;
    border-radius: 50%;
    animation: role-form-spin 0.6s linear infinite;
}

@keyframes role-form-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Sections Container */
.role_form_sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 580px;
    background: #f7f8fa;
    padding: 20px;
    border-radius: 20px;
}

.role_form_section {
    background: #ffffff;
    padding: 24px;
    border-radius: 20px;
}

.role_form_section_title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    padding-bottom: 10px;
}

.role_form_section_subtext {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.role_form_section_fields {
    margin-top: 16px;
    gap: 24px;
    display: flex;
    flex-direction: column;
}

.role_form_permissions {
    margin-top: 16px;
}

/* Permissions Container */
.role_form_permissions_container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}

/* Module Permission Container */
.role_form_module_permission {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    margin: 0;
    background: #ffffff;
}

/* Module Header */
.role_form_module_header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    background-color: #f3f4f6;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px 8px 0 0;
}

.role_form_module_title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
    text-wrap: nowrap;
}

.role_form_full_access {
    display: flex;
    align-items: center;
    font-size: 14px;
}

/* Custom Checkbox Styles */
.role_form_custom_checkbox_label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.role_form_custom_checkbox_label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role_form_custom_checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.role_form_custom_checkbox_label input[type="checkbox"]:checked + .role_form_custom_checkbox {
    background-color: var(--primary);
    border-color: var(--primary);
}

.role_form_checkbox_icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.role_form_custom_checkbox_label input[type="checkbox"]:checked + .role_form_custom_checkbox .role_form_checkbox_icon {
    opacity: 1;
}

.role_form_checkbox_icon svg {
    width: 14px;
    height: 14px;
    color: var(--primary-text);
    stroke: var(--primary-text);
}

.role_form_checkbox_label_text {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    user-select: none;
}

.role_form_full_access .role_form_checkbox_label_text {
    font-weight: 500;
}

/* Submodule */
.role_form_submodule {
    padding: 16px 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.role_form_submodule:last-child {
    border-bottom: none;
}

.role_form_submodule_name {
    margin: 0;
    width: 20%;
    flex-shrink: 0;
}

.role_form_submodule_name p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

/* Submodule Permissions */
.role_form_submodule_permissions {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 16px;
    align-items: center;
}

/* Permission Item */
.role_form_permission_item {
    display: flex;
    align-items: center;
    font-size: 14px;
}

.role_form_permission_item .role_form_checkbox_label_text {
    font-weight: 400;
}

/* Responsive Design for Permissions */
@media (max-width: 768px) {
    .role_form_module_header {
        flex-direction: row;
        align-items: center;
        padding: 16px;
        justify-content: space-between;
    }

    .role_form_sections{
        background: transparent;
    }
    
    .role_form_submodule {
        flex-direction: column;
        gap: 12px;
    }

    .role_form_submodule_name {
        width: 100%;
    }

    .role_form_submodule_permissions {
        width: 100%;
        justify-content: flex-start;
    }

    .role_form_section_title{
        margin: 16px 0 0 0;
    }
    
    .role_form_header{
        margin-bottom: 0px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .role_form_container {
        padding: 16px;
    }

    .role_form_header_right {
        width: 100%;
        justify-content: flex-end;
    }

    .role_form_cancel_button,
    .role_form_save_button {
        flex: 1;
        max-width: 120px;
    }

    .role_form_section {
        padding: 16px;
    }

    .role_form_title {
        font-size: 20px;
    }

    .role_form_sections{
        width: 100%;
    }
}

@media (max-width: 480px) {
    .role_form_header_left {
        width: 100%;
    }

    .role_form_cancel_button,
    .role_form_save_button {
        width: 100%;
        max-width: none;
        min-width: fit-content;
    }
}
