/*--------------------------------------------------------------
# Roles & Permissions Page - EliteAdmin
--------------------------------------------------------------*/

.page-roles {

  /* Subtitle */
  .roles-subtitle {
    font-size: 0.8125rem;
    color: var(--muted-color);
  }

  /* Roles List */
  .roles-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color-light);
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .roles-item:last-child {
    border-bottom: none;
  }

  .roles-item:hover {
    background: var(--background-color);
  }

  .roles-item.active {
    background: color-mix(in srgb, var(--accent-color), transparent 94%);
    border-left: 3px solid var(--accent-color);
    padding-left: calc(var(--spacing-lg) - 3px);
  }

  .roles-item.active .roles-item-name {
    color: var(--accent-color);
  }

  .roles-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
  }

  .roles-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .roles-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--heading-color);
  }

  .roles-item-count {
    font-size: 0.75rem;
    color: var(--muted-color);
  }

  .roles-item-edit {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    border: none;
    background: none;
    color: var(--muted-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
  }

  .roles-item:hover .roles-item-edit {
    opacity: 1;
  }

  .roles-item-edit:hover {
    background: var(--background-color);
    color: var(--accent-color);
  }

  /* Role Details */
  .roles-detail-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .roles-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .roles-detail-label {
    font-size: 0.75rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
  }

  .roles-detail-value {
    font-size: 0.875rem;
    color: var(--heading-color);
    line-height: 1.5;
  }

  /* Permissions Table */
  .roles-perm-table {
    font-size: 0.875rem;
  }

  .roles-perm-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-color);
    border-bottom-width: 2px;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .roles-perm-table td {
    vertical-align: middle;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .roles-perm-group td {
    background: var(--background-color);
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--heading-color);
    padding-top: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
  }

  .roles-perm-module {
    padding-left: var(--spacing-xl);
    color: var(--default-color);
  }

  .roles-perm-na {
    color: var(--light-color);
    font-size: 0.75rem;
  }

  .roles-perm-table .form-check-input {
    cursor: pointer;
    width: 1.125rem;
    height: 1.125rem;
  }

  .roles-perm-table .form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
  }

  /* Users with Role */
  .roles-user-count {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-color);
    background: var(--background-color);
    padding: 2px 10px;
    border-radius: var(--radius-full);
  }

  .roles-users-list {
    display: flex;
    flex-direction: column;
  }

  .roles-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color-light);
  }

  .roles-user:last-child {
    border-bottom: none;
  }

  .roles-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
  }

  .roles-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .roles-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--heading-color);
  }

  .roles-user-email {
    font-size: 0.75rem;
    color: var(--muted-color);
  }

  .roles-user-status {
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
  }

  .roles-user-status.active {
    background: var(--success-color-light);
    color: var(--success-color);
  }

  .roles-user-date {
    font-size: 0.75rem;
    color: var(--muted-color);
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Color Picker in Modal */
  .roles-color-options {
    display: flex;
    gap: var(--spacing-sm);
  }

  .roles-color-option {
    cursor: pointer;
    position: relative;
  }

  .roles-color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .roles-color-swatch {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
  }

  .roles-color-option input:checked + .roles-color-swatch {
    border-color: var(--heading-color);
    box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--heading-color);
  }
}

/* Responsive */

@media (max-width: 767px) {
  .page-roles {
    .roles-user {
      flex-wrap: wrap;
    }

    .roles-user-date {
      display: none;
    }

    .roles-perm-module {
      padding-left: var(--spacing-md);
    }
  }
}
