/* =========================================================
   POLITIQ Portal – Design-Grundlage (Apple-inspiriert)
   Tokens + Komponenten für alle Module. Bewegung nur transform/opacity.
   ========================================================= */

:root {
  --pq-navy: #26395b;
  --pq-navy-deep: #1a2840;
  --pq-ink: #111b2c;
  --pq-text: #1f1e1f;
  --pq-muted: #5d6170;
  --pq-paper: #fbfaf8;
  --pq-stone: #e6e5e2;
  --pq-line: #e2e0dc;
  --pq-fill: #f2f1ee;            /* gruppierte Flächen (wie iOS systemGroupedBackground) */
  --pq-blue: #46719f;
  --pq-blue-light: #9fc0e3;
  --pq-pink: #ef5a9b;
  --pq-gold: #d3ad00;
  --pq-green: #1f8a4c;
  --pq-red: #d7263d;
  --pq-radius: 16px;
  --pq-radius-lg: 22px;
  --pq-shadow: 0 1px 2px rgba(17, 27, 44, .06), 0 12px 32px -16px rgba(17, 27, 44, .22);
  --pq-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --pq-ease-io: cubic-bezier(0.77, 0, 0.175, 1);
  --pq-font: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
}

.pq-ui, .pq-ui * { box-sizing: border-box; }
.pq-ui { font-family: var(--pq-font); color: var(--pq-text); -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.5; }
.pq-ui :focus-visible { outline: 2px solid var(--pq-blue); outline-offset: 3px; }

/* Typografie */
.pq-large-title { font-size: clamp(30px, 4vw, 40px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; color: var(--pq-ink); margin: 0; }
.pq-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; color: var(--pq-ink); margin: 0; }
.pq-headline { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--pq-ink); margin: 0; }
.pq-sub { font-size: 15px; color: var(--pq-muted); margin: 0; }
.pq-caption { font-size: 13px; color: var(--pq-muted); }
.pq-overline { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pq-blue); }

/* Buttons */
.pq-btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: 12px;
  background: var(--pq-navy); color: #fff; font: 600 16px/1.2 var(--pq-font); letter-spacing: -0.01em;
  transition: background-color .15s ease, color .15s ease, transform 160ms var(--pq-ease), opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pq-btn:active { transform: scale(0.97); }
.pq-btn[disabled], .pq-btn.is-loading { opacity: .5; pointer-events: none; }
.pq-btn--block { width: 100%; }
.pq-btn--ghost { background: var(--pq-fill); color: var(--pq-navy); }
.pq-btn--plain { background: transparent; color: var(--pq-blue); padding-left: 8px; padding-right: 8px; }
.pq-btn--danger { background: #fdecef; color: var(--pq-red); }
.pq-btn--success { background: var(--pq-green); }
.pq-btn--small { min-height: 36px; padding: 6px 14px; font-size: 14px; border-radius: 10px; }
@media (hover: hover) and (pointer: fine) {
  .pq-btn:hover { background: var(--pq-navy-deep); }
  .pq-btn--ghost:hover { background: var(--pq-stone); }
  .pq-btn--plain:hover { background: rgba(70, 113, 159, .08); }
  .pq-btn--danger:hover { background: #fbdbe1; }
  .pq-btn--success:hover { background: #17713d; }
}

/* Karten & Listen (inset grouped) */
.pq-card { background: #fff; border-radius: var(--pq-radius-lg); box-shadow: var(--pq-shadow); padding: 20px; }
.pq-list { background: #fff; border-radius: var(--pq-radius); box-shadow: var(--pq-shadow); overflow: hidden; margin: 0; padding: 0; list-style: none; }
.pq-row {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 16px; position: relative;
  color: inherit; text-decoration: none; background: #fff; transition: background-color .12s ease;
}
.pq-row + .pq-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--pq-line); }
.pq-row-main { flex: 1; min-width: 0; }
.pq-row-main .pq-headline, .pq-row-main .pq-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pq-row-chevron::after { content: "›"; font-size: 24px; line-height: 1; color: #c4c3c8; }
a.pq-row:active, button.pq-row:active { background: var(--pq-fill); }
@media (hover: hover) and (pointer: fine) { a.pq-row:hover { background: #faf9f7; } }
.pq-section-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--pq-muted); margin: 28px 16px 8px; }

/* Formulare */
.pq-field { display: grid; gap: 6px; margin: 0 0 16px; }
.pq-field > span { font-size: 14px; font-weight: 600; color: var(--pq-text); }
.pq-input, .pq-ui input[type="text"], .pq-ui input[type="email"], .pq-ui input[type="tel"], .pq-ui input[type="url"],
.pq-ui input[type="password"], .pq-ui input[type="number"], .pq-ui input[type="datetime-local"], .pq-ui input[type="date"], .pq-ui select, .pq-ui textarea {
  width: 100%; min-height: 50px; padding: 13px 14px; border-radius: 12px; border: 1px solid #d4d2cd; background: #fff;
  font: 400 16px/1.4 var(--pq-font); color: var(--pq-text); transition: border-color .15s ease, box-shadow .15s ease;
}
.pq-ui textarea { min-height: 120px; resize: vertical; }
.pq-ui input:focus, .pq-ui select:focus, .pq-ui textarea:focus { outline: none; border-color: var(--pq-blue); box-shadow: 0 0 0 4px rgba(70, 113, 159, .15); }
.pq-check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; cursor: pointer; }
.pq-check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--pq-navy); flex: none; }
.pq-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Segmented Control */
.pq-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 11px; background: #e9e8e4; position: relative; }
.pq-seg button, .pq-seg a, .pq-seg label {
  -webkit-appearance: none; border: 0; background: transparent; cursor: pointer; text-decoration: none; text-align: center;
  min-height: 34px; padding: 6px 14px; border-radius: 9px; font: 600 14px/1.2 var(--pq-font); color: var(--pq-text);
  transition: background-color .2s var(--pq-ease), box-shadow .2s var(--pq-ease);
}
.pq-seg .is-active, .pq-seg [aria-pressed="true"], .pq-seg input:checked + span { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }
.pq-seg input { position: absolute; opacity: 0; pointer-events: none; }

/* Badges & Chips */
.pq-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--pq-red); color: #fff; font-size: 12px; font-weight: 700; }
.pq-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--pq-fill); color: var(--pq-text); font-size: 13px; font-weight: 600; }
.pq-chip--blue { background: #e6eef7; color: var(--pq-navy); }
.pq-chip--green { background: #e3f3e9; color: var(--pq-green); }
.pq-chip--pink { background: #fde6f0; color: #b8336f; }
.pq-chip--gold { background: #fbf3d1; color: #7a6300; }

/* Leerzustand & Toast */
.pq-empty { text-align: center; padding: 48px 24px; color: var(--pq-muted); }
.pq-empty .pq-title { margin-bottom: 6px; }
.pq-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 1000; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 14px; background: rgba(17, 27, 44, .92); color: #fff; font-weight: 600; font-size: 15px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transform: translate(-50%, 20px); opacity: 0; transition: transform 300ms var(--pq-ease), opacity 200ms ease; pointer-events: none;
}
.pq-toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* Sheet (Detailansicht, fährt von unten ein) */
.pq-sheet-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(17, 27, 44, .35); opacity: 0; transition: opacity 250ms ease; }
.pq-sheet-backdrop.is-on { opacity: 1; }
.pq-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 901; max-height: 92vh; overflow: auto; overscroll-behavior: contain;
  background: var(--pq-paper); border-radius: 22px 22px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 420ms cubic-bezier(0.32, 0.72, 0, 1);
}
.pq-sheet.is-on { transform: translateY(0); }
.pq-sheet-grabber { width: 40px; height: 5px; border-radius: 3px; background: #cfcdc8; margin: 6px auto 14px; }
@media (min-width: 900px) {
  .pq-sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(720px, 92vw); max-height: 88vh; border-radius: 22px;
    transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform 320ms var(--pq-ease), opacity 200ms ease; }
  .pq-sheet.is-on { transform: translate(-50%, -50%); opacity: 1; }
  .pq-sheet-grabber { display: none; }
}

/* Tab-Leiste (mobil unten, Desktop als Sidebar – Layout im Portal-Modul) */
.pq-tabbar {
  display: flex; justify-content: space-around; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(251, 250, 248, .82); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(17, 27, 44, .08);
}
.pq-tab { position: relative; flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 4px; min-height: 50px; border-radius: 10px;
  color: #6b6a70; text-decoration: none; font-size: 11px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.pq-tab svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pq-tab.is-active { color: var(--pq-navy); }
.pq-tab .pq-badge { position: absolute; top: 2px; left: calc(50% + 6px); }

/* Fragebogen: eine Frage pro Schritt */
.pq-steps { max-width: 640px; margin: 0 auto; }
.pq-progress { height: 4px; border-radius: 2px; background: #e9e8e4; overflow: hidden; margin: 0 0 28px; }
.pq-progress i { display: block; height: 100%; width: 100%; background: var(--pq-navy); transform-origin: left; transform: scaleX(0); transition: transform 400ms var(--pq-ease); }
.pq-step { display: none; }
.pq-step.is-active { display: block; animation: pq-step-in 450ms var(--pq-ease); }
@keyframes pq-step-in { from { opacity: 0; transform: translateY(14px); } }
.pq-step-q { font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; color: var(--pq-ink); margin: 0 0 8px; }
.pq-step-hint { color: var(--pq-muted); margin: 0 0 22px; }
.pq-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pq-option { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pq-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pq-option span {
  display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 14px 16px; border-radius: 14px; background: #fff;
  border: 1.5px solid #e1dfda; font-weight: 600; color: var(--pq-text);
  transition: border-color .15s ease, background-color .15s ease, transform 160ms var(--pq-ease);
}
.pq-option:active span { transform: scale(0.98); }
.pq-option input:checked + span { border-color: var(--pq-navy); background: #eef3f9; color: var(--pq-navy); }
.pq-option input:checked + span::after { content: "✓"; margin-left: auto; font-weight: 800; }
.pq-option input:focus-visible + span { outline: 2px solid var(--pq-blue); outline-offset: 2px; }
.pq-step-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; }

/* Match-Ring */
.pq-match { --p: 0; position: relative; width: 56px; height: 56px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--pq-green) calc(var(--p) * 1%), #e9e8e4 0); display: grid; place-items: center; }
.pq-match::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.pq-match b { position: relative; font-size: 14px; font-weight: 800; color: var(--pq-ink); }

/* Avatar */
.pq-avatar { width: 44px; height: 44px; font-size: 17px; border-radius: 50%; object-fit: cover; background: var(--pq-navy); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.pq-avatar--36 { width: 36px; height: 36px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .pq-ui *, .pq-sheet, .pq-toast, .pq-step.is-active { transition-duration: 1ms !important; animation: none !important; }
}
