/* C&C-Branding für die Psono-Anmeldung, angelehnt an die Anmeldung des
   Vereinsportals (frontend/src/app/page.tsx), zur Abgrenzung in Schwarz statt Blau. Greift nur, solange die
   Anmeldemaske zu sehen ist (#app > div > form), der Tresor bleibt unberührt.
   Achtung: hängt an der DOM-Struktur des Psono-Clients, nach Client-Updates prüfen. */

:root {
  --cc-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Hintergrund: Verlauf wie im Portal, aber schwarz */
body:has(#app > div > form) {
  min-height: 100dvh;
  background: linear-gradient(150deg, #050505 0%, #111214 60%, #1f2126 100%) fixed !important;
  overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  body:has(#app > div > form) {
    background: linear-gradient(150deg, #000 0%, #0a0a0b 60%, #16171a 100%) fixed !important;
  }
}

/* Emblem groß und angeschnitten im Hintergrund */
body:has(#app > div > form)::before {
  content: "";
  position: fixed;
  /* Maße wie im Portal (820px bzw. 1200px auf viewBox-Breite 650), umgerechnet auf die volle viewBox */
  width: 891px;
  aspect-ratio: 706.628 / 529.83;
  left: -200px;
  top: 50%;
  transform: translateY(-50%);
  background: url("../img/cc-emblem.svg?v=4") no-repeat center / contain;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}
@media (prefers-color-scheme: dark) {
  body:has(#app > div > form)::before { opacity: 0.2; }
}
@media (min-width: 1024px) {
  body:has(#app > div > form)::before { width: 1304px; left: -154px; }
}

/* Karte mittig, ab Desktopbreite rechts wie im Portal */
#app:has(> div > form) {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  box-sizing: border-box;
}
@media (min-width: 1024px) {
  #app:has(> div > form) { justify-content: flex-end; padding-right: 14%; }
}
#app:has(> div > form) > #PsonoDownloadBanner { position: absolute; top: 0; left: 0; right: 0; }

/* Anmeldekarte in Glasoptik */
#app > div:has(> form) {
  position: relative !important;
  inset: auto !important;
  margin: 0 !important;
  transform: none !important;
  width: 100% !important;
  max-width: 384px !important;
  box-sizing: border-box;
  padding: 28px 32px 20px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1) !important;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff !important;
  font-family: var(--cc-font);
  animation: cc-in 0.5s ease-out both;
}
@media (prefers-color-scheme: dark) {
  #app > div:has(> form) { border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.06) !important; }
}
@media (prefers-reduced-motion: reduce) {
  #app > div:has(> form) { animation: none; }
}
@keyframes cc-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: none; }
}

/* Kopf: Vereinsname, Überschrift, Logo rechts */
#app > div:has(> form)::before {
  content: "Contact & Cooperation e.\2009V.";
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.75);
}
#app > div:has(> form) > form::before {
  content: "Passwortmanager";
  display: block;
  margin: 4px 0 20px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: #fff;
}
#app > div:has(> form) > img {
  position: absolute;
  top: 32px;
  right: 32px;
  height: 40px !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  opacity: 0.9;
}
#app > div:has(> form) > a.infolabel { display: none; }
#app > div:has(> form) > form > div:first-child {
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
}

/* Hinweistext über dem Knopf (Titel des SAML-Anbieters aus config.json) */
#app > div:has(> form) form .MuiGrid-item {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  padding: 0 !important;
}
#app > div:has(> form) form .MuiGrid-container { margin: 0 0 12px !important; width: 100% !important; }

/* Microsoft-Knopf, helle Variante nach Microsoft-Vorgabe (Portal: dunkel) */
#sad {
  position: relative;
  width: 100%;
  height: 41px;
  padding: 0 16px 0 41px !important;
  border-radius: 0 !important;
  background: #fff !important;
  border: 1px solid #8c8c8c !important;
  box-shadow: none !important;
  color: #5e5e5e !important;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
}
#sad:hover { background: #f3f3f3 !important; }
#sad:active { background: #e6e6e6 !important; }
#sad:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#sad::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 21px;
  height: 21px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 21'%3E%3Crect x='1' y='1' width='9' height='9' fill='%23f25022'/%3E%3Crect x='11' y='1' width='9' height='9' fill='%237fba00'/%3E%3Crect x='1' y='11' width='9' height='9' fill='%2300a4ef'/%3E%3Crect x='11' y='11' width='9' height='9' fill='%23ffb900'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* „Trust device“ und leere Zeilen ausblenden, Fußzeile wie im Portal */
#app > div:has(> form) > form > .MuiGrid-container:has(.MuiCheckbox-root),
#app > div:has(> form) > form > .MuiGrid-container:has(> .MuiGrid-item:empty:only-child) { display: none !important; }
#app > div:has(> form) > form > .box-footer {
  position: static !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0;
}
#app > div:has(> form) > form > .box-footer > a { display: none; }
#app > div:has(> form) > form > .box-footer::before {
  content: "Psono";
  font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.025em;
  color: rgba(255, 255, 255, 0.5);
}
#app > div:has(> form) > form > .box-footer::after {
  content: "Zugang nur für Amtsträger";
  font: 11px/1.4 var(--cc-font);
  color: rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------------------------------------
   Tresor nach dem Login: schwarz mit sparsamem C&C-Blau (#21558E).
   Grundfarben kommen aus theme.palette in config.json, hier nur Akzente. */

/* Kopfleiste: C&C-Logo mit Schriftzug statt Psono */
header a:has(> img[src$="logo-inverse.png"]) {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  height: 30px !important;
  text-decoration: none;
  white-space: nowrap;
}
header img[src$="logo-inverse.png"] {
  height: 28px !important;
  width: auto !important;
  flex-shrink: 0;
}
header a:has(> img[src$="logo-inverse.png"])::after {
  content: "Passwortmanager";
  font: 600 15px/1 var(--cc-font);
  letter-spacing: -0.01em;
  color: #fff;
}
@media (max-width: 599px) {
  header a:has(> img[src$="logo-inverse.png"])::after { display: none; }
}

/* Seitenleiste: aktiver Punkt mit blauer Markierung */
.MuiDrawer-paper .MuiListItem-root.Mui-selected,
.MuiDrawer-paper .MuiListItem-root[aria-current="page"] {
  box-shadow: inset 3px 0 0 #4a86c8;
}

/* Akzente in C&C-Blau */
.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline { border-color: #21558E !important; }
.MuiFormLabel-root.Mui-focused { color: #21558E !important; }
.MuiCheckbox-root.Mui-checked, .MuiSwitch-switchBase.Mui-checked { color: #21558E !important; }
.MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track { background-color: #21558E !important; }
.MuiTabs-indicator { background-color: #21558E !important; }
