/* Role Grid Styles */
.role-grid .card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.role-grid .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.role-grid .table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.875rem;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-grid .table tbody tr:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* Role Type Badges */
.group-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.group-badge.admin {
    background-color: #dc3545;
    color: white;
}

.group-badge.management {
    background-color: #fd7e14;
    color: white;
}

.group-badge.staff {
    background-color: #198754;
    color: white;
}

.group-badge.customer {
    background-color: #0d6efd;
    color: white;
}

/* Status Badges */
.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.status-badge.active {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.status-badge.inactive {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 0.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    transition: all 0.15s ease-in-out;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.action-btn.view {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    color: white;
}

.action-btn.view:hover {
    background-color: #31d2f2;
    border-color: #25cff2;
}

.action-btn.edit {
    background-color: #198754;
    border-color: #198754;
    color: white;
}

.action-btn.edit:hover {
    background-color: #20c997;
    border-color: #1cbbb4;
}

.action-btn.delete {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.action-btn.delete:hover {
    background-color: #e55563;
    border-color: #e04858;
}

.action-btn.assign {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: white;
}

.action-btn.assign:hover {
    background-color: #8a5cf5;
    border-color: #7c50e8;
}

/* Count Badges */
.count-badge {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Loading and Empty States */
.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 0.25em solid #f3f3f3;
    border-top: 0.25em solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Permission Management Styles */
.permission-card {
    transition: all 0.2s ease;
    border: 1px solid #e9ecef;
    cursor: pointer;
}

.permission-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.1);
}

.permission-checkbox:checked + label .permission-card {
    border-color: #0d6efd;
    background-color: #f8f9ff;
}

.permission-module {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.permission-module:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.avatar-lg {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-primary-subtle {
    background-color: rgba(13, 110, 253, 0.1);
}

.module-checkbox:indeterminate {
    background-color: #0d6efd;
    border-color: #0d6efd;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

/* Permission Modal Styles */
#managePermissionsModal .modal-dialog {
    max-width: 1200px;
}

#managePermissionsModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.permission-checkbox {
    margin-right: 0.5rem;
}

.permission-checkbox + label {
    cursor: pointer;
    margin-bottom: 0;
}

.permission-card .card-body {
    padding: 0.75rem;
}

.permission-card .badge {
    font-size: 0.7rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .role-grid .table {
        font-size: 0.875rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.125rem;
    }

    .action-btn {
        width: 28px;
        height: 28px;
    }

    #managePermissionsModal .modal-dialog {
        max-width: 95%;
        margin: 0.5rem auto;
    }

    .permission-module .row .col-md-6 {
        margin-bottom: 1rem;
    }
}
