@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* =========================================
   1) DESIGN TOKENS / VARIABLEN
   ========================================= */
:root {
  --primary: #8f1d21;
  --primary-hover: #74171a;

  --text: #111827;
  --text-soft: #374151;
  --text-muted: #6b7280;

  --border: #e5e7eb;
  --border-strong: rgba(17, 24, 39, 0.12);

  --success: #15803d;
  --success-bg: #ecfdf3;
  --success-border: #bbf7d0;

  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --warning: #b45309;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;

  --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.16);

  --transition: 180ms ease;

  /* Layout */
  --page-max-width: 1280px;
  --page-inline: 20px;
  --sidebar-width: 340px;
  --layout-gap: 32px;

  /* Flächen */
  --topbar-bg: rgba(255, 255, 255, 0.84);
  --topbar-border: rgba(255, 255, 255, 0.72);

  --bg-overlay: rgba(255, 255, 255, 0.42);
  --panel-bg: rgba(255, 255, 255, 0.84);
  --panel-bg-strong: rgba(255, 255, 255, 0.90);
  --hero-bg: rgba(255, 255, 255, 0.88);
  --card-bg: rgba(255, 255, 255, 0.90);
}

/* =========================================
   2) RESET / BASIS
   ========================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', Arial, sans-serif;
  color: var(--text);
  line-height: 1.5;
  background:
    linear-gradient(var(--bg-overlay), var(--bg-overlay)),
    url('/Logo/background.jpg') center/cover no-repeat fixed;
}

/* =========================================
   3) TOPBAR / LOGO-BOX
   EXAKT GLEICHE SICHTBARE BREITE WIE UNTEN
   ========================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 10px var(--page-inline) 0;
}

.topbar-inner {
  width: 100%;
  max-width: calc(var(--page-max-width) - (var(--page-inline) * 2));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-radius: 22px;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--topbar-border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
}

.topbar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.topbar-logo {
  width: 280px;
  max-width: 100%;
  height: auto;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  appearance: none;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform var(--transition),
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle-text {
  white-space: nowrap;
}

/* =========================================
   4) HAUPT-LAYOUT
   WICHTIG: KEIN horizontales Padding mehr hier
   ========================================= */
.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  gap: var(--layout-gap);
  width: 100%;
  max-width: calc(var(--page-max-width) - (var(--page-inline) * 2));
  margin: 14px auto 36px;
  padding: 0 0 36px;
  align-items: start;
}

.main-content {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 24px;
}

/* =========================================
   5) GLAS-CARDS / BOXEN
   ========================================= */
.content-box {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-lg);
}

.side-box {
  background: var(--panel-bg-strong);
  padding: 18px 18px 16px;
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}

/* =========================================
   6) LOGO IM CONTENT-BEREICH
   ========================================= */
.image-wrapper {
  text-align: center;
  margin-bottom: 18px;
}

.header-logo {
  width: 360px;
  max-width: 80%;
  height: auto;
  display: inline-block;
}

/* =========================================
   7) TYPOGRAFIE / ÜBERSCHRIFTEN / TEXT
   ========================================= */
.separate-info-text {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 14px;
}

.info-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.sidebar .info-text {
  text-align: left;
}

.side-info {
  margin-top: 10px;
}

/* =========================================
   8) FORMULARE
   ========================================= */
#qr-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#qr-form input[type="text"] {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

#qr-form input[type="text"]::placeholder {
  color: #9ca3af;
}

#qr-form input[type="text"]:focus {
  border-color: rgba(143, 29, 33, 0.45);
  box-shadow: 0 0 0 4px rgba(143, 29, 33, 0.12);
  background: #fff;
}

/* =========================================
   9) BUTTONS
   Premium, aber clean
   ========================================= */
.button-red,
.button-link {
  appearance: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.22);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;

  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;

  background:
    linear-gradient(180deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.03) 42%, rgba(0,0,0,0.08) 100%),
    linear-gradient(180deg, #b6262d 0%, #8f1d21 100%);

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 8px 20px rgba(143, 29, 33, 0.22);

  transition:
    transform var(--transition),
    box-shadow var(--transition),
    filter var(--transition),
    background var(--transition),
    border-color var(--transition),
    opacity var(--transition);
}

.button-red::before,
.button-link::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 10%;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.30) 0%,
    rgba(255,255,255,0.12) 55%,
    rgba(255,255,255,0) 100%
  );
  pointer-events: none;
}

.button-red::after,
.button-link::after {
  content: none;
}

.button-red:hover,
.button-link:hover {
  transform: translateY(-1px);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.05) 42%, rgba(0,0,0,0.10) 100%),
    linear-gradient(180deg, #c22a31 0%, var(--primary-hover) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.24),
    0 12px 24px rgba(143, 29, 33, 0.26);
}

.button-red:active,
.button-link:active {
  transform: translateY(0);
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,0.14),
    0 6px 14px rgba(143, 29, 33, 0.18);
}

.portal-button-wrap {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

/* =========================================
   10) TRENNLINIEN / FOOTER-LINKS
   ========================================= */
.red-separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.impressum-link {
  text-align: left;
}

.impressum-link a {
  display: block;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color var(--transition);
}

.impressum-link a:hover {
  color: var(--primary);
}

.impressum-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 14px;
  line-height: 1.5;
}

/* =========================================
   11) FEHLERMELDUNGEN
   ========================================= */
.error-message {
  padding: 18px 20px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  color: var(--danger);
  text-align: center;
  font-size: 0.96rem;
  font-weight: 500;
}

/* =========================================
   12) PROTOKOLL-CONTAINER
   ========================================= */
#table-container.hidden {
  display: none;
  opacity: 0;
}

#table-container.show {
  display: block;
  opacity: 1;
  transition: opacity 0.4s ease;
  animation: fadeInSoft 0.45s ease both;
}

.protocol-layout {
  display: grid;
  gap: 18px;
}

/* =========================================
   13) HERO-BEREICH
   ========================================= */
.protocol-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 20px 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--hero-bg);
  box-shadow: var(--shadow-sm);
}

.protocol-hero-copy {
  min-width: 0;
}

.protocol-hero-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
}

.protocol-hero-title {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}

.protocol-hero-meta {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.protocol-hero-status {
  min-width: 180px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid var(--border);
}

.protocol-hero-status-label {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* =========================================
   14) DETAIL-KARTE
   ========================================= */
.protocol-card {
  padding: 20px 20px 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.protocol-card-header {
  margin-bottom: 12px;
}

.protocol-card-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.protocol-card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.detail-list {
  display: grid;
  gap: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 11px 0;
  border-top: 1px solid rgba(17, 24, 39, 0.06);
  transition: background var(--transition);
}

.detail-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.detail-row:last-child {
  padding-bottom: 0;
}

.detail-row:hover {
  background: transparent;
  border-radius: 0;
}

.detail-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.detail-value-wrap {
  min-width: 0;
}

.detail-value {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
}

/* =========================================
   15) STATUS-BADGES
   ========================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.status-badge.success {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
}

.status-badge.error {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
}

.status-badge.warning {
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
}

/* =========================================
   16) HUD-LOADER
   ========================================= */
#hud-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  transition: opacity 0.3s ease;
  animation: fadeInSoft 0.25s ease both;
}

.hud-container {
  position: relative;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  animation: floatSoft 2.4s ease-in-out infinite;
}

.center-info {
  position: absolute;
  text-align: center;
}

.percentage {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.hud-details {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* =========================================
   17) ANIMATIONEN
   ========================================= */
.content-box,
.protocol-card,
.protocol-hero,
.side-box {
  animation: fadeUp 0.55s ease both;
}

.protocol-card {
  animation-delay: 0.08s;
}

.side-box:nth-child(1) {
  animation-delay: 0.12s;
}

.side-box:nth-child(2) {
  animation-delay: 0.18s;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInSoft {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes floatSoft {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .content-box,
  .protocol-card,
  .protocol-hero,
  .side-box,
  #table-container.show,
  #hud-loader,
  .hud-container {
    animation: none !important;
  }
}

/* =========================================
   18) TABLET / KLEINERE DESKTOPS
   ========================================= */
@media (max-width: 1100px) {
  body {
    background-attachment: scroll;
    background-position: center top;
  }

  .page-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: calc(100% - (var(--page-inline) * 2));
    margin: 10px auto 28px;
    padding: 0 0 28px;
  }

  .sidebar {
    position: static;
    gap: 16px;
  }

  .topbar-inner {
    max-width: calc(100% - (var(--page-inline) * 2));
  }
}

/* =========================================
   19) MOBILE
   ========================================= */
@media (max-width: 720px) {
  :root {
    --page-inline: 12px;
  }

  .topbar {
    padding: 8px var(--page-inline) 0;
  }

  .topbar-inner {
    min-height: 64px;
    padding: 10px 14px;
    border-radius: 18px;
  }

  .topbar-logo {
    width: 170px;
  }

  .theme-toggle {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .page-layout {
    gap: 16px;
    margin: 10px auto 24px;
    padding: 0 0 24px;
  }

  .content-box {
    padding: 18px;
    border-radius: 20px;
  }

  .side-box {
    padding: 18px;
    border-radius: 20px;
  }

  .image-wrapper {
    margin-bottom: 14px;
  }

  .header-logo {
    width: 155px;
  }

  .separate-info-text {
    font-size: 1.02rem;
    margin-bottom: 16px;
  }

  .info-text {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  #qr-form input[type="text"] {
    min-height: 48px;
    padding: 0 14px;
    font-size: 16px;
    border-radius: 12px;
  }

  .button-red,
  .button-link {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    font-size: 0.95rem;
    border-radius: 12px;
  }

  .portal-button-wrap {
    margin-top: 14px;
  }

  .protocol-layout {
    gap: 16px;
  }

  .protocol-hero {
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border-radius: 20px;
  }

  .protocol-hero-title {
    font-size: 1.45rem;
    line-height: 1.12;
  }

  .protocol-hero-meta {
    font-size: 0.92rem;
    line-height: 1.5;
  }

  .protocol-hero-status {
    width: 100%;
    min-width: 0;
    padding: 14px;
    border-radius: 14px;
  }

  .protocol-card {
    padding: 18px 18px 12px;
    border-radius: 20px;
  }

  .protocol-card-title {
    font-size: 1.05rem;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0;
  }

  .detail-label {
    font-size: 0.84rem;
    margin-bottom: 2px;
  }

  .detail-value,
  .detail-value-wrap {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .status-badge {
    font-size: 0.78rem;
    padding: 6px 10px;
  }

  #hud-loader {
    padding: 4px 0 8px;
  }

  .hud-container {
    width: 118px;
    height: 118px;
    margin-bottom: 8px;
  }

  .percentage {
    font-size: 20px;
  }

  .status {
    font-size: 11px;
  }

  .hud-details {
    font-size: 0.74rem;
    letter-spacing: 0.03em;
  }

  .impressum-link a {
    font-size: 0.9rem;
    margin-top: 10px;
  }

  .impressum-text {
    font-size: 0.78rem;
  }
}

/* =========================================
   20) SEHR KLEINE DISPLAYS
   ========================================= */
@media (max-width: 480px) {
  :root {
    --page-inline: 10px;
  }

  .topbar {
    padding: 8px var(--page-inline) 0;
  }

  .topbar-inner {
    min-height: 62px;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .topbar-logo {
    width: 150px;
  }

  .theme-toggle {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .page-layout {
    padding: 0 0 20px;
  }

  .content-box,
  .side-box,
  .protocol-card,
  .protocol-hero {
    padding: 16px;
    border-radius: 18px;
  }

  .separate-info-text {
    font-size: 0.98rem;
  }

  .protocol-hero-title {
    font-size: 1.28rem;
  }

  .protocol-hero-eyebrow,
  .protocol-card-eyebrow {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .detail-row {
    padding: 10px 0;
  }

  .button-red,
  .button-link,
  #qr-form input[type="text"] {
    min-height: 46px;
  }

  .hud-container {
    width: 108px;
    height: 108px;
  }

  .percentage {
    font-size: 18px;
  }
}