/* Psttt app pages — shared component styles.
   Reproduces the design-system component classes for plain HTML pages.
   Pages link styles.css (tokens + fonts) then this file. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------- HEADER / SHELL ----------------------------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--border-subtle);
}
.app-header__inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  height: 66px; display: flex; align-items: center; justify-content: space-between;
}
.app-header__logo { background: none; border: none; cursor: pointer; display: flex; align-items: center; padding: 0; }
.app-header__logo img { height: 30px; display: block; }
.app-header__actions { display: flex; align-items: center; gap: 8px; }
.app-main { max-width: 1100px; margin: 0 auto; padding: 44px 24px 64px; }
.app-main--narrow { max-width: 760px; }

/* breadcrumb / back */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 14px; font-weight: 600; margin-bottom: 18px;
}
.back-link:hover { color: var(--text-strong); text-decoration: none; }

/* page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
.page-title { font-family: var(--font-display); font-size: 36px; font-weight: 800; color: var(--text-strong); letter-spacing: -0.025em; margin: 0; line-height: 1.05; }
.page-sub { color: var(--text-muted); margin: 4px 0 0; font-size: 15.5px; }
.section-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.015em; margin: 0; }

/* ----------------------------- BUTTONS ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 600; border-radius: var(--radius-pill);
  border: 1.5px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: all .16s ease; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn--sm { font-size: 14px; padding: 8px 16px; min-height: 36px; }
.btn--md { font-size: 16px; padding: 11px 22px; min-height: 44px; }
.btn--lg { font-size: 18px; padding: 15px 30px; min-height: 54px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--color-primary); color: var(--color-on-primary); box-shadow: var(--shadow-primary); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--primary:active { background: var(--color-primary-active); transform: translateY(1px); }
.btn--secondary { background: var(--color-secondary); color: var(--color-on-secondary); }
.btn--secondary:hover { background: var(--color-secondary-hover); }
.btn--outline { background: transparent; color: var(--text-strong); border-color: var(--border-strong); }
.btn--outline:hover { background: var(--color-surface-sunken); border-color: var(--cream-500); }
.btn--ghost { background: transparent; color: var(--color-primary); }
.btn--ghost:hover { background: var(--color-primary-soft); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { filter: brightness(.93); }
.btn--danger-ghost { background: transparent; color: var(--color-danger); }
.btn--danger-ghost:hover { background: var(--color-danger-soft); }

/* icon button */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  background: transparent; border: none; cursor: pointer; color: var(--text-muted);
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--color-surface-sunken); color: var(--text-strong); }
.icon-btn--sm { width: 34px; height: 34px; }

/* ----------------------------- AVATAR ----------------------------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  font-family: var(--font-sans); font-weight: 600; color: #fff; overflow: hidden; flex: none;
  background: var(--color-primary); border: 2px solid var(--color-surface); box-sizing: border-box;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { width: 28px; height: 28px; font-size: 11px; }
.avatar--sm { width: 36px; height: 36px; font-size: 13px; }
.avatar--md { width: 44px; height: 44px; font-size: 16px; }
.avatar--lg { width: 60px; height: 60px; font-size: 21px; }
.avatar--xl { width: 84px; height: 84px; font-size: 30px; }
.avatar--mint { background: var(--mint-500); }
.avatar--honey { background: var(--honey-500); }
.avatar--rose { background: var(--rose-500); }
.avatar--blue { background: var(--blue-500); }
.avatar--orange6 { background: var(--orange-600); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { margin-left: -10px; }
.avatar-group .avatar:first-child { margin-left: 0; }
.avatar--more { background: var(--cream-200); color: var(--cream-700); }

/* ----------------------------- BADGE / TAG ----------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-sans);
  font-weight: 600; font-size: 12px; line-height: 1; border-radius: var(--radius-pill);
  padding: 4px 10px; letter-spacing: .01em; white-space: nowrap;
}
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neutral { background: var(--cream-100); color: var(--cream-700); }
.badge--primary { background: var(--orange-50); color: var(--orange-700); }
.badge--sage { background: var(--mint-50); color: var(--mint-700); }
.badge--gold { background: var(--honey-50); color: var(--honey-700); }
.badge--success { background: var(--color-success-soft); color: var(--green-500); }
.badge--danger { background: var(--color-danger-soft); color: var(--red-500); }
.badge--info { background: var(--color-info-soft); color: var(--blue-500); }

.tag {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans);
  font-weight: 500; font-size: 14px; line-height: 1; border-radius: var(--radius-pill);
  padding: 7px 14px; background: var(--color-surface); color: var(--text-body);
  border: 1.5px solid var(--border-subtle); transition: all .15s ease; cursor: pointer;
}
.tag:hover { border-color: var(--border-strong); background: var(--color-surface-sunken); }
.tag--selected { background: var(--color-primary-soft); border-color: var(--color-primary-border); color: var(--orange-700); }
.tag--selected:hover { background: var(--color-primary-soft); border-color: var(--color-primary-border); }

/* ----------------------------- CARD ----------------------------- */
.card {
  background: var(--color-surface); border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-card); padding: 22px;
}
.card--pad-lg { padding: 28px; }

/* ----------------------------- EVENT CARD ----------------------------- */
.event {
  display: block; text-align: left; width: 100%; background: var(--color-surface);
  border: 1.5px solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden;
  transition: all .16s ease; cursor: pointer; padding: 0; font-family: var(--font-sans); color: inherit;
}
.event:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--border); text-decoration: none; }
.event__cover { height: 96px; position: relative; display: flex; align-items: flex-end; padding: 14px;
  background: linear-gradient(135deg, var(--orange-400), var(--orange-600)); }
.event__cover--anniv { background: linear-gradient(135deg, var(--honey-300), var(--honey-500)); }
.event__cover--naissance { background: linear-gradient(135deg, var(--mint-300), var(--mint-500)); }
.event__cover--mariage { background: linear-gradient(135deg, var(--rose-300), var(--rose-500)); }
.event__cover--autre { background: linear-gradient(135deg, var(--cream-400), var(--cream-600)); }
.event__type { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: rgba(0,0,0,.18); padding: 4px 10px; border-radius: var(--radius-pill); backdrop-filter: blur(4px); }
.event__archived { position: absolute; top: 14px; right: 14px; font-size: 13px; font-weight: 600;
  color: #fff; background: rgba(0,0,0,.28); padding: 4px 10px; border-radius: var(--radius-pill); }
.event__body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.event__name { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-strong);
  letter-spacing: -0.015em; line-height: 1.15; }
.event__date { font-size: 14px; color: var(--text-muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.event__foot { display: flex; align-items: center; justify-content: space-between; }
.event__count { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.event__count b { color: var(--text-strong); font-weight: 700; }
.event-create {
  min-height: 230px; border: 2px dashed var(--border); border-radius: var(--radius-card);
  background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; color: var(--text-muted); font-family: var(--font-sans);
  font-size: 15px; font-weight: 600; transition: all .15s ease; text-decoration: none;
}
.event-create:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }

/* ----------------------------- GIFT CARD ----------------------------- */
.gift { display: flex; gap: 14px; padding: 14px; background: var(--color-surface);
  border: 1.5px solid var(--border-subtle); border-radius: var(--radius-lg); transition: all .16s ease; align-items: center; }
.gift--available:hover { border-color: var(--color-primary-border); box-shadow: var(--shadow-md); }
.gift--reserved { background: var(--gift-reserved-soft); border-color: transparent; }
.gift__thumb { flex: none; width: 64px; height: 64px; border-radius: var(--radius-md);
  background: var(--color-surface-sunken); display: flex; align-items: center; justify-content: center;
  color: var(--text-subtle); overflow: hidden; }
.gift__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gift--reserved .gift__thumb { filter: grayscale(.55) opacity(.7); }
.gift__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.gift__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gift__title { font-family: var(--font-sans); font-weight: 600; font-size: 16px; color: var(--text-strong); line-height: 1.25; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift--reserved .gift__title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--cream-400); }
.gift__meta { display: flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-size: 14px; color: var(--text-muted); flex-wrap: wrap; }
.gift__price { font-family: var(--font-mono); font-weight: 700; color: var(--text-strong); font-size: 14px; }
.gift__reserved-note { color: var(--text-subtle); font-style: italic; }
.gift__actions { flex: none; display: flex; align-items: center; gap: 6px; }

/* ----------------------------- MEMBER ROW ----------------------------- */
.member { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-lg);
  transition: all .16s ease; font-family: var(--font-sans); width: 100%; text-align: left;
  background: transparent; border: 1.5px solid transparent; cursor: pointer; color: inherit; }
.member:hover { background: var(--color-surface); border-color: var(--border-subtle); box-shadow: var(--shadow-sm); text-decoration: none; }
.member__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.member__name { font-weight: 600; color: var(--text-strong); font-size: 16px; }
.member__you { font-weight: 500; color: var(--text-subtle); font-size: 14px; }
.member__sub { font-size: 14px; color: var(--text-muted); }
.member__sub b { color: var(--color-primary); font-weight: 700; }
.member__empty { font-size: 14px; color: var(--text-subtle); font-style: italic; }
.member__chev { flex: none; color: var(--text-subtle); display: flex; }

/* ----------------------------- FORM CONTROLS ----------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: 13.5px; font-weight: 600; color: var(--text-strong); }
.field__label .opt { font-weight: 500; color: var(--text-subtle); }
.field__hint { font-size: 12.5px; color: var(--text-subtle); }
.input, .textarea, .select {
  font-family: var(--font-sans); font-size: 16px; color: var(--text-body); background: var(--color-surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-input); padding: 12px 15px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--border-focus); box-shadow: var(--ring); outline: none; }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.input--with-icon { padding-left: 42px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap__icon { position: absolute; left: 14px; display: flex; color: var(--text-subtle); pointer-events: none; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2379655A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 42px; cursor: pointer; }

/* segmented control */
.segmented { display: inline-flex; background: var(--color-surface-sunken); border-radius: var(--radius-pill); padding: 4px; gap: 2px; }
.segmented--block { display: flex; }
.segmented__opt { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-sans); font-size: 14.5px; font-weight: 600; color: var(--text-muted);
  padding: 9px 16px; border: none; background: transparent; border-radius: var(--radius-pill); cursor: pointer; transition: all .15s ease; }
.segmented__opt:hover { color: var(--text-strong); }
.segmented__opt--active { background: var(--color-surface); color: var(--text-strong); box-shadow: var(--shadow-sm); }

/* checkbox */
.checkbox { appearance: none; -webkit-appearance: none; width: 19px; height: 19px; flex-shrink: 0;
  border: 1.5px solid var(--border); border-radius: 6px; background: var(--color-surface); cursor: pointer; accent-color: var(--color-primary); }

/* switch / toggle */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-family: var(--font-sans); font-size: 16px; color: var(--text-body); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { flex: none; width: 46px; height: 27px; border-radius: var(--radius-pill); background: var(--cream-300); transition: all .15s ease; position: relative; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: all .15s ease; }
.switch input:checked + .switch__track { background: var(--color-primary); }
.switch input:checked + .switch__track::after { transform: translateX(19px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch--disabled { cursor: not-allowed; opacity: .6; }

/* settings rows */
.settings-card { background: var(--color-surface); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; }
.settings-card__head { padding: 18px 22px 0; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 16px 22px; }
.set-row + .set-row { border-top: 1.5px solid var(--border-subtle); }
.set-row__body { flex: 1; min-width: 0; }
.set-row__label { font-weight: 600; color: var(--text-strong); font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.set-row__desc { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.45; }
.set-row__control { flex: none; display: flex; align-items: center; gap: 10px; }
.set-row__value { font-size: 14.5px; color: var(--text-muted); }

/* danger zone */
.danger-card { border: 1.5px solid color-mix(in srgb, var(--color-danger) 35%, var(--border)); border-radius: var(--radius-card); padding: 0; overflow: hidden; }
.danger-card .set-row + .set-row { border-top-color: color-mix(in srgb, var(--color-danger) 18%, var(--border-subtle)); }

/* plan card */
.plan-card { background: linear-gradient(150deg, var(--orange-500), var(--orange-700)); color: #fff; border-radius: var(--radius-card); padding: 24px; }
.plan-card__tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(255,255,255,.18); padding: 4px 10px; border-radius: var(--radius-pill); }
.plan-card__feat { display: flex; align-items: center; gap: 9px; font-size: 14.5px; color: var(--orange-50); }

/* toast */
.toast { display: flex; align-items: flex-start; gap: 13px; background: var(--text-strong); color: var(--cream-50);
  border-radius: var(--radius-md); padding: 15px 17px; box-shadow: var(--shadow-lg); max-width: 420px; width: 100%; }
.toast__icon { flex: none; width: 32px; height: 32px; border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center; }
.toast__icon--danger { background: color-mix(in srgb, var(--red-500) 88%, #fff); color: #fff; }
.toast__icon--success { background: var(--color-success); color: #fff; }
.toast__body { flex: 1; min-width: 0; padding-top: 1px; }
.toast__title { font-weight: 700; font-size: 15px; color: #fff; }
.toast__desc { font-size: 13.5px; color: var(--cream-200); margin-top: 2px; line-height: 1.45; }
.toast__close { flex: none; background: none; border: none; color: var(--cream-300); cursor: pointer; padding: 2px; display: flex; }
.toast__close:hover { color: #fff; }
.toast-region { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 10px; padding: 0 16px; width: 100%; max-width: 452px; }

/* premium / free conditional visibility (driven by preview-state.js) */
[data-premium="true"] .gn-when-free { display: none !important; }
[data-premium="false"] .gn-when-premium { display: none !important; }
html:not([data-premium="true"]) .gn-when-premium { display: none !important; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--border-subtle); }
.tab { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-sans); font-size: 15px;
  font-weight: 600; color: var(--text-muted); padding: 11px 16px; border: none; background: none; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; transition: all .15s ease; }
.tab:hover { color: var(--text-strong); }
.tab--active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab__count { font-size: 12px; font-weight: 700; background: var(--color-surface-sunken); color: var(--text-muted); padding: 1px 8px; border-radius: var(--radius-pill); }
.tab--active .tab__count { background: var(--color-primary-soft); color: var(--orange-700); }

/* ----------------------------- BANNER ----------------------------- */
.banner { display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px; border-radius: var(--radius-md);
  font-size: 14px; line-height: 1.45; border: 1.5px solid transparent; }
.banner__icon { flex-shrink: 0; display: flex; margin-top: 1px; }
.banner--info { background: var(--color-info-soft); border-color: color-mix(in srgb, var(--blue-500) 22%, transparent); color: var(--blue-500); }
.banner--success { background: var(--color-success-soft); border-color: color-mix(in srgb, var(--green-500) 22%, transparent); color: var(--green-500); }
.banner--gold { background: var(--honey-50); border-color: var(--honey-200); color: var(--honey-700); }
.banner b { font-weight: 700; }

/* invite link box */
.invite { display: flex; align-items: center; gap: 10px; background: var(--color-surface-sunken);
  border: 1.5px dashed var(--border); border-radius: var(--radius-md); padding: 10px 10px 10px 16px; }
.invite__url { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13.5px; color: var(--text-body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----------------------------- MODAL ----------------------------- */
.modal-overlay { position: fixed; inset: 0; background: var(--color-overlay); display: flex; align-items: center;
  justify-content: center; padding: 24px; z-index: 50; }
.modal { background: var(--color-surface); border-radius: var(--radius-card); box-shadow: var(--shadow-xl);
  width: 100%; max-width: 460px; max-height: calc(100vh - 48px); overflow-y: auto; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 0; }
.modal__title { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.015em; margin: 0; }
.modal__sub { color: var(--text-muted); font-size: 14.5px; margin: 6px 0 0; line-height: 1.5; }
.modal__body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal__foot { padding: 0 24px 24px; display: flex; gap: 10px; }
.modal__foot .btn { flex: 1; }

/* utility */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.grid-gifts { display: flex; flex-direction: column; gap: 10px; }
.divider { height: 1.5px; background: var(--border-subtle); border: none; margin: 0; }
.muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state__icon { width: 64px; height: 64px; border-radius: var(--radius-pill); background: var(--color-surface-sunken);
  color: var(--text-subtle); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }

@media (max-width: 640px) {
  .page-title { font-size: 28px; }
  .page-head { align-items: flex-start; }
}
