/*
 * Werkblick ID — Oberflaeche
 *
 * Abgeleitet aus WerkblickID-login-reference/werkblick-id-login-reference.html.
 * Zwei bewusste Abweichungen von der Referenz:
 *   1. 50/50-Split ab 1024px (Referenz hatte eine fixe Formularspalte).
 *   2. Auf Mobilgeraeten bleibt das Foto als Banner oben stehen
 *      (Referenz blendete es aus).
 *
 * Farben sind die verbindliche Werkblick-CI aus
 * 04_Bereiche/marketing/ci/08_farbsystem.md — nicht die leicht abweichenden
 * Werte der Referenzdatei.
 */

:root {
  /* Werkblick Orange */
  --wb-orange: #ff6600;
  --wb-orange-hover: #cc5100;
  --wb-orange-active: #7f3300;

  /* Charcoal */
  --wb-bg: #131415;
  --wb-panel: #17181a;
  --wb-control: #1e1f20;
  --wb-card: #2a2b2c;
  --wb-border: rgba(255, 255, 255, 0.1);
  --wb-border-strong: rgba(255, 255, 255, 0.17);

  --wb-text: #f7f7f8;
  --wb-muted: #b5b7ba;
  --wb-subtle: #8b8d90;
  --wb-placeholder: #74777b;

  /* Semantik */
  --wb-success: #34d399;
  --wb-warning: #fbbf24;
  --wb-danger: #f87171;
  --wb-info: #60a5fa;

  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--wb-bg);
  color: var(--wb-text);
}

button,
input {
  font: inherit;
}

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

a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Grundgeruest
   -------------------------------------------------------------------------- */

.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 50/50 laut Vorgabe */
  min-height: 100vh;
  background: var(--wb-bg);
}

.hero {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100vh;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: clamp(32px, 4.5vw, 72px);
  border-right: 1px solid var(--wb-border);
  isolation: isolate;
}

.hero::before {
  position: absolute;
  z-index: -2;
  inset: 0;
  background: var(--hero-image) center / cover no-repeat;
  content: '';
  transform: scale(1.01);
}

/* Ruhiger dunkler Verlauf, damit der Text auf jedem Foto lesbar bleibt. */
.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(12, 13, 14, 0.08) 0%,
      rgba(12, 13, 14, 0.28) 48%,
      rgba(12, 13, 14, 0.9) 100%
    ),
    linear-gradient(90deg, rgba(12, 13, 14, 0.05), rgba(12, 13, 14, 0.18));
  content: '';
}

.hero-content {
  max-width: 640px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--wb-orange);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(34px, 3.4vw, 52px);
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.hero-copy {
  max-width: 510px;
  margin: 20px 0 0;
  color: rgba(247, 247, 248, 0.88);
  font-size: 15px;
  line-height: 1.65;
}

.login-panel {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 56px 60px;
  background: var(--wb-panel);
}

.login-card {
  width: 100%;
  max-width: 460px;
}

/* --------------------------------------------------------------------------
   Marke und Kontext
   -------------------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand img {
  width: 44px;
  height: 44px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.brand-name span {
  color: var(--wb-orange);
}

.context-card {
  margin-top: 24px;
  padding: 14px 17px;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: var(--wb-control);
}

.context-card small {
  display: block;
  color: var(--wb-subtle);
  font-size: 12px;
}

.context-card strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  font-weight: 650;
}

.login-card h2 {
  margin: 34px 0 8px;
  font-size: 30px;
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.intro {
  margin: 0 0 28px;
  color: var(--wb-muted);
  font-size: 14px;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Meldungen
   -------------------------------------------------------------------------- */

.alert {
  margin: 20px 0 0;
  padding: 12px 15px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
}

.alert-error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #ffc9c9;
}

.alert-notice {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
  color: #b9f0dc;
}

/* --------------------------------------------------------------------------
   Formular
   -------------------------------------------------------------------------- */

.field {
  margin-top: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--wb-muted);
  font-size: 13px;
  font-weight: 600;
}

.control {
  position: relative;
}

.control > svg {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 18px;
  height: 18px;
  color: var(--wb-subtle);
  pointer-events: none;
  transform: translateY(-50%);
}

.control input {
  width: 100%;
  min-height: 48px;
  padding: 0 44px;
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  outline: none;
  background: var(--wb-control);
  color: var(--wb-text);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.control input::placeholder {
  color: var(--wb-placeholder);
}

.control input:hover {
  border-color: var(--wb-border-strong);
}

.control input:focus {
  border-color: var(--wb-orange);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.14);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--wb-subtle);
  cursor: pointer;
  transform: translateY(-50%);
}

.toggle-password:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--wb-text);
}

.toggle-password svg {
  position: static;
  width: 18px;
  height: 18px;
  transform: none;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0 24px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--wb-muted);
  font-size: 13px;
  cursor: pointer;
}

.remember input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  margin: 0;
  accent-color: var(--wb-orange);
}

.forgot {
  font-size: 13px;
  font-weight: 600;
}

.submit {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--wb-orange);
  border-radius: 10px;
  background: var(--wb-orange);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 80ms ease;
}

.submit:hover {
  border-color: var(--wb-orange-hover);
  background: var(--wb-orange-hover);
}

.submit:active {
  background: var(--wb-orange-active);
  transform: translateY(1px);
}

.secondary-action {
  margin: 22px 0 0;
  color: var(--wb-muted);
  font-size: 13.5px;
  text-align: center;
}

.trust {
  margin-top: 24px;
  padding-top: 19px;
  border-top: 1px solid var(--wb-border);
  color: var(--wb-subtle);
  font-size: 11px;
  letter-spacing: 0.025em;
  line-height: 1.5;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Fehlerseiten ohne Split-Layout
   -------------------------------------------------------------------------- */

.error-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.error-page main {
  max-width: 460px;
  text-align: center;
}

.error-page h1 {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.error-page p {
  color: var(--wb-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Mobil: Foto wird zum Banner, verschwindet aber nicht
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
    height: 34vh;
    min-height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--wb-border);
    padding: 24px;
  }

  .hero h1 {
    font-size: clamp(22px, 5vw, 30px);
  }

  .hero-copy {
    display: none;
  }

  .login-panel {
    min-height: 0;
    padding: 36px 24px 48px;
  }
}

@media (max-width: 480px) {
  .login-card h2 {
    font-size: 27px;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Administration
   ========================================================================== */

body.admin {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: var(--wb-bg);
}

.admin-bar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--wb-border);
  background: var(--wb-panel);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--wb-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.admin-brand:hover { text-decoration: none; }
.admin-brand span span { color: var(--wb-orange); }

.admin-nav {
  display: flex;
  gap: 22px;
  margin-right: auto;
}

.admin-nav a {
  color: var(--wb-muted);
  font-size: 14px;
  font-weight: 600;
}

.admin-nav a:hover { color: var(--wb-text); text-decoration: none; }

.admin-user {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--wb-subtle);
  font-size: 13px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--wb-orange);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
}

.link-button:hover { text-decoration: underline; }

.admin-main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px clamp(20px, 4vw, 48px) 72px;
}

/* Kopfzeile ------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--wb-subtle);
  font-size: 13.5px;
}

.back-link { margin: 0 0 18px; font-size: 13px; }

/* Filter ---------------------------------------------------------------- */

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--wb-border);
  border-radius: 9px;
  outline: none;
  background: var(--wb-control);
  color: var(--wb-text);
  font-size: 14px;
}

.filter-bar input { flex: 1 1 260px; }
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--wb-orange); }

/* Tabelle --------------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: var(--wb-panel);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--wb-border);
  color: var(--wb-subtle);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.data-table .row-action { text-align: right; white-space: nowrap; }
.data-table .row-problem { background: rgba(248, 113, 113, 0.06); }

.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.muted { color: var(--wb-subtle); }
.problem { color: #ffc9c9; }
.empty { color: var(--wb-subtle); padding: 40px; text-align: center; }

/* Status und Tags ------------------------------------------------------- */

.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-ACTIVE           { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.status-PENDING_APPROVAL { background: rgba(251, 191, 36, 0.16); color: #fcd34d; }
.status-PENDING_EMAIL    { background: rgba(96, 165, 250, 0.14); color: #93c5fd; }
.status-REJECTED         { background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
.status-DISABLED         { background: rgba(139, 141, 144, 0.18); color: var(--wb-muted); }

.tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 3px 8px;
  border: 1px solid var(--wb-border);
  border-radius: 6px;
  font-size: 11.5px;
}

.tag-admin   { border-color: rgba(255, 102, 0, 0.4); color: var(--wb-orange); }
.tag-service { border-color: rgba(96, 165, 250, 0.4); color: #93c5fd; }

/* Karten ---------------------------------------------------------------- */

.card {
  margin-top: 22px;
  padding: 24px 26px;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: var(--wb-panel);
}

.card-attention { border-color: rgba(251, 191, 36, 0.35); }

.card h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.card-sub,
.card > p {
  margin: 0 0 18px;
  color: var(--wb-muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.card code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--wb-control);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.detail-grid {
  display: grid;
  gap: 18px 32px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  padding: 20px 24px;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: var(--wb-panel);
  font-size: 14px;
}

.detail-label {
  display: block;
  margin-bottom: 4px;
  color: var(--wb-subtle);
  font-size: 12px;
}

/* Modulschalter --------------------------------------------------------- */

.module-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 20px;
}

.module-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  background: var(--wb-control);
  cursor: pointer;
  font-size: 14px;
  font-weight: 550;
  transition: border-color 140ms ease;
}

.module-toggle:hover { border-color: var(--wb-border-strong); }

.module-toggle:has(input:checked) {
  border-color: var(--wb-orange);
  background: rgba(255, 102, 0, 0.08);
}

.module-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--wb-orange);
}

/* Knoepfe --------------------------------------------------------------- */

.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.button-row .submit { width: auto; min-width: 150px; padding: 0 24px; }

.button-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--wb-border-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--wb-text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.button-secondary:hover {
  border-color: var(--wb-text);
  text-decoration: none;
}

.button-danger {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 9px;
  background: transparent;
  color: #fca5a5;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.button-danger:hover { border-color: #f87171; background: rgba(248, 113, 113, 0.1); }

.reject-form { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--wb-border); }

.hint {
  margin: 14px 0 0;
  color: var(--wb-subtle);
  font-size: 12.5px;
  line-height: 1.55;
}

/* Verlauf --------------------------------------------------------------- */

.history { margin: 0; padding: 0; list-style: none; }

.history li {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.history li:last-child { border-bottom: 0; }
.history-when { color: var(--wb-subtle); min-width: 150px; }
.history-what { font-weight: 600; }
.history-detail { color: var(--wb-orange); }
.history-who { color: var(--wb-subtle); margin-left: auto; }

/* Formularergaenzungen -------------------------------------------------- */

.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.control-plain input { padding: 0 15px; }

.field-hint {
  margin: 8px 0 0;
  color: var(--wb-subtle);
  font-size: 12.5px;
  line-height: 1.5;
}

textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  outline: none;
  background: var(--wb-control);
  color: var(--wb-text);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

textarea:focus { border-color: var(--wb-orange); }

@media (max-width: 640px) {
  .field-row { flex-direction: column; gap: 0; }
  .admin-nav { gap: 14px; }
  .admin-user span { display: none; }
}

/* Weg zurueck auf der Fehlerseite: ein Klick startet einen frischen
   Anmeldevorgang beim jeweiligen Modul. */
.module-links {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.module-links a {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  background: var(--wb-control);
  color: var(--wb-text);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 140ms ease, background 140ms ease;
}

.module-links a::after {
  content: ' →';
  color: var(--wb-orange);
}

.module-links a:hover {
  border-color: var(--wb-orange);
  background: rgba(255, 102, 0, 0.08);
  text-decoration: none;
}

/* Kontoauswahl bei bestehender Sitzung */

.konto-karte {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding: 16px 18px;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: var(--wb-control);
}

.konto-initialen {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 102, 0, 0.14);
  color: var(--wb-orange);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.konto-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.konto-text strong {
  font-size: 15px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.konto-text small {
  color: var(--wb-subtle);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Portal: Direktlinks auf die freigegebenen Module
   -------------------------------------------------------------------------- */

.modul-liste {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.modul-kachel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: var(--wb-control);
  color: var(--wb-text);
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.modul-kachel:hover {
  border-color: var(--wb-orange);
  background: rgba(255, 102, 0, 0.07);
  text-decoration: none;
}

.modul-bild {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 9px;
  background: var(--modul-bild) center / cover no-repeat;
  box-shadow: inset 0 0 0 1px var(--wb-border);
}

.modul-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.modul-text strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.modul-text small {
  color: var(--wb-subtle);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modul-pfeil {
  margin-left: auto;
  color: var(--wb-orange);
  font-size: 18px;
}

.portal-fuss {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--wb-border);
  color: var(--wb-subtle);
  font-size: 12.5px;
}

.portal-konto {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-aktionen {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
}

.portal-aktionen a,
.portal-aktionen .link-button {
  font-size: 12.5px;
  font-weight: 600;
}
