:root {
  --aubergine: #3D2538;
  --beige: #C7BBA9;
  --lilla: #ADA1FB;
  --groen: #E4F851;
  --baggrund: #F4F1EE;

  --font-primary: 'Sora', sans-serif;

  --color-text: var(--aubergine);
  --color-background: var(--baggrund);
  --color-accent: var(--groen);
  --color-link: var(--lilla);
  --color-surface: var(--beige);
}

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

body {
  margin: 0;
  font-family: var(--font-primary);
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
}

.site-logo {
  font-family: var(--font-primary);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.site-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem;
}

.site-footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
  color: var(--color-surface);
}

/* Forms */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-primary);
  font-size: 1rem;
  border: 2px solid var(--color-surface);
  border-radius: 6px;
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s;
}

.form-group--checkbox .field_with_errors {
  display: inline;
}

.form-group.form-group--checkbox label {
  display: inline;
  margin-bottom: 0;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-link);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.85;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-text);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

/* Payment options */

.payment-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.payment-options .btn {
  width: 100%;
  text-align: center;
  padding: 0.85rem 1.75rem;
}

/* Loading spinner */

.loading-indicator {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-surface);
  border-top-color: var(--color-text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Flash messages */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.flash-notice {
  background-color: var(--color-accent);
  color: var(--color-text);
}

.flash-alert {
  background-color: #f8d7da;
  color: #721c24;
}

/* Inline field errors */

.form-group--error input,
.form-group--error input:focus {
  border-color: #c0392b;
}

.field-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin: 0.3rem 0 0;
}

/* Admin layout */

.admin-body {
  margin: 0;
  font-family: var(--font-primary);
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.6;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background-color: var(--aubergine);
  color: var(--baggrund);
}

.admin-nav .site-logo {
  color: var(--baggrund);
}

.admin-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--groen);
  color: var(--aubergine);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.admin-nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.admin-nav-link {
  color: var(--baggrund);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
}

.admin-nav-link:hover {
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.admin-nav-link--active {
  background: rgba(255,255,255,0.15);
}

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

/* Admin login */

.admin-login {
  max-width: 400px;
  margin: 4rem auto;
}

/* Stats grid */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem;
  border-left: 4px solid var(--color-surface);
}

.stat-card--success { border-left-color: #27ae60; }
.stat-card--warning { border-left-color: #f39c12; }
.stat-card--danger  { border-left-color: #c0392b; }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

/* Admin table */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-surface);
}

.admin-table th {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #666;
}

.admin-table tbody tr:hover {
  background: rgba(0,0,0,0.02);
}

/* Badges */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge--success { background: #d4edda; color: #155724; }
.badge--warning { background: #fff3cd; color: #856404; }
.badge--danger  { background: #f8d7da; color: #721c24; }
.badge--muted   { background: #e9ecef; color: #6c757d; }

/* Filters */

.admin-filters {
  margin-bottom: 1.5rem;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-input,
.filter-select {
  font-family: var(--font-primary);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--color-surface);
  border-radius: 6px;
  background: #fff;
  color: var(--color-text);
}

.filter-input { flex: 1; min-width: 200px; }

/* Detail grid */

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-grid dt {
  font-weight: 600;
  color: #666;
}

.detail-grid dd {
  margin: 0;
}

.member-actions {
  margin: 1.5rem 0;
}

/* Responsive */

@media (max-width: 640px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }

  .site-header { padding: 1rem; }
  .site-main { padding: 1rem; }
  .site-footer { padding: 1rem; }

  .admin-nav {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .admin-nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .admin-main { padding: 1rem; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-input {
    min-width: 0;
    width: 100%;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid dt {
    margin-top: 0.5rem;
  }

  .payment-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .btn {
    display: block;
    text-align: center;
    width: 100%;
  }

  .bank-info dt,
  .bank-info dd {
    padding: 0.25rem 0;
  }
}
