/* ================================================================
   Perfil (PerfilA) y Ajustes (Ajustos)
================================================================ */

body.is-profile { background: var(--bg-2); }
:root[data-theme="dark"] body.is-profile { background: var(--bg); }

.pf-page { max-width: 1120px; margin: 0 auto; padding: 40px 24px 64px; }

/* Botones comunes */
.pf-btn {
  font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 18px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--border-light); background: var(--bg-card); color: var(--text);
}
.pf-btn:hover { background: var(--bg-3, var(--bg-2)); }
.pf-btn.is-icon { width: 44px; padding: 0; }
.pf-btn.is-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.pf-btn.is-primary:hover { background: var(--primary-dark); }
.pf-btn.is-danger { background: var(--pass); border-color: var(--pass); color: #fff; }
.pf-btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Cabecera */
.pf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 24px; }
.pf-avatar {
  width: 96px; height: 96px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--primary); color: #fff; font-size: 40px; font-weight: 700;
}
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pf-who { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pf-who h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.pf-meta { font-size: 15px; color: var(--mid); }
.pf-who p { margin: 6px 0 0; font-size: 16px; line-height: 1.5; max-width: 560px; }
.pf-actions { display: flex; gap: 8px; }

/* Contadores */
.pf-stats {
  margin-top: 28px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
}
.pf-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 8px; color: var(--text); text-align: center; }
.pf-stat + .pf-stat { border-left: 1px solid var(--border); }
a.pf-stat:hover { background: var(--bg-2); }
.pf-stat strong { font-size: 26px; font-weight: 700; line-height: 1.1; }
.pf-stat span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mid); }

/* Pestañas */
.pf-tabs { margin-top: 28px; display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.pf-tabs a {
  padding: 12px 16px; font-size: 15px; font-weight: 500; color: var(--mid); white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.pf-tabs a:hover { color: var(--text); }
.pf-tabs a[aria-current="page"] { color: var(--accent-text); font-weight: 700; border-bottom-color: var(--accent-text); }

.pf-body { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.pf-main { flex: 1 1 560px; min-width: 0; }
.pf-side { flex: 0 1 320px; min-width: 0; padding-top: 28px; position: sticky; top: calc(var(--navbar-h) + 20px); }

.pf-kind { font-size: 13px; font-weight: 600; }
.pf-kind.is-going { color: var(--going); }
:root[data-theme="dark"] .pf-kind.is-going { color: #93C5FD; }
.pf-kind.is-saved { color: var(--mid); }
.pf-kind.is-like { color: var(--accent-text); }

/* T'agradaven i són aviat */
.pf-soon {
  margin-top: 28px; padding: 20px 22px 8px; border-radius: 22px;
  background: var(--accent-soft); border: 1px solid transparent;
}
.pf-soon h2 { margin: 0; font-size: 20px; font-weight: 700; }
.pf-soon-item { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.pf-soon-item:last-child { border-bottom: 0; }
.pf-soon-item .ag-row { flex: 1; min-width: 0; border-bottom: 0; }
.pf-soon .ag-thumb { width: 64px; height: 64px; border-radius: 14px; }
.pf-soon .ag-text strong { font-size: 16px; }
.pf-go {
  flex: none; font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 18px;
  border-radius: 14px; border: 0; background: var(--going); color: #fff; cursor: pointer;
}
.pf-go:disabled { opacity: .5; }

.pf-empty, .pf-panel {
  margin-top: 28px; padding: 24px; border-radius: 22px; background: var(--bg-card); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
}
.pf-empty p, .pf-panel p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--mid); }
.pf-more { margin: 24px 0 0; }
.pf-more a { font-weight: 600; color: var(--accent-text); padding: 8px 0; display: inline-block; }

.pf-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pf-chips li {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  font-size: 15px; font-weight: 600; border: 1px solid var(--border-light); color: var(--mid);
}
.pf-chips li.is-chosen { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

.pf-groups { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.pf-group { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; border: 1px solid var(--border); color: var(--text); }
a.pf-group:hover { border-color: var(--border-light); }
.pf-group-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; flex: none; }
.pf-group strong { display: block; font-size: 15px; }
.pf-group small { font-size: 13px; color: var(--muted); }

/* Lateral: calendario */
.pf-cal {
  padding: 22px; border-radius: 22px; background: var(--bg-card); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.pf-cal h2 { margin: 0; font-size: 18px; font-weight: 700; }
.pf-cal p { margin: 0 0 6px; font-size: 15px; line-height: 1.5; color: var(--mid); }
.pf-cal small { font-size: 12px; line-height: 1.5; color: var(--muted); }

/* ─── Ajustes ───────────────────────────────────────────────── */
.st-page { max-width: 1040px; margin: 0 auto; padding: 40px 24px 64px; display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.st-nav { flex: 0 1 220px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--navbar-h) + 20px); }
.st-nav h1 { margin: 0 0 14px; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.st-nav a { padding: 10px 14px; border-radius: 12px; font-size: 15px; font-weight: 500; color: var(--mid); }
.st-nav a:hover { background: var(--bg-card); color: var(--text); }
.st-body { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.st-card {
  scroll-margin-top: calc(var(--navbar-h) + 16px);
  padding: 26px; border-radius: 22px; background: var(--bg-card); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 16px;
}
.st-card h2 { margin: 0; font-size: 22px; font-weight: 700; }
.st-card h3 { margin: 8px 0 0; font-size: 16px; font-weight: 700; }
.st-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--mid); }
.st-form { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.st-form > .pf-btn { margin-top: 4px; }
.st-photo { display: flex; align-items: center; gap: 16px; }
.st-photo .pf-avatar { width: 72px; height: 72px; font-size: 30px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; width: 100%; }
.st-field { display: flex; flex-direction: column; gap: 6px; width: 100%; font-size: 14px; font-weight: 600; }
.st-field input, .st-field textarea {
  font: inherit; font-size: 16px; font-weight: 400; padding: 12px 14px; min-height: 48px; border-radius: 14px;
  border: 1px solid var(--border-light); background: var(--bg); color: var(--text); width: 100%; box-sizing: border-box;
}
.st-field textarea { resize: vertical; }
.st-field input:focus, .st-field textarea:focus { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.st-field small { font-weight: 400; color: var(--muted); }
.st-note { display: flex; align-items: center; gap: 8px; color: var(--accent-text) !important; font-weight: 600; }
.st-error { padding: 12px 14px; border-radius: 12px; background: rgba(220,38,38,.1); color: var(--pass) !important; font-weight: 600; }
:root[data-theme="dark"] .st-error { color: #FCA5A5 !important; }

.st-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.st-modes button {
  font: inherit; font-size: 14px; font-weight: 600; padding: 10px; border-radius: 14px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 8px; color: var(--text); background: transparent; border: 2px solid var(--border);
}
.st-modes button[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent-text); }
.st-swatch { display: block; height: 56px; border-radius: 10px; border: 1px solid var(--border-light); }
.st-swatch.is-system { background: linear-gradient(90deg, #F4FBFA 50%, #020617 50%); }
.st-swatch.is-light { background: #F4FBFA; }
.st-swatch.is-dark { background: #020617; }

.st-radio { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; cursor: pointer; }
.st-radio input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }

.st-alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.st-alerts li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.st-link { font: inherit; font-size: 14px; font-weight: 600; color: var(--accent-text); background: none; border: 0; padding: 8px 0; cursor: pointer; }

.st-row {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-top: 1px solid var(--border);
  font-size: 16px; font-weight: 600; color: var(--text);
}
.st-row small { font-size: 13px; font-weight: 400; color: var(--muted); }
.st-row summary { cursor: pointer; list-style: none; }
.st-row summary::-webkit-details-marker { display: none; }
.st-row summary::after { content: '›'; float: right; color: var(--muted); }
.st-row[open] summary { margin-bottom: 14px; }
.st-row.is-danger summary { color: var(--pass); }
:root[data-theme="dark"] .st-row.is-danger summary { color: #FCA5A5; }

@media (max-width: 768px) {
  .pf-page, .st-page { padding: 24px 16px 40px; }
  .pf-head { gap: 16px; }
  .pf-avatar { width: 72px; height: 72px; font-size: 30px; }
  .pf-who h1 { font-size: 26px; }
  .pf-actions { width: 100%; }
  .pf-actions .pf-btn:first-child { flex: 1; }
  .pf-stats { margin-top: 20px; }
  .pf-stat { padding: 14px 4px; }
  .pf-stat strong { font-size: 22px; }
  .pf-stat span { font-size: 10px; letter-spacing: .03em; }
  .pf-side { position: static; padding-top: 0; flex-basis: 100%; }
  .pf-soon { padding: 16px 16px 4px; }
  .pf-soon-item { flex-wrap: wrap; gap: 0 12px; padding-bottom: 12px; }
  .pf-soon-item .pf-go { margin-left: 76px; }
  .st-nav { position: static; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .st-nav h1 { width: 100%; font-size: 28px; margin-bottom: 6px; }
  .st-nav a { padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; font-size: 14px; }
  .st-card { padding: 20px; }
  .st-modes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Perfil público de otra persona (usuario.php) */
.pf-public { margin-top: 28px; display: flex; flex-direction: column; gap: 28px; }
.pf-section-title { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.pf-none { margin: 8px 0 0; color: var(--muted); }
.pf-private { align-items: center; text-align: center; }
.pf-private svg { color: var(--mid); }
.pf-private h2 { margin: 0; font-size: 20px; }
.pf-web { margin-top: 8px; font-weight: 600; color: var(--accent-text); align-self: flex-start; }
