/**
 * Portal – einheitliches Design
 * Fokus: Lesbarkeit, Einheitlichkeit, Bedienbarkeit. Keine Kacheln.
 */
@import url('../../../assets/css/fonts-local.css');

:root {
  --font: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f0f7f4;
  --bg-card: #fff;
  --text: #1a2e1a;
  --text-muted: #4a5d4a;
  --border: #c5d9cc;
  --accent: #2d5a27;
  --accent-hover: #234a1f;
  --nav-bg: #fff;
  --nav-border: #c5d9cc;
  --nav-text: #1a2e1a;
  --nav-active: var(--accent);
  --radius: 12px;
  --space: 1.25rem;
  --page-width: 52rem;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  min-height: 100vh;
}

/* Startseite: dezenter Hintergrund */
body .p-page .p-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
body .p-page .p-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ----- Top-Navigation (Intern) ----- */
.p-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.5rem;
  padding: 0.75rem var(--space);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  font-size: 0.9375rem;
}

.p-nav a {
  color: var(--nav-text);
  text-decoration: none;
}

.p-nav a:hover {
  color: var(--accent);
}

.p-nav a.active {
  color: var(--nav-active);
  font-weight: 600;
}

/* ----- Seitencontainer ----- */
.p-page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: var(--space);
}

.p-page--wide {
  max-width: 56rem;
}

/* ----- Überschriften ----- */
.p-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.p-subtitle {
  margin: 0 0 1.5rem 0;
  font-size: 1rem;
  color: var(--text-muted);
}

/* ----- Link-Listen (ersetzt Kacheln) ----- */
.p-section {
  margin-bottom: 2rem;
}

.p-section__title {
  margin: 0 0 0.5rem 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.p-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.p-list__item {
  border-bottom: 1px solid var(--border);
}

.p-list__item:last-child {
  border-bottom: none;
}

.p-list__link {
  display: block;
  padding: 0.875rem var(--space);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
}

.p-list__link:hover {
  background: var(--bg);
  color: var(--accent);
}

.p-list__link:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ----- Startseite: große Kacheln ----- */
.p-list--tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.25rem;
  border: none;
  background: transparent;
  padding: 0;
}

.p-list--tiles .p-list__item {
  border: none;
  margin: 0;
}

.p-list--tiles .p-list__link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  padding: 1.5rem var(--space);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.p-list--tiles .p-list__link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 90, 39, 0.12);
  border-color: var(--accent);
  background: var(--bg-card);
  color: var(--accent);
}

@media (min-width: 640px) {
  .p-list--tiles {
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1.5rem;
  }
  .p-list--tiles .p-list__link {
    min-height: 6rem;
    font-size: 1.25rem;
    padding: 2rem var(--space);
  }
}

/* Optional: Beschreibung unter dem Link */
.p-list__desc {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* Hervorgehobene Liste (z. B. zentrale Quelldatei) */
.p-list--highlight {
  background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
  border: 1px solid #fca5a5;
  border-left: 4px solid #dc2626;
}

.p-list--highlight .p-list__item {
  border-bottom: none;
}

.p-list--highlight .p-list__link {
  font-weight: 600;
  color: #b91c1c;
}

.p-list--highlight .p-list__link:hover {
  background: rgba(220, 38, 38, 0.08);
}

.p-list--highlight .p-list__desc {
  padding: 0 var(--space) 0.875rem var(--space);
}

/* ----- Kontextsensitive Hilfe ----- */
.p-help-inline {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem 0;
  background: #e8f4f8;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.p-help-inline__icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--accent);
}

.p-help-inline__content {
  flex: 1;
}

.p-help-inline__title {
  display: block;
  margin-bottom: 0.25rem;
}

.p-help-inline__text {
  color: var(--text);
}

.p-help-inline__link {
  display: inline-block;
  margin-top: 0.35rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.p-help-inline__link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ----- Buttons ----- */
.p-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.p-btn:hover {
  background: var(--accent-hover);
}

.p-btn--secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.p-btn--secondary:hover {
  background: var(--bg);
  border-color: var(--text-muted);
}

.p-btn--danger {
  background: #b91c1c;
}

.p-btn--danger:hover {
  background: #991b1b;
}

.p-btn--small {
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
}

/* ----- Formulare ----- */
.p-form-group {
  margin-bottom: 1rem;
}

.p-form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

.p-input,
.p-textarea {
  width: 100%;
  max-width: 28rem;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
}

.p-input:focus,
.p-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.p-textarea {
  min-height: 8rem;
  resize: vertical;
}

/* ----- Tabellen ----- */
.p-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.p-table th,
.p-table td {
  padding: 0.625rem var(--space);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.p-table th {
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
}

.p-table tr:last-child td {
  border-bottom: none;
}

/* ----- Breadcrumb / Zurück ----- */
.p-back {
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.p-back a {
  color: var(--text-muted);
  text-decoration: none;
}

.p-back a:hover {
  color: var(--accent);
}

.p-back span {
  color: var(--border);
  margin: 0 0.35rem;
}

/* ----- Meldungen ----- */
.p-msg {
  padding: 0.75rem var(--space);
  margin-bottom: 1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

.p-msg--success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.p-msg--error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ----- Footer Startseite ----- */
.p-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

.p-footer--with-login {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  text-align: left;
}
.p-footer__main { flex: 1; min-width: 0; }
.p-footer__login {
  flex: 0 0 auto;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 12rem;
}

.p-footer__pin-area[hidden] {
  display: none !important;
}
.p-footer__login .p-msg { margin-bottom: 0.5rem; }
.p-footer__label,
.p-footer__status { margin: 0 0 0.5rem 0; font-weight: 500; color: var(--text); }
.p-footer__pin-form .p-pin-dots { margin-bottom: 1rem; }
.p-footer__pin-form .p-pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  max-width: 10rem;
}
.p-footer__pin-form .p-pin-key {
  min-width: 2.25rem;
  min-height: 2.25rem;
  font-size: 1rem;
}
@media (max-width: 640px) {
  .p-footer--with-login { flex-direction: column; align-items: stretch; text-align: center; }
  .p-footer__login { margin-top: 0.5rem; }
  .p-footer__pin-form .p-pin-keypad { margin: 0 auto; }
}

/* ----- PIN-Seite (Intern) ----- */
.p-pin-wrap {
  max-width: 20rem;
  margin: 2rem auto;
  padding: var(--space);
  text-align: center;
}

.p-pin-title {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
}

.p-pin-dots {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.p-pin-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s;
}

.p-pin-dot.filled {
  background: var(--text);
}

.p-pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.p-pin-key {
  aspect-ratio: 1;
  max-width: 4.5rem;
  margin: 0 auto;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* verhindert Doppelklick-/Doppeltipp-Zoom */
  transition: background 0.15s, border-color 0.15s;
}

.p-pin-key:hover {
  background: var(--bg);
  border-color: var(--text-muted);
}

.p-pin-key:active {
  transform: scale(0.96);
}

.p-pin-key.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.p-pin-key.empty:active {
  transform: none;
}

/* PIN auf dem Handy: größere Tasten, bessere Touch-Bedienung */
@media (max-width: 640px) {
  .p-pin-wrap {
    max-width: none;
    width: 100%;
    min-width: 0;
    padding: 1.5rem 1.25rem;
    margin: 1.5rem 0;
  }

  .p-pin-title {
    font-size: 1.375rem;
    margin-bottom: 1.75rem;
  }

  .p-pin-dots {
    gap: 1rem;
    margin-bottom: 2.5rem;
  }

  .p-pin-dot {
    width: 16px;
    height: 16px;
  }

  .p-pin-keypad {
    gap: 0.75rem;
    max-width: 18rem;
    margin: 0 auto;
  }

  .p-pin-key {
    min-width: 4rem;
    min-height: 4rem;
    max-width: 5.5rem;
    width: 100%;
    font-size: 1.75rem;
    font-weight: 500;
  }

  .p-pin-key.empty {
    min-width: 0;
    min-height: 0;
    max-width: none;
  }
}

/* Sehr kleine Displays: Keypad nutzt mehr Breite */
@media (max-width: 380px) {
  .p-pin-keypad {
    max-width: none;
    padding: 0 0.5rem;
  }

  .p-pin-key {
    min-width: 3.5rem;
    min-height: 3.5rem;
    font-size: 1.5rem;
  }
}

/* ----- Statistik-Karten (z. B. Containern, FesteFeiern) ----- */
.p-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.p-stat-card {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
}

.p-stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.p-stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ----- Gebuchte Slots (Containern) ----- */
.p-slots {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
  margin-top: 1rem;
}

.p-slot-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.p-slot-item:last-child {
  margin-bottom: 0;
}

.p-slot-date {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.2rem;
}

.p-slot-time,
.p-slot-volunteer {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.p-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ----- Symbol-/Icon-Auswahl (z. B. FesteFeiern) ----- */
.p-icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.p-icon-picker__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.p-icon-picker__item:hover {
  border-color: var(--text-muted);
  background: var(--bg);
}

.p-icon-picker__item.is-selected {
  border-color: var(--accent);
  background: rgba(13, 148, 136, 0.08);
  color: var(--accent);
}

.p-icon-picker__item i {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
  display: block;
}

/* ----- Farbpalette (z. B. FesteFeiern) ----- */
.p-color-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.p-color-picker__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.35rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.p-color-picker__item:hover {
  border-color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.p-color-picker__item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.25);
  color: var(--text);
}

.p-color-picker__swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--swatch, var(--border));
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.p-color-picker__label {
  display: block;
  text-align: center;
  line-height: 1.2;
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .p-page {
    padding: 1rem;
  }
  .p-nav {
    padding: 0.5rem 1rem;
  }
}
