/* ──────────────────────────────────────────────────────────────────────────────
   Grupo FAMIl — Assinaturas
   Tema: Dark glassmorphism, paleta violeta/esmeralda
   ────────────────────────────────────────────────────────────────────────────── */

:root {
  --bg:            #06060f;
  --surface:       rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.075);
  --border:        rgba(255, 255, 255, 0.085);
  --border-hover:  rgba(124, 58, 237, 0.5);

  --primary:       #7c3aed;
  --primary-light: #a78bfa;
  --primary-dim:   rgba(124, 58, 237, 0.14);
  --primary-glow:  rgba(124, 58, 237, 0.4);

  --success:       #10b981;
  --success-dim:   rgba(16, 185, 129, 0.1);
  --success-glow:  rgba(16, 185, 129, 0.3);
  --success-border:rgba(16, 185, 129, 0.28);

  --danger:        #f87171;
  --text:          #e2e8f0;
  --text-soft:     #94a3b8;
  --text-muted:    #475569;

  --radius:    18px;
  --radius-sm: 10px;
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Background orbs ────────────────────────────────────────────────────────── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(130px);
}
.orb-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(124,58,237,0.6) 0%, transparent 70%);
  top: -250px; left: -200px;
  animation: drift1 18s ease-in-out infinite alternate;
}
.orb-2 {
  width: 550px; height: 550px;
  background: radial-gradient(circle, rgba(6,182,212,0.45) 0%, transparent 70%);
  top: 40%; right: -180px;
  animation: drift2 22s ease-in-out infinite alternate;
}
.orb-3 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(16,185,129,0.3) 0%, transparent 70%);
  bottom: -100px; left: 35%;
  animation: drift3 26s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(60px, 80px); } }
@keyframes drift2 { to { transform: translate(-50px, -60px); } }
@keyframes drift3 { to { transform: translate(40px, -50px); } }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 6, 15, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon { font-size: 26px; line-height: 1; }
.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #a78bfa 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}
.header-info { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
}
.stat-pill.total { border-color: rgba(124,58,237,0.3); }
.stat-label {
  font-size: 0.58rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.stat-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}
.stat-pill.total .stat-value { color: var(--primary-light); }

/* ── Main ───────────────────────────────────────────────────────────────────── */
.main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 24px 80px;
  position: relative;
  z-index: 1;
}

/* ── Progress section ───────────────────────────────────────────────────────── */
.progress-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
  backdrop-filter: blur(12px);
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.progress-header span:first-child {
  font-size: 0.88rem;
  color: var(--text-soft);
  font-weight: 500;
}
.progress-pct {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-light);
}
.progress-bar {
  width: 100%;
  height: 7px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 18px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 99px;
  transition: width 0.7s var(--ease);
  box-shadow: 0 0 10px rgba(124,58,237,0.4);
}
.subscriptions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 13px;
  font-size: 0.78rem;
  color: var(--text-soft);
}
.sub-chip strong { color: var(--text); font-weight: 600; }

/* ── Members section ────────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

/* ── Skeleton ───────────────────────────────────────────────────────────────── */
.card-skeleton {
  height: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

/* ── Member card ────────────────────────────────────────────────────────────── */
.member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  backdrop-filter: blur(8px);
}
.member-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 10px 40px rgba(124,58,237,0.18);
}
.member-card.paid {
  border-color: var(--success-border);
  background: linear-gradient(135deg, var(--success-dim) 0%, var(--surface) 100%);
  box-shadow: 0 0 24px rgba(16,185,129,0.15);
}
.member-card.paid:hover {
  border-color: rgba(16,185,129,0.5);
  box-shadow: 0 10px 40px rgba(16,185,129,0.2);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.member-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  background: hsl(var(--hue), 55%, 40%);
  box-shadow: 0 0 18px hsla(var(--hue), 55%, 40%, 0.5);
}
/* Foto de perfil Google */
.member-photo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(124,58,237,0.4), 0 4px 16px rgba(0,0,0,0.4);
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.member-name {
  font-weight: 600;
  font-size: 0.97rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.paid-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--success);
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 99px;
  padding: 2px 9px;
  letter-spacing: 0.02em;
}

.member-cota {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text);
}

/* ── Botões dos cards ───────────────────────────────────────────────────────── */
.btn-pix {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #5b21b6 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}
.btn-pix:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px var(--primary-glow);
}
.btn-pix:active { transform: translateY(0); opacity: 0.85; }

.btn-unpay {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-unpay:hover { border-color: var(--danger); color: var(--danger); }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: #0d0d20;
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: 24px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow:
    0 24px 80px rgba(0,0,0,0.85),
    0 0 60px rgba(124,58,237,0.18);
  transform: scale(0.94) translateY(24px);
  transition: transform 0.28s var(--ease);
}
.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.modal-icon { font-size: 2.2rem; line-height: 1; }
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-amount {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: -0.04em;
  line-height: 1;
}

.modal-qr {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-image {
  width: 100%;
  max-width: 260px;
  display: block;
  border-radius: 8px;
}
.qr-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #444;
}
.qr-loading p { font-size: 0.82rem; color: #666; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-copy {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.pix-input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  padding: 10px 12px;
  font-size: 0.72rem;
  font-family: 'Courier New', monospace;
  outline: none;
  transition: border-color 0.15s;
}
.pix-input:focus { border-color: rgba(124,58,237,0.4); }

.btn-copy {
  padding: 10px 15px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
  min-width: 80px;
}
.btn-copy:hover { opacity: 0.9; }
.btn-copy:active { transform: scale(0.97); }
.btn-copy.copied { background: var(--success); }

.btn-mark-paid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}
.btn-mark-paid:hover {
  opacity: 0.93;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px var(--success-glow);
}
.btn-mark-paid:active { transform: translateY(0); opacity: 0.85; }

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsividade ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; }
  .brand-sub    { display: none; }
  .brand-title  { font-size: 1rem; }
  .main         { padding: 20px 16px 64px; }
  .members-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .member-card  { padding: 16px; gap: 12px; }
  .member-cota  { font-size: 1.5rem; }
  .progress-section { padding: 18px; }
}
@media (max-width: 480px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .header-info { width: 100%; justify-content: flex-start; flex-wrap: nowrap; }
  .stat-pill { flex: 1; align-items: flex-start; }
  .btn-admin-icon { margin-right: auto; }

  .modal { padding: 24px 20px; width: calc(100% - 32px); }
  .modal-amount { font-size: 1.7rem; }
}
@media (max-width: 500px) {
  .members-grid { grid-template-columns: 1fr; }
}

/* ── Slot vazio ─────────────────────────────────────────────────────────────── */
.member-card.slot-vazio {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.015);
  box-shadow: none;
}
.member-card.slot-vazio:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: none;
}
.slot-avatar {
  background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: none !important;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 1.3rem;
  font-weight: 400;
}
.slot-label { color: var(--text-muted); font-weight: 500; }
.slot-sub   { font-size: 0.72rem; color: var(--text-muted); opacity: 0.6; }

.btn-convidar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px dashed rgba(124, 58, 237, 0.4);
  color: var(--primary-light);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}
.btn-convidar:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}
.btn-convidar:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Modal WhatsApp ─────────────────────────────────────────────────────────── */
.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}
.btn-whatsapp:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
}

/* ── PWA Strict Blocker ─────────────────────────────────────────────────────── */
.pwa-strict-blocker {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.pwa-strict-blocker.hidden { display: none !important; }

.pwa-blocker-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.brand-logo {
  width: max-content;
  min-width: 64px;
  padding: 0 20px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), #38bdf8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

/* ── Admin ──────────────────────────────────────────────────────────────────── */
.btn-admin-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-admin-icon:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.btn-remove {
  flex: 1;
  padding: 10px;
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border: 1px dashed rgba(248, 113, 113, 0.4);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-remove:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: var(--danger);
}

/* ── Login View ─────────────────────────────────────────────────────────────── */
.login-view {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.login-view.hidden {
  display: none !important;
}

/* ── Melhoria nos ícones header ─────────────────────────────────────────────── */
.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-admin-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-admin-icon:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}
.btn-admin-icon.hidden { display: none !important; }
