:root {
  --brand: #173f5f;
  --brand-dark: #102f48;
  --accent: #e91e63;
  --surface: #ffffff;
  --surface-soft: #f4f7fa;
  --border: #dce4eb;
  --text: #17212b;
  --muted: #647382;
  --success: #16835b;
  --danger: #c43845;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(20, 49, 72, 0.1);
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(23, 63, 95, 0.1), transparent 34rem),
    var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.site-header {
  width: 100%;
  padding: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  box-shadow: 0 8px 28px rgba(16, 47, 72, 0.2);
}

.site-header__inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.12);
}

.brand__mark--img {
  padding: 0;
  border: 0;
  background: none;
  border-radius: 11px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

/* Dokumentart-Kennzeichnung (Suche + Admin) */
.doc-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: var(--brand);
  background: #e7eef5;
}

.doc-badge--info {
  color: #a3134a;
  background: #fde7ef;
}

/* Sprachauswahl (Dropdown) */
.lang-select {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.lang-select__label {
  position: absolute;
  left: 12px;
  margin: 0;
  pointer-events: none;
  line-height: 1;
}

.lang-select__icon { font-size: 0.95rem; }

.lang-select select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 38px;
  padding: 7px 34px 7px 36px;
  color: #fff;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffffff' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center,
    rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.lang-select select:hover,
.lang-select select:focus {
  background-color: rgba(255, 255, 255, 0.18);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.lang-select option { color: var(--text); background: #fff; }

.lang-select__go {
  margin-left: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

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

.lang-switcher {
  position: static;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.lang-switcher a {
  min-width: 36px;
  padding: 6px 8px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  transition: 0.2s ease;
}

.lang-switcher a:hover,
.lang-switcher a.active {
  color: var(--brand-dark);
  opacity: 1;
  background: #fff;
  transform: none;
}

.public-main {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 48px;
}

.hero {
  max-width: 760px;
  margin: 0 auto 28px;
  text-align: center;
}

.hero__eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.hero__text {
  max-width: 620px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.search-container {
  width: 100%;
  margin: 28px auto 0;
}

.search-box {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(23, 63, 95, 0.12), var(--shadow);
}

.search-icon {
  margin: 0 0 0 10px;
  color: var(--brand);
  opacity: 0.7;
}

.search-input {
  min-width: 0;
  flex: 1;
  padding: 12px 6px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 1rem;
}

.search-button,
.btn-primary,
.btn-small,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s, background 0.18s, box-shadow 0.18s;
}

.search-button {
  padding: 12px 22px;
}

.search-button:hover,
.btn-primary:hover,
.btn-small:hover,
a.btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 47, 72, 0.2);
}

.results {
  width: 100%;
  max-width: 900px;
  margin: 34px auto 0;
  text-align: left;
}

.results-summary,
.empty-state {
  margin: 0 0 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

.result-card {
  margin-bottom: 14px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 25px rgba(20, 49, 72, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.result-title {
  margin-bottom: 10px;
  color: var(--brand-dark);
  font-size: 1.12rem;
  font-weight: 750;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.result-meta span {
  margin: 0;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.kontakt-frame {
  width: 100%;
  max-width: 900px;
  margin: 52px auto 0;
}

.kontakt-frame iframe {
  width: 100%;
  height: 610px;
  display: block;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}

/* Admin */
#upload-content {
  min-height: 100vh;
}

.admin-header .site-header__inner {
  min-height: 68px;
}

.header-right a {
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.82);
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
}

.header-right a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.page {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
  display: block;
}

.card {
  width: 100%;
  max-width: none;
  padding: clamp(20px, 4vw, 38px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.card h1 {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.025em;
}

.card p.hint {
  color: var(--muted);
}

label {
  color: #415160;
  font-weight: 650;
}

.input-text,
.meta-input {
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-text:focus,
.meta-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 63, 95, 0.11);
}

.field-row {
  gap: 16px;
  margin-bottom: 18px;
}

.upload-area {
  padding: 34px 20px;
  border: 2px dashed #c9d5df;
  border-radius: 16px;
  background: var(--surface-soft);
}

.upload-area.dragover {
  border-color: var(--brand);
  background: #eaf1f6;
}

.file-label,
.btn-secondary {
  padding: 9px 16px;
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.file-label:hover,
.btn-secondary:hover {
  color: #fff;
  background: var(--brand);
}

.btn-primary {
  padding: 10px 20px;
}

.api-section {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fbfcfd;
}

.api-section h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--brand-dark);
}

.api-status {
  margin-left: 0;
}

.api-endpoint,
.api-docs {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.msg-success,
.msg-error {
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 650;
}

.msg-success {
  color: #126342;
  background: #e8f7f0;
}

.msg-error {
  color: #9d2631;
  background: #fff0f1;
}

.list-title {
  margin-top: 36px;
  color: var(--brand-dark);
  font-size: 1.2rem;
}

.table-scroll {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

table {
  min-width: 980px;
  margin: 0;
}

th {
  padding: 12px 10px;
  color: #425466;
  background: var(--surface-soft);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

td {
  padding: 10px;
  border-bottom-color: var(--border);
}

a.btn-delete {
  background: var(--danger);
}

#password-overlay {
  padding: 20px;
  background: rgba(9, 25, 38, 0.7);
  backdrop-filter: blur(8px);
}

.password-card {
  max-width: 390px;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(9, 25, 38, 0.28);
}

.password-card h2 {
  color: var(--brand-dark);
  font-size: 1.45rem;
}

@media (max-width: 700px) {
  .site-header__inner {
    width: min(100% - 24px, 1180px);
    min-height: 64px;
  }

  .brand {
    font-size: 0.95rem;
  }

  .brand__mark {
    width: 32px;
    height: 32px;
  }

  .public-main {
    width: min(100% - 24px, 960px);
    padding-top: 42px;
  }

  .search-box {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-icon {
    align-self: center;
  }

  .search-input {
    width: calc(100% - 52px);
  }

  .search-button {
    width: 100%;
  }

  .result-card {
    padding: 18px;
  }

  .result-meta {
    display: grid;
  }

  .result-meta span {
    display: block;
  }

  .kontakt-frame iframe {
    height: 650px;
  }

  .page {
    width: min(100% - 20px, 1240px);
    padding: 20px 0 40px;
  }

  .card {
    border-radius: 16px;
  }

  .api-section {
    padding: 18px;
  }

  .api-key-row {
    align-items: stretch;
  }

  .api-key-row .input-text,
  .api-key-row .btn-secondary,
  .button-row .btn-primary,
  .button-row .btn-secondary {
    width: 100%;
  }

  .button-row,
  .button-row.gap {
    flex-direction: column;
  }

  .admin-header .header-right {
    display: none;
  }
}
