/* =========================================================
   Modal de Permisos Granulares - Rasta Pets
   ========================================================= */

.modal-permisos {
  max-width: 650px !important;
  width: 92vw;
  border-radius: 16px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 0;
  overflow: hidden;
}

.modal-permisos::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

@layer pages {
:where(.modal-permisos) .permisos-head {
  padding: 20px 24px;
  background: var(--bg-header, #f8fafc);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
}

:where(.modal-permisos) .permisos-head-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

:where(.modal-permisos) .permisos-head-info p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
}

@layer pages {
:where(.modal-permisos) .permisos-user-card {
  margin: 16px 24px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-subtle, #f1f5f9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--primary, #059669);
}



:where(.modal-permisos) .permisos-user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
}

:where(.modal-permisos) .permisos-user-name {
  font-weight: 600;
  color: var(--text-main, #0f172a);
  font-size: 0.95rem;
}

:where(.modal-permisos) .permisos-user-login {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

@layer pages {
:where(.modal-permisos) .permisos-body {
  padding: 8px 24px 20px 24px;
  max-height: 55vh;
  overflow-y: auto;
}



:where(.modal-permisos) .permisos-categoria {
  margin-bottom: 20px;
}
}

:where(.modal-permisos) .permisos-categoria-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #64748b);
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

@layer pages {
:where(.modal-permisos) .permisos-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
}

@media (min-width: 580px) {
  @layer pages {
:where(.modal-permisos) .permisos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
}

@layer pages {
:where(.modal-permisos) .permiso-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  background: var(--bg-surface, #ffffff);
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}



:where(.modal-permisos) .permiso-card:hover {
  border-color: var(--primary-light, #a7f3d0);
  background: var(--bg-hover, #f0fdf4);
}



:where(.modal-permisos) .permiso-card.is-active {
  border-color: var(--primary, #059669);
  background: var(--bg-active, #ecfdf5);
}



:where(.modal-permisos) .permiso-info {
  flex: 1;
  padding-right: 12px;
}
}

:where(.modal-permisos) .permiso-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main, #1e293b);
  margin-bottom: 2px;
}

:where(.modal-permisos) .permiso-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  line-height: 1.3;
}

/* Switch Toggle UI */
:where(.modal-permisos) .switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

:where(.modal-permisos) .switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

@layer pages {
:where(.modal-permisos) .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 22px;
}



:where(.modal-permisos) .slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}



:where(.modal-permisos) input:checked + .slider {
  background-color: var(--primary, #059669);
}



:where(.modal-permisos) input:checked + .slider:before {
  transform: translateX(16px);
}
}

:where(.modal-permisos) .permisos-banner-admin {
  padding: 14px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e40af;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

@layer pages {
:where(.modal-permisos) .permisos-footer {
  padding: 16px 24px;
  background: var(--bg-footer, #f8fafc);
  border-top: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
}

:where(.modal-permisos) .btn-perm-cancel {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: #ffffff;
  color: var(--text-main, #334155);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

:where(.modal-permisos) .btn-perm-cancel:hover {
  background: #f1f5f9;
}

:where(.modal-permisos) .btn-perm-save {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: var(--primary, #059669);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

:where(.modal-permisos) .btn-perm-save:hover {
  background: var(--primary-dark, #047857);
}

:where(.modal-permisos) .btn-perm-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
