/* ── OBF Kundenportal – Design ──────────────────────────────────────
   Basiert auf der OBF IT Portal Designsprache.
   Navbar-Akzent: Dunkelgrau statt bg2, um "Kundenportal" optisch
   klar vom internen Portal zu unterscheiden.
   ────────────────────────────────────────────────────────────────── */

:root {
  --bg:          #0d0f14;
  --bg2:         #13161e;
  --bg3:         #1a1e2a;
  --border:      #252a38;
  --accent:      #29ABE2;
  --accent2:     #1e8ab5;
  --text:        #e8eaf0;
  --text-primary:#e8eaf0;
  --text-muted:  #7a8099;
  --muted:       #7a8099;   /* Alias für --text-muted */
  --card:        #13161e;   /* Alias für --bg2 */
  --success:     #2ecc71;
  --error:       #e74c3c;
  --warn:        #f39c12;
  --radius:      10px;
  --font-main:   'DM Sans', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  /* Kundenportal-spezifisch: etwas dunklere Navbar */
  --nav-bg:      #0c0e14;
  --nav-accent:  #1a7aa8;

  /* Theme transition */
  --theme-transition: background 0.2s, color 0.2s, border-color 0.2s;
}

/* ── Helles Theme ─────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f0f2f8;
  --bg2:         #ffffff;
  --bg3:         #e4e7f0;
  --border:      #c8cdde;
  --text:        #1a1e2a;
  --text-primary:#1a1e2a;
  --text-muted:  #5a6278;
  --muted:       #5a6278;
  --card:        #ffffff;
  --nav-bg:      #1a1e2a;
  --nav-accent:  #1a7aa8;
}

[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ───────────────────────────────────────────────────────── */
.navbar {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-accent);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 10000;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.nav-logo-img {
  height: 30px;
  width: auto;
  object-fit: contain;
}
.nav-portal-label {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.nav-portal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-portal-subtitle {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--nav-accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--bg3);
}
.nav-logout {
  color: var(--error) !important;
}
.nav-logout:hover {
  background: rgba(231,76,60,0.12) !important;
}
.nav-theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.nav-theme-btn:hover {
  background: var(--bg3);
  border-color: var(--accent);
}

.nav-dropdown-item {
  display: block;
  padding: 0.45rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-dropdown-item:hover, .nav-dropdown-item.active {
  color: var(--text);
  background: var(--bg3);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.8rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  margin: 0 0.3rem;
}
.nav-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.nav-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.nav-company {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Main Content ─────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ── Auth / Login ─────────────────────────────────────────────────── */
.auth-body {
  justify-content: center;
  align-items: center;
}
.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.auth-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
}
.auth-logo-text {}
.auth-logo-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.auth-logo-sub {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.auth-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.auth-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.6rem;
  line-height: 1.5;
}

/* ── Forms ────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 1rem; position: relative; }
.form-label  {
  display: block;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}
.label-optional { opacity: 0.6; }
.form-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(41,171,226,0.12);
}
.form-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.form-select { cursor: pointer; }
.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-family: var(--font-mono);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  border: none;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent2); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { color: var(--text); border-color: var(--accent); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #27ae60; }
.btn-full { width: 100%; }
.btn-large { padding: 0.9rem 1.4rem; font-size: 1rem; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.alert-error {
  background: rgba(231,76,60,0.1);
  border: 1px solid rgba(231,76,60,0.3);
  color: #ff8a80;
}
.alert-success {
  background: rgba(46,204,113,0.1);
  border: 1px solid rgba(46,204,113,0.3);
  color: #7dffb0;
}
.alert-info {
  background: rgba(41,171,226,0.08);
  border: 1px solid rgba(41,171,226,0.25);
  color: var(--accent);
}
.alert-warn {
  background: rgba(243,156,18,0.1);
  border: 1px solid rgba(243,156,18,0.3);
  color: #ffc857;
}

/* ── Page Header ──────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header-left {}
.page-title {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.3rem;
}
.page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.card-icon  { font-size: 1.1rem; }
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  flex: 1;
  font-family: var(--font-main);
}
.card-actions { display: flex; gap: 0.4rem; margin-left: auto; }
.card-body  { padding: 1.2rem; }

/* ── Dashboard Kacheln ────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}
.module-tile {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.module-tile:hover:not(.tile-disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(41,171,226,0.12);
}
.module-tile.tile-disabled {
  opacity: 0.5;
  cursor: default;
}
.tile-icon {
  font-size: 2rem;
  line-height: 1;
}
.tile-label {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}
.tile-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.tile-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.tile-status {
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

/* ── Status Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-entwurf   { background: rgba(243,156,18,0.15); color: #ffc857; }
.badge-bestaetigt { background: rgba(46,204,113,0.15); color: #7dffb0; }
.badge-archiviert { background: rgba(122,128,153,0.15); color: var(--text-muted); }
.badge-pending   { background: rgba(41,171,226,0.15); color: var(--accent); }

/* ── Wizard / Steps ───────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}
.step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.2s;
}
.wizard-step.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.wizard-step.active .step-label { color: var(--text); }
.wizard-step.done .step-num {
  background: rgba(46,204,113,0.2);
  border-color: var(--success);
  color: var(--success);
}
.wizard-step.done .step-label { color: var(--text-muted); }
.wizard-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
  max-width: 60px;
  flex-shrink: 1;
}
.wizard-connector.done { background: var(--success); }

/* ── Checkboxen (custom) ──────────────────────────────────────────── */
.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 0.85rem;
}
.checkbox-item:hover { background: var(--bg3); }
.checkbox-item input[type="checkbox"] { display: none; }
.checkbox-box {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.15s;
  position: relative;
  background: var(--bg);
}
.checkbox-item input:checked + .checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-item input:checked + .checkbox-box::after {
  content: '✓';
  position: absolute;
  top: -1px; left: 1px;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
}

/* ── Collapsible Hilfetext ────────────────────────────────────────── */
.help-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.2rem 0;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.help-toggle:hover { text-decoration: underline; }
.help-text {
  display: none;
  padding: 0.6rem 0.8rem;
  background: rgba(41,171,226,0.06);
  border-left: 3px solid rgba(41,171,226,0.3);
  border-radius: 0 6px 6px 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 0.3rem;
}
.help-text.open { display: block; }

/* ── Unterauftragnehmer dynamische Tabelle ────────────────────────── */
.ua-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.ua-table th {
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.ua-table td {
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid rgba(37,42,56,0.5);
}
.ua-table .form-input { padding: 0.4rem 0.6rem; font-size: 0.82rem; }

/* ── Tabellen (Admin) ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.td-mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Filter / Suche ───────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.filter-bar .form-input { max-width: 260px; }
.filter-bar .form-select { max-width: 180px; }

/* ── Spinner ──────────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 0.8rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.footer-right { opacity: 0.6; }

/* ── Vorschau-Block ───────────────────────────────────────────────── */
.preview-section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.preview-section h4 {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.preview-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(37,42,56,0.4);
  font-size: 0.85rem;
  line-height: 1.5;
}
.preview-row:last-child { border-bottom: none; }
.preview-key {
  min-width: 200px;
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}
.preview-val { color: var(--text); word-break: break-word; }

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Hidden ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .navbar { padding: 0 1rem; }
  .page-header { flex-direction: column; }
  .filter-bar .form-input,
  .filter-bar .form-select { max-width: 100%; }
  .wizard-steps { gap: 0; }
  .wizard-connector { min-width: 12px; }
  .preview-key { min-width: 120px; }
}
