/* =============================================================================
   BBG Mitarbeiterportal – Haupt-CSS
   Barnimer Busgesellschaft mbH – 2026
   Mobile-First, BBG-Grün #009640 als Primärfarbe
   ============================================================================= */

/* ── CSS-Variablen ──────────────────────────────────────────────────────────── */
:root {
  --clr-primary:      #009640;
  --clr-primary-dark: #007a33;
  --clr-primary-light:#e6f5ec;
  --clr-danger:       #e74c3c;
  --clr-warning:      #f39c12;
  --clr-info:         #2980b9;
  --clr-success:      #27ae60;

  --clr-bg:           #f4f6f9;
  --clr-surface:      #ffffff;
  --clr-border:       #dde1e7;
  --clr-text:         #1a1a2e;
  --clr-text-muted:   #6b7280;

  --header-h:         56px;
  --sidebar-w:        240px;
  --radius:           10px;
  --radius-sm:        6px;
  --shadow:           0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:        0 8px 32px rgba(0,0,0,.14);
  --transition:       .2s ease;

  --font:             -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── Utility ────────────────────────────────────────────────────────────────── */
.hidden     { display: none !important; }
.text-muted { color: var(--clr-text-muted); font-size: .9rem; }
.text-center{ text-align: center; }

/* ── Splash ─────────────────────────────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0;
  background: var(--clr-primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 32px; z-index: 9999;
}
.splash__logo svg { width: 160px; filter: drop-shadow(0 4px 12px rgba(0,0,0,.2)); }
.splash__spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Screens ────────────────────────────────────────────────────────────────── */
.screen { min-height: 100vh; }

/* ── Login ──────────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-primary-dark) 100%);
  padding: 24px 16px;
}
.login-card {
  background: var(--clr-surface);
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.login-logo {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 24px; gap: 8px;
}
.login-logo svg { width: 140px; }
.login-subtitle { color: var(--clr-text-muted); font-size: .9rem; font-weight: 500; }

.lang-switcher {
  display: flex; gap: 6px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 20px;
}
.lang-btn {
  background: none; border: 1px solid var(--clr-border);
  border-radius: 4px; padding: 3px 8px;
  font-size: .78rem; font-weight: 600; color: var(--clr-text-muted);
  transition: var(--transition);
}
.lang-btn:hover, .lang-btn.active {
  background: var(--clr-primary); color: #fff; border-color: var(--clr-primary);
}

.login-divider {
  text-align: center; margin: 16px 0; color: var(--clr-text-muted); font-size: .85rem;
  position: relative;
}
.login-divider::before, .login-divider::after {
  content: ''; position: absolute; top: 50%;
  width: calc(50% - 24px); height: 1px; background: var(--clr-border);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }

.login-link {
  display: block; text-align: center; margin-top: 16px;
  font-size: .875rem; color: var(--clr-text-muted);
}

.btn-back {
  position: absolute; top: 16px; left: 16px;
  background: none; border: none; font-size: 1.2rem;
  color: var(--clr-text-muted); padding: 4px;
}
.btn-back:hover { color: var(--clr-primary); }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: .875rem; font-weight: 600; color: var(--clr-text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-size: 1rem; color: var(--clr-text);
  background: var(--clr-surface);
  transition: border-color var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-light);
}
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-right: 44px; }
.btn-show-pw {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--clr-text-muted); padding: 4px;
}
.btn-show-pw svg { width: 18px; height: 18px; display: block; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600; border: none;
  cursor: pointer; transition: var(--transition); white-space: nowrap;
  text-decoration: none;
}
.btn--primary  { background: var(--clr-primary); color: #fff; }
.btn--primary:hover { background: var(--clr-primary-dark); }
.btn--outline  { background: transparent; color: var(--clr-primary); border: 1.5px solid var(--clr-primary); }
.btn--outline:hover { background: var(--clr-primary-light); }
.btn--danger   { background: var(--clr-danger); color: #fff; }
.btn--danger:hover { background: #c0392b; }
.btn--ghost    { background: transparent; color: var(--clr-text-muted); border: none; }
.btn--ghost:hover { background: var(--clr-bg); }
.btn--full     { width: 100%; }
.btn--sm       { padding: 6px 14px; font-size: .85rem; }
.btn--tts {
  background: none; border: 1.5px solid var(--clr-border);
  border-radius: 50%; width: 36px; height: 36px; padding: 0;
  color: var(--clr-text-muted);
}
.btn--tts.active { color: var(--clr-primary); border-color: var(--clr-primary); }
.btn-link { background: none; border: none; color: var(--clr-primary); font-size: .875rem; cursor: pointer; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .875rem; margin-bottom: 12px;
}
.alert--error   { background: #fdecea; color: var(--clr-danger); border: 1px solid #f5c6cb; }
.alert--success { background: #d4edda; color: var(--clr-success); border: 1px solid #c3e6cb; }
.alert--info    { background: #d1ecf1; color: var(--clr-info);    border: 1px solid #bee5eb; }

/* ── App-Header ─────────────────────────────────────────────────────────────── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--clr-primary);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.header-menu-btn {
  background: none; border: none; padding: 6px; display: flex;
  flex-direction: column; gap: 5px; cursor: pointer;
}
.header-menu-btn span {
  display: block; width: 22px; height: 2px; background: #fff;
  border-radius: 2px; transition: var(--transition);
}
.header-logo { flex: 1; display: flex; align-items: center; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-btn {
  background: rgba(255,255,255,.15); border: none;
  border-radius: 8px; padding: 7px; color: #fff;
  position: relative; transition: var(--transition);
}
.header-btn:hover { background: rgba(255,255,255,.25); }
.header-btn svg { display: block; }

.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

.badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--clr-danger); color: #fff;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--clr-primary);
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition);
  z-index: 90;
  box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: translateX(0); }
.sidebar-inner { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 89;
}
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--clr-border);
}
.sidebar-footer-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  background: none; border: none;
  color: var(--clr-danger); font-size: .9rem; font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-footer-btn:hover { background: #fdecea; }

.nav-list { list-style: none; }
.nav-list li a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; color: var(--clr-text);
  font-size: .9rem; font-weight: 500;
  border-radius: var(--radius-sm); margin: 2px 8px;
  transition: var(--transition); text-decoration: none;
}
.nav-list li a:hover { background: var(--clr-bg); color: var(--clr-primary); }
.nav-list li a.active {
  background: var(--clr-primary-light); color: var(--clr-primary);
  font-weight: 700;
}
.nav-list li a svg { flex-shrink: 0; width: 18px; height: 18px; }

/* Desktop: Sidebar immer sichtbar */
@media (min-width: 768px) {
  .sidebar { transform: translateX(0); box-shadow: none; }
  .sidebar-overlay { display: none !important; }
  .header-menu-btn { display: none; }
  .app-main { padding-left: var(--sidebar-w); }
}

/* ── App-Main ───────────────────────────────────────────────────────────────── */
.app-main {
  padding-top: var(--header-h);
  min-height: 100vh;
}
.view { padding: 20px 16px; max-width: 1200px; margin: 0 auto; }

/* ── Karten / Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--clr-surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card__title { font-size: 1.05rem; font-weight: 700; }

/* ── Dashboard Widgets ──────────────────────────────────────────────────────── */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.widget {
  background: var(--clr-surface); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.widget__icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--clr-primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--clr-primary);
}
.widget__value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.widget__label { font-size: .82rem; color: var(--clr-text-muted); }

/* ── Tabellen ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%; border-collapse: collapse;
  background: var(--clr-surface); font-size: .9rem;
}
th {
  background: var(--clr-bg); text-align: left;
  padding: 10px 14px; font-size: .8rem; font-weight: 700;
  color: var(--clr-text-muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--clr-border);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--clr-border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--clr-bg); }

/* ── Badges / Status ────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 700;
}
.tag--green  { background: #d4edda; color: #155724; }
.tag--red    { background: #f8d7da; color: #721c24; }
.tag--blue   { background: #cce5ff; color: #004085; }
.tag--yellow { background: #fff3cd; color: #856404; }
.tag--gray   { background: var(--clr-bg); color: var(--clr-text-muted); }

/* ── Benachrichtigungs-Panel ────────────────────────────────────────────────── */
.notif-panel {
  position: fixed; top: var(--header-h); right: 12px;
  width: 340px; max-height: 480px;
  background: var(--clr-surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 200;
  display: flex; flex-direction: column;
  overflow: hidden; border: 1px solid var(--clr-border);
}
.notif-panel__header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--clr-border);
}
.notif-panel__header h3 { font-size: .95rem; font-weight: 700; }
.notif-panel__body { overflow-y: auto; flex: 1; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--clr-border);
  cursor: pointer; transition: var(--transition);
}
.notif-item:hover { background: var(--clr-bg); }
.notif-item.unread { background: var(--clr-primary-light); }
.notif-item__title { font-size: .875rem; font-weight: 600; margin-bottom: 2px; }
.notif-item__body  { font-size: .8rem; color: var(--clr-text-muted); }
.notif-item__time  { font-size: .75rem; color: var(--clr-text-muted); margin-top: 4px; }

/* ── User-Dropdown ──────────────────────────────────────────────────────────── */
.user-dropdown {
  position: fixed; top: calc(var(--header-h) + 8px); right: 12px;
  width: 240px; background: var(--clr-surface);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 200; border: 1px solid var(--clr-border); overflow: hidden;
}
.user-dropdown__info {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
}
.avatar-md {
  width: 44px; height: 44px; border-radius: 50%; background: var(--clr-primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--clr-primary); overflow: hidden; flex-shrink: 0;
}
.avatar-md img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown__info strong { display: block; font-size: .9rem; }
.user-dropdown__info small  { color: var(--clr-text-muted); font-size: .78rem; }
.user-dropdown hr { border: none; border-top: 1px solid var(--clr-border); margin: 4px 0; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: .875rem; color: var(--clr-text);
  transition: var(--transition); text-decoration: none;
}
.dropdown-item:hover { background: var(--clr-bg); text-decoration: none; }
.dropdown-item--danger { color: var(--clr-danger); }

/* ── Tour Overlay ───────────────────────────────────────────────────────────── */
.tour-overlay { position: fixed; inset: 0; z-index: 500; pointer-events: none; }
.tour-overlay.active { pointer-events: auto; }
.tour-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.6);
  transition: clip-path .4s ease;
}
.tour-spotlight {
  position: absolute; border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.6);
  transition: all .4s ease;
  pointer-events: none;
}
.tour-bubble {
  position: absolute; background: var(--clr-surface);
  border-radius: 14px; padding: 20px;
  width: min(340px, 90vw);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: bubblePop .3s ease;
}
@keyframes bubblePop {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
.tour-bubble__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.tour-progress-bar {
  flex: 1; height: 4px; background: var(--clr-border);
  border-radius: 2px; margin-right: 12px; overflow: hidden;
}
.tour-progress-fill { height: 100%; background: var(--clr-primary); transition: width .3s ease; }
.tour-step-label { font-size: .75rem; color: var(--clr-text-muted); white-space: nowrap; }
.tour-bubble h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.tour-bubble p  { font-size: .9rem; color: var(--clr-text-muted); line-height: 1.5; }
.tour-bubble__actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px;
}
.tour-bubble__nav { display: flex; align-items: center; gap: 8px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9000;
}
.toast {
  background: #1a1a2e; color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: .875rem; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  max-width: 320px; animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: none; } }
.toast.toast--success { border-left: 4px solid var(--clr-success); }
.toast.toast--error   { border-left: 4px solid var(--clr-danger);  }
.toast.toast--info    { border-left: 4px solid var(--clr-info);    }

/* ── PWA Banner ─────────────────────────────────────────────────────────────── */
.pwa-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--clr-surface); border-top: 1px solid var(--clr-border);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  z-index: 300; box-shadow: 0 -4px 16px rgba(0,0,0,.1);
}
.pwa-banner__text { flex: 1; }
.pwa-banner__text strong { display: block; font-size: .9rem; }
.pwa-banner__text small  { color: var(--clr-text-muted); font-size: .78rem; }
.btn-close { background: none; border: none; font-size: 1.4rem; color: var(--clr-text-muted); padding: 0 4px; }

/* ── Offline-Banner ─────────────────────────────────────────────────────────── */
.offline-banner {
  position: fixed; top: var(--header-h); left: 0; right: 0;
  background: var(--clr-warning); color: #fff;
  text-align: center; padding: 6px; font-size: .85rem; z-index: 150;
}

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  flex-wrap: wrap; margin-top: 16px;
}
.pagination button {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--clr-border);
  background: var(--clr-surface); font-size: .875rem;
  transition: var(--transition);
}
.pagination button:hover, .pagination button.active {
  background: var(--clr-primary); color: #fff; border-color: var(--clr-primary);
}

/* ── Modale ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 400; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--clr-surface); border-radius: 14px;
  padding: 24px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal__title { font-size: 1.1rem; font-weight: 700; }
.modal__close {
  background: none; border: none; font-size: 1.4rem;
  color: var(--clr-text-muted); line-height: 1;
}

/* ── Passkey-Verwaltung ─────────────────────────────────────────────────────── */
#passkey-setup { display: flex; flex-direction: column; gap: 12px; }
.passkey-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
}
.passkey-item__icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--clr-primary-light); color: var(--clr-primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.passkey-item__info { flex: 1; }
.passkey-item__info strong { display: block; font-size: .9rem; }
.passkey-item__info small  { color: var(--clr-text-muted); font-size: .78rem; }

/* ── Responsive Anpassungen ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .widget-grid { grid-template-columns: repeat(2, 1fr); }
  .notif-panel { right: 0; left: 0; width: 100%; border-radius: 0; }
  .user-dropdown { right: 0; width: 100%; border-radius: 0; border-left: none; border-right: none; }
}
