/* Roles Management Styles */

.roles-content {
    padding: 20px;
    background: #f8f9fa;
    min-height: calc(100vh - 60px);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-title-section h2 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 24px;
}

.page-title-section p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-top: 20px;
}

/* DataTables Custom Styling */
.dataTables_wrapper {
    padding: 20px;
}

.dataTables_wrapper .dt-buttons {
    margin-bottom: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dt-button {
    background: #22c55e !important;
    color: white !important;
    border: 1px solid #22c55e !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(34,197,94,0.2) !important;
}

.dt-button:hover {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(34,197,94,0.3) !important;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    width: 250px;
    transition: border-color 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.25);
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    margin: 0 5px;
}

.dataTables_wrapper .dataTables_info {
    font-size: 14px;
    color: #666;
    padding: 15px 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid #ddd !important;
    background: white !important;
    color: #22c55e !important;
    border-radius: 6px !important;
    margin: 0 2px !important;
    padding: 8px 12px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #22c55e !important;
    color: white !important;
    border-color: #22c55e !important;
    transform: translateY(-1px) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #22c55e !important;
    color: white !important;
    border-color: #22c55e !important;
    box-shadow: 0 2px 4px rgba(34,197,94,0.2) !important;
}

/* Table Styling */
#rolesTable {
    width: 100% !important;
    border-collapse: collapse;
}

#rolesTable thead th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 15px;
    border-bottom: 2px solid #dee2e6;
    text-align: left;
    position: relative;
}

#rolesTable thead th:first-child {
    border-top-left-radius: 8px;
}

#rolesTable thead th:last-child {
    border-top-right-radius: 8px;
}

#rolesTable tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f3f4;
    font-size: 14px;
    color: #333;
    vertical-align: middle;
}

#rolesTable tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

#rolesTable tbody tr:last-child td {
    border-bottom: none;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.modal-title {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.25);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* Permissions Search */
.permissions-search {
    position: relative;
    margin-bottom: 15px;
}

.permissions-search .form-input {
    padding-right: 40px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
}

/* Permissions Container */
.permissions-container {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f8f9fa;
    margin-bottom: 15px;
}

.permissions-grid {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
}

.loading-permissions {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
}

.loading-permissions i {
    margin-right: 8px;
    color: #22c55e;
}

.no-permissions {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-permissions i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.no-permissions p {
    margin: 0;
    font-size: 16px;
    color: #999;
}

/* Permission Categories */
.permission-category {
    margin-bottom: 20px;
    background: white;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.permission-category h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #22c55e;
    padding-bottom: 8px;
}

.permission-category h4 i {
    margin-right: 8px;
    color: #22c55e;
}

.permission-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}

.permission-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.permission-item:hover {
    background: #e9ecef;
}

.permission-item input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #22c55e;
}

.permission-item label {
    margin: 0;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    flex: 1;
}

/* Pagination */
.permissions-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-top: 1px solid #ddd;
    background: white;
}

.pagination-info {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Quick Actions */
.permissions-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.quick-select-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.select-all-group,
.clear-group,
.category-group,
.utility-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px;
    border-radius: 6px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.select-all-group {
    background: #e8f5e8;
    border-color: #c3e6c3;
}

.clear-group {
    background: #fff5f5;
    border-color: #fecaca;
}

.category-group {
    background: #f0f8ff;
    border-color: #bfdbfe;
}

.utility-group {
    background: #fef7e0;
    border-color: #fed7aa;
}

.permissions-actions .btn {
    font-size: 13px;
    padding: 6px 12px;
    transition: all 0.2s ease;
}

.permissions-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-outline-info {
    color: #17a2b8;
    border-color: #17a2b8;
}

.btn-outline-info:hover {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
}

.btn-outline-warning:hover {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-outline-success {
    color: #28a745;
    border-color: #28a745;
}

.btn-outline-success:hover {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-outline-dark {
    color: #343a40;
    border-color: #343a40;
}

.btn-outline-dark:hover {
    background-color: #343a40;
    border-color: #343a40;
    color: white;
}

.btn-outline-purple {
    color: #eab308;
    border-color: #eab308;
}

.btn-outline-purple:hover {
    background-color: #eab308;
    border-color: #eab308;
    color: white;
}

.btn-outline-teal {
    color: #20c997;
    border-color: #20c997;
}

.btn-outline-teal:hover {
    background-color: #20c997;
    border-color: #20c997;
    color: white;
}

.btn-outline-orange {
    color: #fd7e14;
    border-color: #fd7e14;
}

.btn-outline-orange:hover {
    background-color: #fd7e14;
    border-color: #fd7e14;
    color: white;
}

.btn-outline-indigo {
    color: #6610f2;
    border-color: #6610f2;
}

.btn-outline-indigo:hover {
    background-color: #6610f2;
    border-color: #6610f2;
    color: white;
}

.btn-outline-red {
    color: #e83e8c;
    border-color: #e83e8c;
}

.btn-outline-red:hover {
    background-color: #e83e8c;
    border-color: #e83e8c;
    color: white;
}

.selected-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Checkbox Styling */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #22c55e;
}

.field-note {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.field-note i {
    margin-right: 5px;
    color: #22c55e;
}

/* Notification Styling */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid #22c55e;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    gap: 10px;
}

.notification-content i {
    margin-top: 2px;
    font-size: 16px;
}

.notification-content span {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: #f0f0f0;
    color: #333;
}

.notification-success {
    border-left-color: #28a745;
}

.notification-error {
    border-left-color: #dc3545;
}

.notification-warning {
    border-left-color: #ffc107;
}

.notification-info {
    border-left-color: #17a2b8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .page-actions {
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-body {
        max-height: 50vh;
    }
    
    .permission-items {
        grid-template-columns: 1fr;
    }
    
    .permissions-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quick-select-buttons {
        justify-content: center;
        gap: 8px;
    }
    
    .select-all-group,
    .clear-group,
    .category-group,
    .utility-group {
        justify-content: center;
        width: 100%;
        margin-bottom: 8px;
    }
    
    .permissions-pagination {
        flex-direction: column;
        gap: 10px;
    }
    
    .dataTables_wrapper {
        padding: 10px;
    }
    
    .dataTables_wrapper .dt-buttons {
        justify-content: center;
    }
    
    .dt-button {
        font-size: 12px !important;
        padding: 6px 12px !important;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        max-width: 200px;
    }
    
    #rolesTable thead th,
    #rolesTable tbody td {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
