/* ═══════════════════════════════════════════════════════════════════════════════
   ERP System — styles.css  v2.0
   Gilt für: index.php (Dashboard) und login.php
   Farben: #f4f6fb Hintergrund · #ffffff Karten · #0b5ed7 Akzent
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── 1. CSS-Variablen ──────────────────────────────────────────────────────── */
:root {
  --bg:          #f4f6fb;
  --card:        #ffffff;
  --border:      #e2e8f0;
  --accent:      #0b5ed7;
  --accent-dark: #0947b0;
  --accent-glow: rgba(11,94,215,0.15);
  --muted:       #64748b;
  --text:        #1e293b;
  --text-light:  #475569;
  --danger:      #ef4444;
  --success:     #22c55e;
  --topbar-h:    56px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.08);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── 2. Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0 0 0 1.1rem; }
li { margin-bottom: 0.25rem; color: var(--text-light); font-size: 0.88rem; }

/* ── 3. Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  font-size: 1rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-light);
}

.badge-admin {
  display: inline-block;
  padding: 1px 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── 4. Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  background: #eef2f9;
  border-color: #b4c4dc;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-logout {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
}
.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff5f5;
}

/* ── 5. Dashboard Layout ───────────────────────────────────────────────────── */
.dashboard-body {
  background: var(--bg);
}
.dash-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

/* Welcome Banner */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #0b5ed7 0%, #1a76ef 100%);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(11,94,215,0.25);
  color: #fff;
}
.welcome-banner h1 {
  margin: 0 0 0.2rem;
  font-size: 1.5rem;
  font-weight: 700;
}
.welcome-sub {
  margin: 0;
  opacity: 0.82;
  font-size: 0.88rem;
}
.meta-pill {
  padding: 0.35rem 0.9rem;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.05em;
}

/* Section title */
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

/* ── 6. Module Grid ────────────────────────────────────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-decoration: none;
  color: var(--text);
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  border-color: #b0c4e0;
}
.module-card:active {
  transform: translateY(0);
}

.module-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
/* Icon colours */
.mc-blue   { background: #dbeafe; }
.mc-green  { background: #dcfce7; }
.mc-indigo { background: #e0e7ff; }
.mc-orange { background: #ffedd5; }
.mc-slate  { background: #f1f5f9; }
.mc-teal   { background: #ccfbf1; }
.mc-amber  { background: #fef9c3; }
.mc-rose   { background: #ffe4e6; }

.module-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.module-name {
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-desc {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-arrow {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 1rem;
  transition: transform 0.15s;
}
.module-card:hover .module-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

/* ── 7. Info Cards ─────────────────────────────────────────────────────────── */
.info-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}
.info-card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.info-card-body h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* ── 8. Footer ─────────────────────────────────────────────────────────────── */
.dash-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--card);
  margin-top: 1rem;
}

/* ── 9. Login Page ─────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #e8eef9 0%, #f4f6fb 60%, #dce6f5 100%);
  padding: 1rem;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.25rem 2rem 1.75rem;
  box-shadow: 0 8px 40px rgba(11,94,215,0.12);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 14px;
  font-size: 1.6rem;
  margin-bottom: 0.9rem;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.login-title {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.login-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Alerts */
.alert {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.alert-success {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

/* Form elements */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.form-group input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group input::placeholder { color: #94a3b8; }

/* Password wrapper */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrap input { padding-right: 2.8rem; }
.pw-toggle {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  transition: color 0.15s;
}
.pw-toggle:hover { color: var(--accent); }

.btn-login {
  width: 100%;
  justify-content: center;
  padding: 0.65rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
}

.login-footer {
  text-align: center;
  margin: 1.25rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── 10. Shared Form / Card (für Submodule, falls styles.css geteilt wird) ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

/* Tabelle */
.tablewrap { max-height: 12cm; overflow: auto; }
table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.list th {
  background: #f8fafc;
  padding: 0.55rem 0.7rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.list th:hover { color: var(--accent); }
table.list td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table.list tr:hover td { background: #f8fafc; }
table.list tr.inactive td {
  background: #fff5f5;
  color: #9b1c1c;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e293b;
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 9999;
  max-width: 320px;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-error { background: var(--danger); }

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}
.modal[aria-hidden="false"] { display: flex; }
.modal-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}
.modal-card input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  margin-bottom: 0.75rem;
  outline: none;
}
.modal-card input:focus { border-color: var(--accent); }
.modal-card .tablewrap { flex: 1; overflow-y: auto; }

/* ── 11. Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .module-grid { grid-template-columns: 1fr 1fr; }
  .info-row    { grid-template-columns: 1fr; }
  .welcome-banner { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .dash-container { padding: 1rem; }
}
@media (max-width: 540px) {
  .module-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 1rem; }
  .topbar-user { display: none; }
  .login-wrap { padding: 1.5rem 1.25rem; }
}
