/* Swedish Association in New Zealand: membership app styles.
   Light, airy Nordic design in Swedish blue and yellow, with the logo's
   navy and gold for warmth, and a sea-wave motif linking Sweden and Aotearoa. */

:root {
  --blue-900: #1c1b4d;   /* logo navy */
  --blue-700: #004a85;
  --blue-600: #005293;   /* Swedish blue */
  --blue-500: #006aa7;
  --blue-100: #e3eef7;
  --blue-50: #f2f7fb;
  --yellow-400: #fecc02; /* Swedish yellow */
  --yellow-100: #fff6cc;
  --gold-500: #b8935a;   /* logo gold */
  --gold-100: #f6efe3;
  --mint-50: #f4fbf9;    /* logo background */
  --ink: #16193a;
  --ink-soft: #4d5470;
  --line: #dde3ec;
  --bg: #fbfcfd;
  --white: #fff;
  --red-600: #c0362c;
  --red-50: #fdf0ef;
  --green-600: #1f7a4d;
  --green-50: #eaf7f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(28 27 77 / 5%), 0 10px 30px rgb(28 27 77 / 6%);
  --focus: 0 0 0 3px var(--white), 0 0 0 6px var(--blue-500);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath d='M0 30 C150 0 300 60 450 30 S750 0 900 30 S1100 60 1200 30 V60 H0Z' fill='%23e3eef7'/%3E%3Cpath d='M0 40 C200 15 350 65 600 40 S1000 15 1200 40 V60 H0Z' fill='%23d3e4f2'/%3E%3C/svg%3E");
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 85% -120px, rgb(254 204 2 / 10%), transparent 70%),
    radial-gradient(1100px 500px at 10% -180px, var(--blue-100), transparent 70%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue-600); text-underline-offset: 3px; }
a:hover { color: var(--blue-900); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
code { font-size: 0.875em; background: var(--blue-50); padding: 0.1em 0.35em; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header & footer ---------- */
.site-header {
  background: rgb(255 255 255 / 85%);
  backdrop-filter: saturate(1.4) blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.site-header__inner {
  max-width: 760px; margin: 0 auto; padding: 0.6rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.site-header__inner.is-wide, .page.is-wide { max-width: 1180px; }
/* A slim Swedish flag stripe: blue with a yellow band. */
.flag-stripe { height: 5px; background: var(--blue-600); position: relative; }
.flag-stripe span { position: absolute; left: 0; right: 0; top: 1.5px; height: 2px; background: var(--yellow-400); }
.brand { display: flex; align-items: center; gap: 0.75rem; color: var(--blue-900); text-decoration: none; }
.brand:hover { color: var(--blue-900); }
.brand__logo { width: 52px; height: 52px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--gold-100); }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-weight: 750; letter-spacing: -0.01em; }
.brand__tag { font-size: 0.8rem; color: var(--gold-500); font-weight: 600; letter-spacing: 0.02em; }

/* Language switch: a small pill with the other language's flag. */
.lang-switch {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.9rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--white); color: var(--blue-900); font-weight: 600;
  font-size: 0.9rem; text-decoration: none; min-height: 40px;
}
.lang-switch:hover { border-color: var(--blue-500); background: var(--blue-50); color: var(--blue-900); }
.lang-switch__flag { width: 22px; height: 15px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.lang-switch__flag--sv {
  background:
    linear-gradient(90deg, transparent 6px, var(--yellow-400) 6px, var(--yellow-400) 9px, transparent 9px),
    linear-gradient(180deg, transparent 6px, var(--yellow-400) 6px, var(--yellow-400) 9px, transparent 9px),
    var(--blue-500);
}
.lang-switch__flag--en { display: none; }
@media (max-width: 480px) { .site-header__inner { flex-wrap: nowrap; } .brand__tag { display: none; } .brand__name { font-size: 0.9rem; } }

.admin-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.admin-nav a, .admin-nav .link-button { color: var(--blue-900); font-weight: 600; text-decoration: none; font-size: 0.95rem; }
.admin-nav__who { color: var(--ink-soft); font-size: 0.875rem; display: inline-flex; align-items: center; gap: 0.4rem; }
.admin-nav a:hover, .admin-nav .link-button:hover { color: var(--blue-600); text-decoration: underline; }

.site-footer {
  margin-top: auto; padding: 0 1.25rem 2rem; text-align: center; color: var(--ink-soft); font-size: 0.875rem;
  background: linear-gradient(180deg, transparent 60px, #d3e4f2 60px);
}
.site-footer__wave { height: 60px; margin: 2rem -1.25rem 0; background: var(--wave) bottom / 100% 100% no-repeat; }
.site-footer__logo { width: 56px; height: 56px; border-radius: 50%; margin-top: 1rem; box-shadow: 0 0 0 3px var(--white); }
.site-footer__motto { font-weight: 700; color: var(--blue-900); letter-spacing: 0.04em; margin: 0.5rem 0; }
.site-footer a { color: var(--blue-900); }

/* ---------- Layout ---------- */
.page { width: 100%; max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem 1rem; }
.hero { display: flex; align-items: center; gap: 1.5rem; margin: 0.75rem 0 2rem; }
.hero__logo {
  width: 132px; height: 132px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 6px var(--white), 0 0 0 7px var(--gold-100), 0 14px 40px rgb(28 27 77 / 14%);
}
@media (max-width: 620px) {
  .hero { flex-direction: column; text-align: center; gap: 1rem; }
  .hero__logo { width: 112px; height: 112px; }
}
.eyebrow {
  margin: 0 0 0.35rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold-500);
}
h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 0.6rem; color: var(--blue-900); }
h2 { font-size: 1.15rem; color: var(--blue-900); }
.lede { font-size: 1.1rem; color: var(--ink-soft); margin: 0; }
.muted { color: var(--ink-soft); margin: 0.25rem 0 0; }
.stack > * + * { margin-top: 1rem; }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem; margin: 0 0 1.25rem;
}
fieldset.card { min-width: 0; }
.card__title {
  display: flex; align-items: center; gap: 0.6rem; font-size: 1.15rem; font-weight: 700;
  color: var(--blue-900); padding: 0; margin: 0 0 0.25rem; float: left; width: 100%;
}
.card__title + * { clear: both; }
.card__intro { color: var(--ink-soft); margin: 0 0 1.25rem; font-size: 0.95rem; }
.step {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--yellow-400); color: var(--blue-900); font-size: 0.9rem; font-weight: 800;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } .card { padding: 1.15rem; } }

/* ---------- Form fields ---------- */
.field { margin-bottom: 1.1rem; }
.field > label, .label { display: block; font-weight: 600; margin: 0 0 0.35rem; }
.field__hint { margin: -0.15rem 0 0.4rem; font-size: 0.85rem; color: var(--ink-soft); }
.req { color: var(--red-600); }
.optional { font-weight: 400; color: var(--ink-soft); font-size: 0.875rem; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"],
input[type="search"], input[type="password"], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--white);
  border: 1.5px solid #c3cfdb; border-radius: var(--radius-sm); padding: 0.7rem 0.85rem;
  min-height: 48px; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 88px; }
input:hover, select:hover, textarea:hover { border-color: #9fb2c6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 4px rgb(0 106 167 / 18%); }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.select { position: relative; }
.select select { appearance: none; padding-right: 2.5rem; cursor: pointer; }
.select::after {
  content: ""; position: absolute; right: 1rem; top: 50%; width: 9px; height: 9px; pointer-events: none;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: translateY(-70%) rotate(45deg);
}

.has-error input, .has-error select, .has-error textarea { border-color: var(--red-600); }
.field__error { color: var(--red-600); font-size: 0.875rem; font-weight: 500; margin: 0.35rem 0 0; }
.field__error::before { content: "⚠ "; }

.choice-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; gap: 0.5rem; min-width: 110px; justify-content: center;
  padding: 0.65rem 1.25rem; border: 1.5px solid #c3cfdb; border-radius: 999px; font-weight: 600; background: var(--white);
  transition: all 0.15s;
}
.choice:hover span { border-color: var(--blue-500); }
.choice input:checked + span { background: var(--blue-600); border-color: var(--blue-600); color: var(--white); }
.choice input:focus-visible + span { box-shadow: var(--focus); }
.has-error .choice span { border-color: var(--red-600); }

.children { margin-top: 0.5rem; padding: 1rem; background: var(--blue-50); border-radius: var(--radius-sm); }
.children[hidden] { display: none; }
.year-list { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.6rem; }
.year-item { display: flex; gap: 0.35rem; }
.year-item input { min-width: 0; }

.checkbox, .field > label.checkbox { display: flex; gap: 0.75rem; align-items: flex-start; font-weight: 500; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; margin: 0.15rem 0 0; flex: none; accent-color: var(--blue-600); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.card--privacy { background: linear-gradient(180deg, var(--yellow-100), var(--white) 70%); border-color: #f1e3a3; }
.privacy-points { margin: 0.75rem 0 1.25rem; padding: 0; list-style: none; }
.privacy-points li { position: relative; padding-left: 1.75rem; margin-bottom: 0.5rem; color: var(--ink-soft); }
.privacy-points li::before {
  content: "✓"; position: absolute; left: 0; top: 0.05rem; width: 1.2rem; height: 1.2rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; background: var(--green-50); color: var(--green-600);
}

/* ---------- Buttons ---------- */
.actions { display: flex; justify-content: flex-end; margin: 0.5rem 0 1rem; }
.primary-button, .ghost-button, .danger-button, .icon-button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 999px; border: 1.5px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; text-decoration: none;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
}
.primary-button { background: var(--blue-600); color: var(--white); padding: 0.85rem 1.75rem; min-height: 48px; box-shadow: 0 4px 14px rgb(0 82 147 / 25%); }
.primary-button:hover { background: var(--blue-700); color: var(--white); }
.primary-button:active { transform: translateY(1px); }
.primary-button[disabled] { opacity: 0.7; cursor: progress; }
.member-form .actions .primary-button { min-width: 240px; }
@media (max-width: 620px) { .member-form .actions .primary-button { width: 100%; } }
.ghost-button { background: var(--white); color: var(--blue-600); border-color: var(--line); padding: 0.6rem 1.2rem; min-height: 44px; }
.ghost-button:hover { border-color: var(--blue-500); background: var(--blue-50); }
.danger-button { background: var(--red-600); color: var(--white); padding: 0.6rem 1.2rem; min-height: 44px; }
.danger-button:hover { background: #9e2a22; }
.icon-button { width: 48px; flex: none; background: var(--white); border-color: #c3cfdb; color: var(--ink-soft); font-size: 1.3rem; }
.icon-button:hover { color: var(--red-600); border-color: var(--red-600); }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.inline-form { display: inline; margin: 0; }
.danger-link { color: var(--red-600); font-weight: 600; }
.danger-link:hover { text-decoration: underline; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; margin: 0 0 1.25rem; border: 1px solid; }
.alert h2 { margin: 0 0 0.4rem; font-size: 1rem; color: inherit; }
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert a { color: inherit; font-weight: 600; }
.alert--error { background: var(--red-50); border-color: #f0c4c0; color: #7d211b; }
.alert--success { background: var(--green-50); border-color: #b9e2cb; color: #145236; }
.alert--info { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-900); }

.card--success { text-align: center; padding: 2.5rem 1.5rem; }
.success-icon {
  width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--green-50); color: var(--green-600); font-size: 2rem; font-weight: 800;
}

.prose h2 { margin-top: 1.75rem; }
.setup-key { display: block; font-size: 1rem; padding: 0.75rem 1rem; word-break: break-all; user-select: all; }
.prose li { margin-bottom: 0.35rem; }

/* ---------- Admin ---------- */
.auth-card { max-width: 420px; margin: 2rem auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); border-top: 4px solid var(--yellow-400); }
.stat__value { display: block; font-size: 1.8rem; font-weight: 800; color: var(--blue-900); line-height: 1.1; }
.stat__label { color: var(--ink-soft); font-size: 0.875rem; }
.filters { display: grid; grid-template-columns: 2fr 1fr auto; gap: 1rem; align-items: end; padding: 1rem 1.25rem; }
.filters .field { margin: 0; }
.filters__actions { display: flex; gap: 0.5rem; }
@media (max-width: 720px) { .filters { grid-template-columns: 1fr; } }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.table th, .table td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: var(--blue-50); color: var(--blue-900); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tbody tr:hover { background: #fafcfe; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .empty { text-align: center; color: var(--ink-soft); padding: 2rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: -0.25rem 0 1.25rem; }
.pager__links { display: flex; align-items: center; gap: 0.75rem; }
details.card summary { cursor: pointer; font-weight: 600; }
details.card .table { margin-top: 1rem; }
.badge { display: inline-block; background: var(--yellow-100); color: #6b5300; border-radius: 999px; padding: 0.1rem 0.6rem; font-size: 0.8rem; font-weight: 700; }
.details dt { font-weight: 600; }
.details dd { margin: 0 0 0.5rem; }
.danger-zone { border-color: #f0c4c0; }
.danger-zone h2 { margin-top: 0; color: var(--red-600); }
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.danger-row p { margin: 0.2rem 0 0; font-size: 0.9rem; }
.danger-row button { flex: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
