/* Terminportal SPE Mühle – Ergänzungen zum Theme der Homepage
 * Farben kommen aus dem Theme (--color-theme / --color-theme-soft) und werden je Abteilung gesetzt.
 */

/* ---------- Farben je Abteilung (wie auf der Homepage) ---------- */
body.theme-main   { --color-theme: #F0CA63; --color-theme-soft: #fbf2d7; }
body.theme-kita   { --color-theme: #8FB77B; --color-theme-soft: #ebf2e8; }
body.theme-sozial { --color-theme: #9BB9E5; --color-theme-soft: #ecf2fa; }
body.theme-sucht  { --color-theme: #ED8C6C; --color-theme-soft: #fcece7; }
body.theme-youth  { --color-theme: #9FCEC6; --color-theme-soft: #e6f2f0; }

body.tp {
  --tp-text: #1d1d1b;
  --tp-muted: #5d5b5b;
  --tp-border: #d7d7d7;
  --tp-bg: #ffffff;
  --tp-error: #b3261e;
  --tp-error-soft: #fbe9e7;
  --tp-success: #2e6b30;
  --tp-success-soft: #e8f3e8;
  --tp-warning-soft: #fff4d6;
  --tp-radius: 3px;
  background: var(--tp-bg);
  color: var(--tp-text);
}

/* Ersatz, falls das Theme-Stylesheet (noch) nicht geladen werden konnte */
body.tp-no-theme { font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif; margin: 0; line-height: 1.5; }
body.tp-no-theme .wrapper { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.tp-fallback-header { background: var(--color-theme-soft); padding: 24px 0; }
.tp-fallback-logo { font-size: 1.6rem; font-weight: 600; color: inherit; text-decoration: none; }
.tp-fallback-footer { background: #f4f4f4; padding: 24px 0; margin-top: 48px; }

/* ---------- Sprunglink ---------- */
.tp-skip { position: absolute; left: -9999px; top: 0; }
.tp-skip:focus { left: 16px; top: 16px; z-index: 1000; background: #fff; padding: 8px 12px; border: 2px solid var(--tp-text); }

/* ---------- Portal-Leiste unter dem Kopfbereich ---------- */
.tp-bar { background: var(--color-theme); color: #000; font-size: .9rem; }
.tp-bar .wrapper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 10px; padding-bottom: 10px; }
.tp-bar a { color: inherit; text-decoration: none; }
.tp-bar a:hover, .tp-bar a[aria-current="page"] { text-decoration: underline; }
.tp-bar__home { font-weight: 600; }
.tp-bar__sep { opacity: .6; }
.tp-bar__nav { display: flex; flex-wrap: wrap; gap: 16px; }
.tp-bar__user { margin: 0 0 0 auto; display: flex; align-items: center; gap: 12px; }

/* ---------- Inhalt ---------- */
.tp-main .section, .tp-section { padding-top: 40px; padding-bottom: 40px; }
.tp-intro { background: var(--color-theme-soft); padding-top: 48px; padding-bottom: 48px; }
.tp-intro h1 { margin: .2em 0 .4em; }
.tp-intro .eyebrow a { color: inherit; }
.tp-lead { font-size: 1.15em; max-width: 46em; }

/* Kacheln der Abteilungen */
.tp-teasers .section-copy { margin-bottom: 24px; }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 220px)); gap: 20px; }
.tp-grid .tp-tile { width: auto; margin: 0; display: flex; flex-direction: column; padding: 16px 16px 14px; background: #fff; color: #000;
  border-radius: var(--tp-radius); text-decoration: none; border-top: 6px solid var(--tile-color, var(--color-theme)); }
.tp-grid .tp-tile .teaser-copy { flex: 1; }
/* Theme: .section.teasers .teaser-image-wrapper .teaser-image ist absolut positioniert – hier bewusst überschreiben */
.section.teasers .tp-grid .tp-tile .teaser-image-wrapper { height: auto; min-height: 0; padding: 0; margin: 0 0 10px; }
.section.teasers .tp-grid .tp-tile .teaser-image-wrapper .teaser-image { position: static; height: 150px; width: 100%; padding: 0; object-fit: contain; display: block; }
.section.teasers .tp-grid .tp-tile .teaser-copy { padding: 0; }
.tp-grid .tp-tile h3 { font-size: 1.15em; margin: 0 0 .3em; }
.tp-grid .tp-tile .teaser-copy p { font-size: .85em; line-height: 1.4; margin: 0; }
.tp-grid .tp-tile .teaser-link { margin: 10px 0 0; font-size: .8em; }
@media (max-width: 480px) { .tp-grid { grid-template-columns: 1fr 1fr; gap: 12px; } .section.teasers .tp-grid .tp-tile .teaser-image-wrapper .teaser-image { height: 110px; } }
.tp-grid .tp-tile:hover h3, .tp-grid .tp-tile:focus-visible h3 { text-decoration: underline; }
.tp-tile--main   { --tile-color: #F0CA63; }
.tp-tile--kita   { --tile-color: #8FB77B; }
.tp-tile--sozial { --tile-color: #9BB9E5; }
.tp-tile--sucht  { --tile-color: #ED8C6C; }
.tp-tile--youth  { --tile-color: #9FCEC6; }

.tp-notice { background: var(--color-theme-soft); border-left: 6px solid var(--color-theme); padding: 16px 20px; margin-bottom: 24px; border-radius: var(--tp-radius); }

/* Rechtstexte: Abstand zur Portal-Leiste */
.tp-legal { padding-top: 32px; padding-bottom: 32px; }
.tp-legal > h2#terminportal { margin-top: 2.5em; padding-top: 1.5em; border-top: 2px solid var(--color-theme); }

/* Fußzeile: Links des Portals */
.tp-legal-links { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: .85rem; padding-top: 12px; padding-bottom: 24px; color: var(--tp-muted); }
.tp-legal-links a { color: inherit; }
.tp-version { margin-left: auto; }

/* ---------- Lesbarkeit: Theme-Regeln für .section neutralisieren ----------
 * Das Theme gestaltet Eingabefelder in .section weiß auf halbtransparentem Grund (für farbige Flächen)
 * und Fließtext in 40 % Schwarz. Auf den weißen Flächen des Portals wäre das unlesbar.
 */
.tp-main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.tp-main textarea,
.tp-main select {
  color: var(--tp-text);
  background-color: #fff;
  font-family: inherit;
  font-weight: 400;
  font-size: 1rem;
  padding: 9px 12px;
  border: 1px solid #767676;
  border-radius: var(--tp-radius);
  margin: 0;
}
.tp-main input::placeholder, .tp-main textarea::placeholder { color: #767676; opacity: 1; }
.tp-main input:focus, .tp-main textarea:focus, .tp-main select:focus { border-color: var(--tp-text); outline: 3px solid var(--color-theme); outline-offset: 1px; }
.tp-main input[type="checkbox"], .tp-main input[type="radio"] { width: 1.1em; height: 1.1em; margin: 0 .4em 0 0; padding: 0; vertical-align: -0.15em; accent-color: #1d1d1b; }
.tp-card, .tp-card p, .tp-notice, .tp-notice p, .tp-type, .tp-type p, .tp-alert, .tp-table, .tp-form label, .tp-form legend,
.tp-admin-section, .tp-admin-section p, .tp-admin-section li { color: var(--tp-text); }
.tp-card p, .tp-admin-section p { font-weight: 400; }
.tp-hint, .tp-card .tp-hint, .tp-admin-section .tp-hint, .tp-type__meta { color: var(--tp-muted) !important; }
.tp-main a:not(.tp-btn):not(.tp-tile):not(.tp-slotbtn) { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.tp-main .link { text-decoration: none; }
.tp-admin-section { padding-top: 40px; padding-bottom: 40px; }

/* ---------- Verwaltung ---------- */
.tp-admin-title { margin-top: 0; }
.tp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-bottom: 24px; }
.tp-card { background: #fff; border: 1px solid var(--tp-border); border-radius: var(--tp-radius); padding: 24px; margin-bottom: 24px; }
.tp-card h2 { font-size: 1.3em; margin-top: 0; }
.tp-card--narrow { max-width: 560px; }
.tp-list { list-style: none; padding: 0; margin: 0; }
.tp-list li { padding: 4px 0; }
.tp-dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; margin-right: .4em; vertical-align: baseline; background: var(--tile-color, #ccc); }
.tp-dot--main { --tile-color: #F0CA63; } .tp-dot--kita { --tile-color: #8FB77B; } .tp-dot--sozial { --tile-color: #9BB9E5; }
.tp-dot--sucht { --tile-color: #ED8C6C; } .tp-dot--youth { --tile-color: #9FCEC6; }

.tp-alert { padding: 12px 16px; border-radius: var(--tp-radius); margin-bottom: 12px; border-left: 5px solid; }
.tp-alert--success { background: var(--tp-success-soft); border-color: var(--tp-success); }
.tp-alert--error   { background: var(--tp-error-soft); border-color: var(--tp-error); }
.tp-alert--warning { background: var(--tp-warning-soft); border-color: #c99a1a; }

.tp-table-wrap { overflow-x: auto; margin-bottom: 24px; }
.tp-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tp-table th, .tp-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--tp-border); vertical-align: top; }
.tp-table thead th { background: var(--color-theme-soft); font-weight: 600; }
.tp-table--kv th { width: 220px; font-weight: 600; }
.tp-muted td { color: var(--tp-muted); }
.tp-nowrap { white-space: nowrap; }
.tp-small { font-size: .85em; word-break: break-word; }
.tp-badge { display: inline-block; font-size: .75em; padding: 1px 8px; border-radius: 10px; background: #eee; }
.tp-badge--strong { background: var(--color-theme); }

.tp-form { max-width: 640px; }
.tp-field { margin: 0 0 18px; border: 0; padding: 0; }
.tp-field > label, .tp-field > legend { display: block; font-weight: 600; margin-bottom: 6px; }
.tp-field input[type="text"], .tp-field input[type="email"] {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; border: 1px solid #888; border-radius: var(--tp-radius); background: #fff; }
.tp-field input:focus-visible, .tp-btn:focus-visible, .tp-linkbtn:focus-visible { outline: 3px solid var(--tp-text); outline-offset: 2px; }
.tp-check { display: block; padding: 4px 0; font-weight: 400; }
.tp-hint { color: var(--tp-muted); font-size: .9em; }
.tp-static { margin: 0; }
.tp-inline { display: inline; margin-left: 12px; }

.tp-btn { display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px; font: inherit; font-weight: 600; color: #000;
  background: var(--color-theme); border: 0; border-radius: var(--tp-radius); cursor: pointer; text-decoration: none; }
.tp-btn:hover { filter: brightness(.95); }
.tp-btn--small { padding: 4px 12px; font-size: .9em; }
.tp-btn--ms { background: #fff; border: 1px solid #8c8c8c; }
.tp-linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.tp-debug { white-space: pre-wrap; font-size: .8rem; background: #f4f4f4; padding: 12px; overflow-x: auto; }

/* ---------- Formulare (0.2.0) ---------- */
.tp-form--wide { max-width: none; }
.tp-field input[type="number"], .tp-field input[type="date"], .tp-field input[type="time"], .tp-field input[type="search"],
.tp-field select, .tp-field textarea, .tp-searchform input, .tp-searchform select {
  width: 100%; box-sizing: border-box; padding: 9px 12px; font: inherit; border: 1px solid #888; border-radius: var(--tp-radius); background: #fff; }
.tp-field textarea { resize: vertical; }
.tp-field select:focus-visible, .tp-field textarea:focus-visible, .tp-searchform input:focus-visible { outline: 3px solid var(--tp-text); outline-offset: 2px; }
.tp-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px; }
.tp-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 24px; }
.tp-checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 24px; }
.tp-weekdays { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.tp-searchform { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.tp-searchform input { flex: 1 1 260px; width: auto; }
.tp-searchform select { width: auto; }
.tp-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tp-toolbar h2 { margin: 0; }
.tp-inline-form { display: inline; margin: 0; }
.tp-mt { margin-top: 1.5em; }
.tp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tp-btn--light { background: #fff; border: 1px solid var(--tp-text); }
.tp-btn--danger { background: var(--tp-error); color: #fff; }
.tp-badge--ok { background: var(--tp-success-soft); color: var(--tp-success); }
.tp-badge--bad { background: var(--tp-error-soft); color: var(--tp-error); }
.tp-rules { list-style: none; padding: 0; margin: 0 0 20px; }
.tp-rules li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border-bottom: 1px solid var(--tp-border); }
.tp-rules li:nth-child(odd) { background: #fafafa; }
[hidden] { display: none !important; }

/* Vorschau */
.tp-preview { display: grid; gap: 8px; }
.tp-preview__day { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--tp-border); }
.tp-preview__date { font-weight: 600; }
.tp-preview__slots { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-slot { display: inline-block; padding: 2px 10px; border-radius: 12px; background: var(--color-theme-soft); border: 1px solid var(--color-theme); font-size: .9em; }

/* Öffentliche Liste der Terminarten */
.tp-typelist { display: grid; gap: 20px; }
.tp-type { background: #fff; border: 1px solid var(--tp-border); border-left: 6px solid var(--color-theme); border-radius: var(--tp-radius); padding: 20px 24px; }
.tp-type h2 { margin: 0 0 .3em; font-size: 1.4em; }
.tp-type__meta { color: var(--tp-muted); margin: 0 0 .6em; }

/* ---------- Buchungsverwaltung (0.6.0) ---------- */
.tp-filter { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-end; margin-bottom: 8px; }
.tp-filter .tp-field { flex: 1 1 160px; margin-bottom: 12px; }
.tp-filter .tp-field--button { flex: 0 0 auto; }
.tp-dayrow th { background: #fafafa; font-weight: 600; padding-top: 14px; }
.tp-history li { padding: 3px 0; }
.tp-mt-small { margin-top: 8px; }
.tp-break { word-break: break-all; display: inline-block; }
details summary { cursor: pointer; text-decoration: underline; }

@media print {
  .site-header, .site-footer, .footer-legal, .tp-bar, .tp-legal-links, .tp-noprint, .tp-skip, .cta { display: none !important; }
  .tp-card { border: 0; padding: 0; }
  .tp-admin-section { padding: 0; }
  body.tp { font-size: 11pt; }
  .tp-table th, .tp-table td { padding: 4px 6px; }
  a { text-decoration: none !important; color: #000 !important; }
}

/* ---------- Einmal-Links ---------- */
.tp-main input.tp-copy { width: 100%; max-width: 620px; margin: 6px 8px 6px 0; font-family: monospace; font-size: .85rem; }

/* ---------- Versionsgeschichte ---------- */
.tp-release { max-width: 900px; color: var(--tp-text); }
.tp-release h2 { margin-top: 1.8em; padding-top: .6em; border-top: 3px solid var(--color-theme); font-size: 1.5em; }
.tp-release h2:first-child { margin-top: 0; }
.tp-release h3 { margin-top: 1.2em; font-size: 1.15em; }
.tp-release p, .tp-release li { color: var(--tp-text); line-height: 1.55; }
.tp-release ul { padding-left: 1.3em; }
.tp-release li { margin: .25em 0; }
.tp-release hr { display: none; }
.tp-legal-links a.tp-version { text-decoration: underline; }

/* ---------- Mailtexte (0.5.0) ---------- */
.tp-mailpreview { width: 100%; height: 720px; border: 1px solid var(--tp-border); border-radius: var(--tp-radius); background: #f4f4f4; }
.tp-main code { font-size: .9em; background: #f4f4f4; padding: 1px 5px; border-radius: 3px; }

/* ---------- Buchung (0.3.0) ---------- */
.tp-booking { padding-top: 32px; padding-bottom: 40px; }
.tp-booking .tp-form { max-width: 720px; }
.tp-monthnav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 16px; }
.tp-monthnav h2 { text-align: center; margin: 0; }
.tp-days { display: grid; gap: 4px; }
.tp-day { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--tp-border); }
.tp-day__date { font-weight: 600; }
.tp-day__date span { display: inline-block; min-width: 6.5em; }
.tp-day__slots { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-main a.tp-slotbtn { display: inline-flex; flex-direction: column; align-items: center; min-width: 4.6em; padding: 8px 12px;
  border: 2px solid var(--color-theme); border-radius: var(--tp-radius); background: #fff; color: var(--tp-text); text-decoration: none; font-weight: 600; line-height: 1.2; }
.tp-main a.tp-slotbtn small { font-weight: 400; font-size: .75em; color: var(--tp-muted); }
.tp-main a.tp-slotbtn:hover, .tp-main a.tp-slotbtn:focus-visible { background: var(--color-theme); outline: 3px solid var(--tp-text); outline-offset: 1px; }
.tp-summary { display: grid; grid-template-columns: 110px 1fr; gap: 6px 16px; margin: 0 0 16px; }
.tp-summary dt { color: var(--tp-muted); }
.tp-summary dd { margin: 0; }
.tp-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.tp-btn[disabled] { opacity: .5; cursor: wait; }
.tp-alert p { margin: .2em 0; }

@media (max-width: 768px) {
  .tp-day { grid-template-columns: 1fr; gap: 6px; }
  .tp-summary { grid-template-columns: 1fr; gap: 0; }
  .tp-summary dd { margin-bottom: 8px; }
  .tp-preview__day { grid-template-columns: 1fr; gap: 4px; }
  .tp-bar__user { margin-left: 0; width: 100%; }
  .tp-version { margin-left: 0; }
  .tp-card { padding: 16px; }
}
