/* Passkeys (accu_keys) UI. Self-contained, scoped to .accu_keys-* so it is safe on
   both the admin login/profile pages and the client portal. */

/* The angle the light sits at as it travels the button's edge. A custom
   property has to be registered before it can be animated; where that is not
   supported the ring simply holds still. */
@property --ak-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.accu_keys-login {
  --ak-accent: #6d5efc;
  --ak-accent-2: #37b6ff;
  --ak-ink: #2a2550;
  margin-top: 18px;
}

.accu_keys-manage {
  --ak-accent: #6d5efc;
  --ak-accent-2: #37b6ff;
  --ak-ink: #2a2550;
  margin-top: 8px;
}

/* "or" divider on the login page */
.accu_keys-or {
  position: relative;
  text-align: center;
  margin: 6px 0 16px;
  color: #9a9ab5;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.accu_keys-or::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120, 120, 160, .35), transparent);
}
.accu_keys-or span {
  position: relative;
  padding: 0 12px;
  background: inherit;
}

/* Buttons */
.accu_keys-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 20px;
  border: 1px solid rgba(109, 94, 252, .45);
  border-radius: 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(244, 244, 255, .75)),
    linear-gradient(120deg, var(--ak-accent), var(--ak-accent-2));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  color: var(--ak-ink);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .8) inset,
    0 8px 22px -12px rgba(80, 70, 190, .65);
  transition: transform .18s ease, box-shadow .25s ease, opacity .2s ease;
  position: relative;
  overflow: hidden;
}
.accu_keys-btn-login {
  width: 100%;
}
.accu_keys-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 14px 30px -12px rgba(80, 70, 190, .8);
}
.accu_keys-btn:active {
  transform: translateY(0);
}
.accu_keys-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(109, 94, 252, .35),
    0 10px 26px -12px rgba(80, 70, 190, .7);
}
.accu_keys-btn[disabled] {
  opacity: .6;
  cursor: default;
  transform: none;
}

/* A light travelling around the login button's edge. It is drawn as a ring:
   the gradient fills the whole button, then a mask keeps only the outermost
   1.5px, so the light follows the corners instead of sweeping across the face
   the way a rotated square does on a wide button. */
.accu_keys-btn-login::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--ak-angle),
      rgba(109, 94, 252, 0) 0deg,
      rgba(109, 94, 252, 0) 200deg,
      rgba(55, 182, 255, .85) 290deg,
      rgba(109, 94, 252, .95) 330deg,
      rgba(109, 94, 252, 0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: accu_keys-border-travel 5.5s linear infinite;
  z-index: 0;
  pointer-events: none;
}
.accu_keys-btn-login > * {
  position: relative;
  z-index: 1;
}
@keyframes accu_keys-border-travel {
  to { --ak-angle: 360deg; }
}

.accu_keys-btn-key {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background: linear-gradient(120deg, var(--ak-accent), var(--ak-accent-2));
  -webkit-mask: var(--ak-key) center / contain no-repeat;
  mask: var(--ak-key) center / contain no-repeat;
  --ak-key: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2a8 8 0 0 0-7.75 10.02L2 16.27V22h5.73l.7-.7v-2.12h2.12l1.42-1.42v-2.12h1.32A8 8 0 1 0 14 2Zm4 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Z'/%3E%3C/svg%3E");
}

/* Management panel */
.accu_keys-sep {
  margin: 22px 0 14px;
  border: 0;
  border-top: 1px solid rgba(120, 120, 160, .22);
}
.accu_keys-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.accu_keys-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ak-ink);
}
.accu_keys-count-label {
  font-weight: 500;
  font-size: 13px;
}
.accu_keys-btn-add {
  padding: 8px 15px;
  font-size: 13px;
  border-radius: 11px;
}

.accu_keys-list {
  display: flex;
  flex-direction: column;
}
.accu_keys-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(120, 120, 160, .16);
}
.accu_keys-row:last-child {
  border-bottom: 0;
}
.accu_keys-row-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--ak-accent);
  background: linear-gradient(180deg, rgba(109, 94, 252, .14), rgba(55, 182, 255, .12));
  box-shadow: inset 0 0 0 1px rgba(109, 94, 252, .18);
}
.accu_keys-row-icon svg {
  width: 18px;
  height: 18px;
}
.accu_keys-row-main {
  flex: 1 1 auto;
  min-width: 0;
}
.accu_keys-row-name {
  font-weight: 600;
  color: var(--ak-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.accu_keys-row-meta {
  font-size: 12px;
  color: #8a8aa5;
  margin-top: 2px;
}
.accu_keys-row-actions {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
  opacity: .55;
  transition: opacity .2s ease;
}
.accu_keys-row:hover .accu_keys-row-actions,
.accu_keys-row:focus-within .accu_keys-row-actions {
  opacity: 1;
}
.accu_keys-icon {
  border: 0;
  background: transparent;
  color: #7a7a97;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .18s ease, color .18s ease;
}
.accu_keys-icon svg {
  width: 16px;
  height: 16px;
}
.accu_keys-icon:hover {
  background: rgba(109, 94, 252, .12);
  color: var(--ak-accent);
}
.accu_keys-delete:hover {
  background: rgba(224, 82, 99, .12);
  color: #e05263;
}
.accu_keys-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(109, 94, 252, .3);
}

.accu_keys-empty {
  padding: 16px 4px;
  color: #8a8aa5;
  font-size: 13px;
}

/* messages: soft tinted surfaces, restrained corners, no pills */
.accu_keys-msg {
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  border-left: 3px solid transparent;
}
.accu_keys-msg-info {
  background: rgba(55, 182, 255, .1);
  border-left-color: var(--ak-accent-2);
  color: #276b8f;
}
.accu_keys-msg-success {
  background: rgba(64, 190, 140, .12);
  border-left-color: #2fae7e;
  color: #1f7d59;
}
.accu_keys-msg-error {
  background: rgba(224, 82, 99, .1);
  border-left-color: #e05263;
  color: #b23a49;
}

@media (prefers-reduced-motion: reduce) {
  .accu_keys-btn,
  .accu_keys-row-actions {
    transition: none;
  }
  .accu_keys-btn-login::after {
    animation: none;
    display: none;
  }
}
