/**
 * people-app.css — Standalone People/Contacts App.
 *
 * Warm terracotta/amber gradient, avatar-centric layout.
 */

/* ── Container ───────────────────────────────────────────────────── */

.papp {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 44px) + 12px) 16px
           calc(env(safe-area-inset-bottom, 0px) + 80px);
  background: linear-gradient(170deg,
    #1a0f08 0%, #2a1810 45%, #120a06 100%);
  color: #f0f0f0;
  position: relative;
}

.papp::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 30% 10%, rgba(217, 119, 6, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 80% 55%, rgba(180, 83, 9, 0.05), transparent);
  pointer-events: none;
}

/* ── Back Button ─────────────────────────────────────────────────── */

.papp-back {
  position: fixed;
  top: calc(env(safe-area-inset-top, 44px) + 10px);
  left: 14px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  -webkit-tap-highlight-color: transparent;
}

.papp-back:active { background: rgba(0, 0, 0, 0.55); }

/* ── Hero ────────────────────────────────────────────────────────── */

.papp-hero {
  text-align: center;
  padding: 28px 0 20px;
  position: relative;
}

.papp-hero-count {
  font-size: 4rem;
  font-weight: 200;
  line-height: 1;
}

.papp-hero-label {
  font-size: 1rem;
  opacity: 0.6;
  margin-top: 6px;
}

/* ── Search ──────────────────────────────────────────────────────── */

.papp-search {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 11px 16px;
  color: #f0f0f0;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  margin-bottom: 16px;
  -webkit-appearance: none;
}

.papp-search:focus { border-color: rgba(251, 191, 36, 0.4); }
.papp-search::placeholder { color: rgba(255, 255, 255, 0.3); }

/* ── Birthday section ────────────────────────────────────────────── */

.papp-bday-section {
  margin-bottom: 16px;
}

.papp-section-lbl {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.45;
  font-weight: 600;
  margin-bottom: 10px;
}

.papp-bday-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.papp-bday-list::-webkit-scrollbar { display: none; }

.papp-bday-card {
  flex-shrink: 0;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 14px;
  padding: 12px 16px;
  text-align: center;
  min-width: 100px;
}

.papp-bday-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 6px;
}

.papp-bday-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.papp-bday-date {
  font-size: 0.72rem;
  opacity: 0.5;
  margin-top: 2px;
}

/* ── Person list ─────────────────────────────────────────────────── */

.papp-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 14px;
  position: relative;
}

.papp-person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.papp-person:last-child { border-bottom: none; }
.papp-person:active { background: rgba(255, 255, 255, 0.04); }

.papp-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.papp-person-info { flex: 1; min-width: 0; }

.papp-person-name {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.papp-person-rel {
  font-size: 0.75rem;
  opacity: 0.45;
  margin-top: 1px;
}

.papp-person-last {
  font-size: 0.72rem;
  opacity: 0.35;
  text-align: right;
  white-space: nowrap;
}

/* ── Add form ────────────────────────────────────────────────────── */

.papp-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: #fbbf24;
  padding: 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  -webkit-tap-highlight-color: transparent;
}

.papp-add-btn:active { background: rgba(251, 191, 36, 0.25); }

.papp-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  animation: papp-slide 0.25s ease;
}

.papp-form.open { display: flex; }

@keyframes papp-slide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.papp-form-row { display: flex; gap: 8px; }

.papp-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: #f0f0f0;
  font-size: 0.88rem;
  outline: none;
  -webkit-appearance: none;
}

.papp-input:focus { border-color: rgba(251, 191, 36, 0.4); }
.papp-input::placeholder { color: rgba(255, 255, 255, 0.3); }

.papp-save-btn {
  background: #d97706;
  border: none;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.papp-save-btn:active { opacity: 0.7; }

/* ── Empty ───────────────────────────────────────────────────────── */

.papp-empty {
  text-align: center;
  padding: 32px 16px;
  opacity: 0.4;
}

.papp-empty-icon { font-size: 2.5rem; margin-bottom: 8px; }
.papp-empty-text { font-size: 0.9rem; }

/* ── Toast ───────────────────────────────────────────────────────── */

.papp-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #d97706;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 26px;
  z-index: 200;
  animation: papp-toast-in 0.3s ease, papp-toast-out 0.3s ease 2s forwards;
  pointer-events: none;
}

@keyframes papp-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes papp-toast-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (min-width: 500px) {
  .papp { padding-left: 24px; padding-right: 24px; }
  .papp-hero-count { font-size: 4.5rem; }
}

/* PE6: avatar emoji */
.papp-avatar--emoji {
  background: rgba(255,255,255,0.08);
  font-size: 1.3rem;
  line-height: 1;
}
.papp-emoji-picker { margin-bottom: 10px; }
.papp-emoji-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.papp-emoji-opt {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,0.06); transition: background 0.15s;
}
.papp-emoji-opt:hover { background: rgba(255,255,255,0.14); }
.papp-emoji-opt.active { background: var(--color-teal, #33A199); box-shadow: 0 0 0 2px var(--color-teal, #33A199); }
.papp-emoji-opt--clear { font-size: 0.85rem; opacity: 0.5; }

/* PE8: label filter chips */
.papp-filter-chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.papp-filter-chips::-webkit-scrollbar { display: none; }
.papp-chip {
  flex-shrink: 0; padding: 5px 12px; border-radius: 16px; font-size: 0.8rem;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08); transition: all 0.15s;
}
.papp-chip:hover { background: rgba(255,255,255,0.1); }
.papp-chip.active { background: var(--color-teal, #33A199); color: #fff; border-color: var(--color-teal, #33A199); }

/* ── Slide-out detail drawer ─────────────────────────────────────── */
.papp-drawer-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);
  animation: papp-fade-in 0.2s ease;
}
@keyframes papp-fade-in { from { opacity: 0; } to { opacity: 1; } }

.papp-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw);
  z-index: 100; background: #1a1a1f; color: rgba(255,255,255,0.92);
  transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
  box-shadow: -8px 0 24px rgba(0,0,0,0.4);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.papp-drawer--open { transform: translateX(0); }
.papp-drawer[aria-hidden="true"] { pointer-events: none; }
.papp-drawer--open[aria-hidden="false"] { pointer-events: auto; }

.papp-drawer-inner { padding: 18px 16px 32px; }

.papp-drawer-header {
  position: relative; padding: 8px 0 14px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 14px;
  text-align: center;
}
.papp-drawer-close {
  position: absolute; top: 0; right: 0; width: 36px; height: 36px;
  border: 0; background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7);
  border-radius: 50%; font-size: 1rem; cursor: pointer;
}
.papp-drawer-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.papp-drawer-avatar { display: flex; justify-content: center; margin: 6px 0 10px; }
.papp-drawer-avatar-img { width: 56px; height: 56px; font-size: 1.2rem; }
.papp-drawer-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.papp-drawer-meta { font-size: 0.82rem; opacity: 0.65; margin-top: 4px; }
.papp-drawer-meta--muted { opacity: 0.4; font-size: 0.74rem; }

.papp-drawer-actions { display: flex; gap: 8px; margin: 8px 0 14px; }

.papp-drawer-section {
  padding: 10px 0 14px; border-top: 1px solid rgba(255,255,255,0.04);
}
.papp-drawer-section:first-of-type { border-top: 0; padding-top: 0; }

.papp-drawer-ix { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.papp-drawer-ix-row {
  display: flex; align-items: flex-start; padding: 8px 10px;
  background: rgba(255,255,255,0.03); border-radius: 8px;
}
