/* File: profile-switcher.css | Version: 1.00 | Date: 2026-06-05 */

/* ── Wrapper & Backdrop ────────────────────────────────────────── */
.ps-wrapper {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}

.ps-wrapper[hidden] {
  display: none !important;
}

.ps-wrapper.ps-visible {
  opacity: 1;
  pointer-events: all;
}

.ps-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ── Sheet ─────────────────────────────────────────────────────── */
.ps-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: var(--bg-white, #fff);
  border-radius: 20px 20px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, .12);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32, .72, 0, 1);
  overflow: hidden;
}

.ps-wrapper.ps-visible .ps-sheet {
  transform: translateY(0);
}

/* ── Header ────────────────────────────────────────────────────── */
.ps-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-color, #ebebeb);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted, #888);
}

/* Drag Handle */
.ps-header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color, #ddd);
}

/* ── Kacheln-Grid ──────────────────────────────────────────────── */
.ps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 20px 8px;
  justify-content: center;
  max-height: 56vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Einzelne Kachel ───────────────────────────────────────────── */
.ps-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px 12px;
  width: calc(33.33% - 8px);
  min-width: 88px;
  max-width: 120px;
  border-radius: 14px;
  background: var(--bg-card, #f7f7f7);
  cursor: pointer;
  border: 2px solid transparent;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ps-tile:hover,
.ps-tile:focus-visible {
  background: var(--bg-hover, #efefef);
  border-color: var(--accent, #4caf50);
  outline: none;
}

.ps-tile:active {
  transform: scale(.96);
}

.ps-tile--loading {
  opacity: .55;
  pointer-events: none;
}

.ps-tile--loading .ps-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent, #4caf50);
  animation: ps-spin .7s linear infinite;
}

/* ── Avatar ────────────────────────────────────────────────────── */
.ps-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.ps-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ps-avatar-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light, #e8f5e9);
  color: var(--accent, #4caf50);
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: 50%;
}

/* ── Name & E-Mail ─────────────────────────────────────────────── */
.ps-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary, #222);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.ps-email {
  font-size: .68rem;
  color: var(--text-muted, #888);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Fingerprint-Badge ─────────────────────────────────────────── */
.ps-bio-badge {
  position: absolute;
  bottom: 42px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent, #4caf50);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ps-bio-badge .material-symbols-outlined {
  font-size: 13px;
  color: #fff;
}

/* ── Löschen-Button ────────────────────────────────────────────── */
.ps-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease;
  padding: 0;
}

.ps-tile:hover .ps-delete,
.ps-tile:focus-within .ps-delete {
  opacity: 1;
}

.ps-delete:hover {
  background: rgba(220, 53, 69, .15);
}

.ps-delete .material-symbols-outlined {
  font-size: 14px;
  color: var(--text-muted, #777);
}

.ps-delete:hover .material-symbols-outlined {
  color: #dc3545;
}

/* ── "Anderen Account" Button ──────────────────────────────────── */
.ps-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 40px);
  margin: 8px 20px 20px;
  padding: 12px 16px;
  border: 2px dashed var(--border-color, #ddd);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted, #888);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.ps-add-btn:hover {
  border-color: var(--accent, #4caf50);
  color: var(--accent, #4caf50);
}

.ps-add-btn .material-symbols-outlined {
  font-size: 18px;
}

/* ── Error States ──────────────────────────────────────────────── */
.ps-tile-err {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: #dc3545;
  color: #fff;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
}

.ps-sheet-err {
  margin: 12px 20px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff3cd;
  color: #856404;
  font-size: .8rem;
  text-align: center;
}

/* ── Animations ────────────────────────────────────────────────── */
@keyframes ps-spin {
  to { transform: rotate(360deg); }
}

/* ── Dark Mode ─────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .ps-sheet {
    background: var(--bg-white, #1c1c1e);
    box-shadow: 0 -4px 32px rgba(0, 0, 0, .4);
  }
  .ps-tile {
    background: var(--bg-card, #2c2c2e);
  }
  .ps-tile:hover,
  .ps-tile:focus-visible {
    background: var(--bg-hover, #3a3a3c);
  }
  .ps-delete {
    background: rgba(255, 255, 255, .08);
  }
  .ps-delete:hover {
    background: rgba(220, 53, 69, .25);
  }
  .ps-add-btn {
    border-color: rgba(255, 255, 255, .15);
    color: rgba(255, 255, 255, .4);
  }
  .ps-header::before {
    background: rgba(255, 255, 255, .18);
  }
}

/* ── Responsive: größere Kacheln auf Tablet ────────────────────── */
@media (min-width: 480px) {
  .ps-tile {
    width: calc(25% - 10px);
    max-width: 110px;
  }
}
