/* MedDeveloper Design-System v1.0.0 - components.css
   Stand: 24.11.2026 | Baut direkt auf tokens.css auf (0 externe Abhaengigkeiten). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--md-font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--md-text-primary);
  background: var(--md-bg-page);
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--md-accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--md-focus); outline-offset: 2px; border-radius: 6px; }

.md-tnums { font-variant-numeric: tabular-nums; }
.md-mono { font-family: var(--md-font-mono); font-size: 0.9em; }

/* Sprunglink Barrierefreiheit */
.md-skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--md-text-primary); color: #fff;
  padding: 12px 16px; border-radius: var(--md-r-sm); z-index: 200;
}
.md-skip:focus { left: 12px; top: 12px; }

/* ============================================================================
   1. APP-SHELL (ZONE 3 KUNDENWELT & ZONE 4 BETREIBER-LEITSTAND)
   ============================================================================ */
.md-admin-strip {
  display: none;
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #F59E0B 0%, #D97706 50%, #F59E0B 100%);
}
[data-zone="admin"] .md-admin-strip { display: block; }

.md-topbar {
  min-height: var(--md-topbar-h);
  background: var(--md-bg-surface);
  border-bottom: 1px solid var(--md-border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 30;
}
[data-zone="admin"] .md-topbar {
  background: var(--md-admin-top);
  border-bottom-color: var(--md-admin-border);
  color: var(--md-admin-text);
}

.md-shell {
  display: grid;
  grid-template-columns: var(--md-sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--md-topbar-h));
}
.md-sidebar {
  background: var(--md-bg-surface);
  border-right: 1px solid var(--md-border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
[data-zone="admin"] .md-sidebar {
  background: var(--md-admin-side);
  border-right-color: var(--md-admin-border);
  color: var(--md-admin-text);
}

.md-nav-group {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--md-text-muted);
  padding: 8px 12px 4px;
}
[data-zone="admin"] .md-nav-group { color: var(--md-admin-muted); }

.md-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--md-r-sm);
  color: var(--md-text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background-color var(--md-dur-fast) ease, color var(--md-dur-fast) ease;
}
.md-nav-item:hover {
  background: var(--md-bg-subtle);
  color: var(--md-text-primary);
  text-decoration: none;
}
/* Stelle 2 der 95/5-Regel: schmaler 3px-Produktindikator links */
.md-nav-item.is-active {
  background: var(--md-accent-soft);
  color: var(--md-accent-text);
  font-weight: 700;
  border-left: 3px solid var(--md-accent);
  padding-left: 9px;
}
[data-zone="admin"] .md-nav-item { color: #CBD5E1; }
[data-zone="admin"] .md-nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #FFFFFF; }
[data-zone="admin"] .md-nav-item.is-active {
  background: var(--md-admin-accent-soft);
  color: var(--md-admin-accent-text);
  border-left: 3px solid var(--md-admin-bar);
}

.md-main {
  padding: 24px 28px 48px;
  max-width: var(--md-content-max);
  width: 100%;
  margin: 0 auto;
}

/* Mandanten-Badge (neutraler Platzhalter ohne Farbkollision) */
.md-tenant-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--md-r-pill);
  border: 1px solid var(--md-border-card);
  background: var(--md-bg-subtle);
  color: var(--md-text-primary);
  font-size: 13px;
  font-weight: 700;
}
.md-tenant-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto;
}
.md-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--md-admin-bar);
  color: #0F172A;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================================
   2. KARTEN (KLAR GERAHMT UND ABGERUNDET IN TAG & NACHT)
   ============================================================================ */
.md-card {
  background: var(--md-bg-surface);
  border: 1px solid var(--md-border-card);
  border-radius: var(--md-r-lg);
  box-shadow: var(--md-shadow-card);
  padding: 20px;
}
.md-card-interactive {
  transition: transform var(--md-dur-mid) var(--md-ease),
              box-shadow var(--md-dur-mid) var(--md-ease),
              border-color var(--md-dur-fast) ease;
}
.md-card-interactive:hover {
  transform: translateY(-3px);
  box-shadow: var(--md-shadow-hover);
  border-color: var(--md-accent);
}

/* ============================================================================
   3. BUTTONS (MINDESTENS 44x44px, GENAU 1 PRIMAERAKTION JE ANSICHT)
   ============================================================================ */
.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--md-r-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform var(--md-dur-fast) var(--md-ease),
              box-shadow var(--md-dur-mid) var(--md-ease),
              background-color var(--md-dur-fast) ease,
              border-color var(--md-dur-fast) ease;
}
.md-btn:hover:not(:disabled) { transform: translateY(-1px); text-decoration: none; }
.md-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.md-btn:disabled { opacity: 0.48; cursor: not-allowed; border-style: dashed; }

.md-btn-primary {
  background: var(--md-accent);
  color: var(--md-accent-on-solid);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}
.md-btn-primary:hover:not(:disabled) { background: var(--md-accent-hover); }

.md-btn-secondary {
  background: var(--md-bg-surface);
  color: var(--md-text-primary);
  border-color: var(--md-border-card);
  box-shadow: var(--md-shadow-card);
}
.md-btn-secondary:hover:not(:disabled) { background: var(--md-bg-subtle); }

.md-btn-ghost {
  background: transparent;
  color: var(--md-text-secondary);
}
.md-btn-ghost:hover:not(:disabled) { background: var(--md-bg-subtle); color: var(--md-text-primary); }

.md-btn-danger {
  background: var(--md-error);
  color: #FFFFFF;
}
.md-btn-danger:hover:not(:disabled) { background: #B91C1C; }

/* ============================================================================
   4. REGISTERKARTEN (APPLE-SEGMENT-STIL & UNTERSTRICH-STIL)
   ============================================================================ */
.md-seg {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--md-bg-seg-track);
  border: 1px solid var(--md-border-card);
}
.md-seg-pill {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  border-radius: 8px;
  background: var(--md-bg-surface);
  border: 1px solid var(--md-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: transform var(--md-dur-mid) var(--md-ease), width var(--md-dur-mid) var(--md-ease);
  pointer-events: none;
}
.md-seg-btn {
  position: relative;
  z-index: 1;
  min-height: 38px;
  padding: 6px 14px;
  border: 0;
  background: transparent;
  color: var(--md-text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ============================================================================
   5. FORMULARE, BADGES, SIGNALMELDUNGEN & FORTSCHRITT
   ============================================================================ */
.md-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--md-text-secondary);
  margin-bottom: 6px;
}
.md-input, .md-select, .md-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--md-r-sm);
  border: 1px solid var(--md-border-input);
  background: var(--md-bg-surface);
  color: var(--md-text-primary);
  font-family: inherit;
  font-size: 14px;
}
.md-input.is-error { border: 2px solid var(--md-error); }
.md-field-err { font-size: 12px; font-weight: 700; color: var(--md-error); margin-top: 6px; }

.md-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--md-r-pill);
  font-size: 12px;
  font-weight: 700;
  background: var(--md-bg-subtle);
  color: var(--md-text-secondary);
  border: 1px solid var(--md-border);
}
.md-badge-accent { background: var(--md-accent-soft); color: var(--md-accent-text); border-color: transparent; }
.md-badge-ok { background: var(--md-ok-bg); color: var(--md-ok); border-color: transparent; }
.md-badge-warn { background: var(--md-warn-bg); color: var(--md-warn); border-color: transparent; }
.md-badge-error { background: var(--md-error-bg); color: var(--md-error); border-color: transparent; }

.md-progress-track {
  width: 100%; height: 10px; border-radius: var(--md-r-pill);
  background: var(--md-bg-subtle); overflow: hidden;
}
.md-progress-fill {
  height: 100%; border-radius: var(--md-r-pill);
  background: var(--md-accent);
  transition: width 420ms var(--md-ease);
}

/* ============================================================================
   6. FUEHRUNGSLINIEN: SKELETON, LEERZUSTAND, VIDEO-BAUSTEIN & NEO-HUB
   ============================================================================ */
@keyframes mdShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.md-skeleton {
  background: linear-gradient(90deg, rgba(148,163,184,0.14) 25%, rgba(148,163,184,0.28) 50%, rgba(148,163,184,0.14) 75%);
  background-size: 200% 100%;
  animation: mdShimmer 1.5s infinite linear;
  border-radius: 6px;
}

.md-empty {
  border: 1px dashed var(--md-border-card);
  border-radius: var(--md-r-lg);
  background: var(--md-bg-subtle);
  padding: 28px 20px;
  text-align: center;
}

/* Selbst gehosteter Video-Baustein (0 Tracking, kein YouTube/Vimeo) */
.md-video-card {
  background: var(--md-bg-surface);
  border: 1px solid var(--md-border-card);
  border-radius: var(--md-r-xl);
  box-shadow: var(--md-shadow-card);
  overflow: hidden;
}
.md-video-frame {
  position: relative;
  background: #0B1117;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.md-video-frame video {
  width: 100%; height: 100%; object-fit: cover;
}

/* Subtiles Neo-Hub Hexagon-Netz (nur Zone 1 Landingpage & Zone 3 Empfang) */
.md-hex-bg {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%2364748B' stroke-opacity='0.14' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 56px 100px;
}

/* ============================================================================
   7. DRAWER, BESTAETIGUNGSDIALOG (DATENVERLUST) & TOAST
   ============================================================================ */
.md-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--md-dur-mid) ease;
}
.md-backdrop.is-open { opacity: 1; pointer-events: auto; }

.md-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: min(420px, 100vw);
  background: var(--md-bg-surface);
  border-left: 1px solid var(--md-border-card);
  box-shadow: var(--md-shadow-modal);
  padding: 24px;
  transform: translateX(100%);
  transition: transform var(--md-dur-slow) var(--md-ease);
  overflow-y: auto;
}
.md-backdrop.is-open .md-drawer { transform: translateX(0); }

.md-modal-wrap {
  display: grid; place-items: center; padding: 20px;
}
.md-modal {
  width: min(460px, 100%);
  background: var(--md-bg-surface);
  border: 1px solid var(--md-border-card);
  border-top: 5px solid var(--md-error);
  border-radius: var(--md-r-xl);
  box-shadow: var(--md-shadow-modal);
  padding: 24px;
  transform: scale(0.95) translateY(8px);
  transition: transform var(--md-dur-mid) var(--md-ease);
}
.md-backdrop.is-open .md-modal { transform: scale(1) translateY(0); }

.md-toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  background: var(--md-bg-surface);
  color: var(--md-text-primary);
  border: 1px solid var(--md-border-card);
  border-radius: var(--md-r-md);
  box-shadow: var(--md-shadow-hover);
  padding: 12px 16px;
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700;
  transform: translateY(16px); opacity: 0; pointer-events: none;
  transition: transform var(--md-dur-mid) var(--md-ease), opacity var(--md-dur-mid) ease;
}
.md-toast.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }

/* ============================================================================
   8. RESPONSIVE & DRUCK (DIN 66398 / ABSCHLUSS-PDFS)
   ============================================================================ */
@media (max-width: 860px) {
  .md-shell { grid-template-columns: 1fr; }
  .md-sidebar { border-right: 0; border-bottom: 1px solid var(--md-border); }
  .md-main { padding: 16px 14px 40px; }
}

@media print {
  .md-topbar, .md-sidebar, .md-admin-strip, .no-print { display: none !important; }
  body { background: #FFFFFF; color: #000000; font-size: 11pt; }
  .md-card { box-shadow: none; border: 1px solid #999999; break-inside: avoid; }
}
