/*
 * voter2027.fr — save/resume sheet, /reprendre, /abonnement and app-mode chrome (SPEC.md "Save and
 * resume, updates by email, app mode", 27 Sep 2026). Loaded from templates/layout.php on every
 * non-admin page (the "Enregistrer" button lives in the header everywhere). Does NOT touch
 * base.css's `.nav` rules — the header button sits in its own `.v27-header-actions` wrapper.
 */

/* ---------------------------------------------------------------- header button */

.v27-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.v27-save-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.9em;
  border: 1px solid var(--color-border-strong, var(--color-border));
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.v27-save-btn:hover { background: var(--color-surface-2); }
.v27-save-btn:active { background: var(--color-surface-2); }

/* ---------------------------------------------------------------- the sheet (same pattern as
   templates/public/candidats.php's <dialog class="sheet"> in candidats.css, kept independent here
   since this file loads sitewide and candidats.css does not). */

.v27-savesheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: var(--panel-frame, 3px) solid var(--galva, var(--color-border));
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--color-surface);
  color: var(--color-text);
  max-height: 92dvh;
  overflow: hidden;
}
.v27-savesheet::backdrop { background: color-mix(in srgb, #1E2433 42%, transparent); }
.v27-savesheet-inner { display: flex; flex-direction: column; max-height: 92dvh; }
.v27-savesheet-grip { width: 40px; height: 4px; border-radius: 0; background: var(--galva, var(--color-border)); margin: 8px auto 0; flex: 0 0 auto; }
.v27-savesheet-close {
  position: absolute; top: 4px; right: 6px;
  width: 44px; height: 44px;
  border: 0; background: none; color: var(--color-text-muted);
  font-size: 1.7rem; line-height: 1; cursor: pointer; border-radius: var(--radius);
}
.v27-savesheet-close:hover { background: var(--color-surface-2); }
.v27-savesheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}
.v27-savesheet-body h2 { padding-right: 40px; }

@media (min-width: 44rem) {
  .v27-savesheet { inset: 0 0 0 auto; width: min(420px, 100%); height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; border-left: var(--panel-frame, 3px) solid var(--galva, var(--color-border)); }
  .v27-savesheet-inner { height: 100dvh; max-height: 100dvh; }
  .v27-savesheet-grip { display: none; }
}

/* ---------------------------------------------------------------- sheet content */

.v27-save-summary { font-weight: 600; }

.v27-save-qr {
  display: flex;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}
.v27-save-qr svg { width: 100%; max-width: 220px; height: auto; display: block; }

.v27-save-privacy {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-radius: var(--radius);
  padding: 0.6em 0.8em;
}

.v27-save-linkrow { display: flex; gap: 8px; }
.v27-save-linkinput {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  text-overflow: ellipsis;
}
.v27-save-linkrow .btn-secondary { flex: 0 0 auto; min-width: 44px; }

.v27-save-sub { font-size: 0.9rem; }

.v27-save-appmode { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.v27-save-appmode .btn { width: 100%; }

.v27-ios-guide-panel {
  background: var(--color-surface-2);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.v27-ios-guide-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.v27-ios-guide-steps li { display: flex; align-items: center; gap: var(--space-3); }
.v27-ios-guide-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-accent);
}

/* ---------------------------------------------------------------- /reprendre */

.v27-reprendre-summary { font-size: 1.05rem; }
.v27-reprendre-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--space-3); }
.v27-reprendre-actions .btn, .v27-reprendre-actions .btn-secondary { flex: 1 1 auto; min-width: 160px; }

/* ---------------------------------------------------------------- /abonnement */

.abonnement-topics { display: flex; flex-direction: column; gap: 2px; }
.abonnement-topic-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  font-weight: 400;
  margin-bottom: 0;
  cursor: pointer;
}
.abonnement-topic-row input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; margin: 0; }
.abonnement-consent { font-size: 0.85rem; color: var(--color-text-muted); }
