/* ── Google Font: Jost (Century Gothic Ersatz) ───────────────── */
@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&display=swap');

/* ── Reset & Basis ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:        #f4f5f7;
  --c-surface:   #ffffff;
  --c-surface2:  #f0f1f3;
  --c-border:    #dde0e6;
  --c-red:       #cc0000;
  --c-red-dark:  #a80000;
  --c-red-light: #fff0f0;
  --c-text:      #1a1a1a;
  --c-muted:     #666666;
  --c-heading:   #111111;
  --c-nav-bg:    #ffffff;
  --c-nav-border:#e0e0e0;
  --radius:      8px;
  --radius-sm:   5px;
  --shadow:      0 2px 12px rgba(0,0,0,.09);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.13);
  --transition:  .16s ease;
}

body {
  font-family: 'Jost', 'Century Gothic', 'Century', Futura, system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--c-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Logo ────────────────────────────────────────────────────── */
.nav-logo-link { display: flex; align-items: center; text-decoration: none !important; }
.nav-logo-img  { height: 42px; width: auto; object-fit: contain; }
.topbar-logo   { height: 50px; width: auto; object-fit: contain; }

/* ── Navbar (eingeloggt – roter Topbar-Stil) ─────────────────── */
.navbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0 2rem;
  height: 56px;
  background: var(--c-red);
  border-bottom: none;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.nav-brand { display: flex; align-items: center; margin-right: 1.5rem; }
.nav-links  { display: flex; gap: .1rem; flex: 1; }
.nav-link {
  padding: .4rem .9rem; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.82); font-size: .88rem; transition: var(--transition);
  font-weight: 500;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.18); color: #fff;
  text-decoration: none;
}
.nav-user { display: flex; align-items: center; gap: .75rem; }
.nav-username { color: rgba(255,255,255,.9); font-size: .88rem; font-weight: 500; }
.badge-admin {
  background: rgba(255,255,255,.25); color: #fff;
  padding: .15rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; border: 1px solid rgba(255,255,255,.4);
}
.btn-logout {
  padding: .32rem .85rem; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.15); color: #fff;
  font-size: .83rem; transition: var(--transition);
  border: 1px solid rgba(255,255,255,.35); cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,.28); text-decoration: none; color: #fff; }

/* ── Main Layout ─────────────────────────────────────────────── */
.main-content { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  margin-bottom: 1rem; font-size: .9rem; border-left: 4px solid;
}
.alert-error   { background: #fff0f0; border-color: var(--c-red); color: #8b0000; }
.alert-success { background: #f0fff4; border-color: #22a843; color: #166534; }
.alert-info    { background: #eff6ff; border-color: #3b82f6; color: #1e40af; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.3rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition); white-space: nowrap;
  text-decoration: none; line-height: 1.4;
}
.btn-primary  { background: var(--c-red); color: #fff; }
.btn-primary:hover  { background: var(--c-red-dark); color: #fff; text-decoration: none; }
.btn-secondary {
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn-secondary:hover { background: var(--c-surface2); text-decoration: none; }
.btn-danger   { background: #b91c1c; color: #fff; }
.btn-danger:hover   { background: #991b1b; text-decoration: none; }
.btn-download { background: var(--c-red); color: #fff; }
.btn-download:hover { background: var(--c-red-dark); text-decoration: none; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm   { padding: .28rem .65rem; font-size: .8rem; }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--c-border);
}
.page-title   { font-size: 1.6rem; font-weight: 700; color: var(--c-heading); }
.page-title span { color: var(--c-red); }
.page-subtitle { color: var(--c-muted); font-size: .9rem; margin-top: .2rem; }
.section-title {
  font-size: 1rem; font-weight: 700; color: var(--c-heading);
  margin-bottom: 1rem; padding-bottom: .5rem;
  border-bottom: 2px solid var(--c-red); display: inline-block;
}

/* ── Login Page ──────────────────────────────────────────────── */
.login-body { background: var(--c-bg); }

.login-topbar {
  background: #fff;
  border-bottom: 3px solid var(--c-red);
  padding: 0 2rem;
  height: 70px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
  position: relative; z-index: 10;
}
.topbar-left  { display: flex; align-items: center; gap: 1.5rem; }
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--c-heading); letter-spacing: .01em; }
.topbar-title span { color: var(--c-red); }
.topbar-clock { text-align: right; }
.topbar-clock-time { font-size: 1.2rem; font-weight: 700; color: var(--c-heading); line-height: 1.1; }
.topbar-clock-date { font-size: .78rem; color: var(--c-muted); }

/* Hintergrund Login-Seite – volle Stärke */
.login-bg {
  position: fixed; top: 73px; left: 0; right: 0; bottom: 0; z-index: 0;
  background-image: url('/static/cans-bg.png');
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  opacity: 1;
  pointer-events: none;
}
/* Hintergrund authentifizierte Seiten – blass */
.app-bg {
  position: fixed; top: 60px; left: 0; right: 0; bottom: 0; z-index: 0;
  background-image: url('/static/cans-bg.png');
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  opacity: .12;
  pointer-events: none;
}

/* ── Inaktivitäts-Timer ──────────────────────────────────────── */
.session-timer {
  display: flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius-sm); padding: .3rem .7rem;
  font-size: .82rem; color: #fff; white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
}
.session-timer .timer-icon { font-size: .9rem; }
.session-timer .timer-val  { font-weight: 700; font-variant-numeric: tabular-nums; }
.session-timer .timer-lbl  { font-size: .72rem; display: block; line-height: 1; opacity: .8; }
.session-timer.warn {
  background: #f59e0b; border-color: #d97706; color: #fff;
}
.session-timer.danger {
  background: #fff; border-color: #fff; color: var(--c-red);
  animation: pulse-red .8s ease-in-out infinite;
}
@keyframes pulse-red {
  0%,100% { opacity: 1; } 50% { opacity: .65; }
}

/* ── IT-Info Box ─────────────────────────────────────────────── */
.it-infobox {
  background: rgba(255,255,255,.93); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  box-shadow: var(--shadow); max-width: 960px; margin: 1rem auto 0;
  position: relative; z-index: 1;
}
.it-infobox-title {
  font-size: .72rem; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: .6rem;
  display: flex; align-items: center; gap: .4rem;
}
.it-infobox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: .5rem;
}
.it-info-item {
  display: flex; flex-direction: column; gap: .1rem;
  background: var(--c-surface2); border-radius: var(--radius-sm);
  padding: .5rem .75rem; border: 1px solid var(--c-border);
}
.it-info-label { font-size: .7rem; color: var(--c-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.it-info-value { font-size: .88rem; font-weight: 600; color: var(--c-heading); word-break: break-all; }
.it-info-value.mono { font-family: monospace; font-size: .85rem; }
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: .35rem; vertical-align: middle;
}
.status-dot.ok     { background: #22c55e; box-shadow: 0 0 4px #22c55e88; }
.status-dot.error  { background: var(--c-red); }
.status-dot.loading { background: #f59e0b; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: rgba(255,255,255,.92);
  border-top: 1px solid var(--c-border);
  padding: .55rem 2rem;
  display: flex; align-items: center; justify-content: center; gap: 2rem;
  font-size: .8rem; color: var(--c-muted);
  backdrop-filter: blur(4px);
}
.site-footer a { color: var(--c-muted); transition: color var(--transition); }
.site-footer a:hover { color: var(--c-red); text-decoration: none; }
.footer-sep { color: var(--c-border); }

.login-wrapper {
  max-width: 960px; margin: 0 auto; padding: 2.5rem 1.5rem;
  display: grid; grid-template-columns: 380px 1fr; gap: 2rem; align-items: start;
}
.login-wrapper--center {
  grid-template-columns: 1fr; max-width: 440px;
}
.login-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-lg);
  border-top: 3px solid var(--c-red);
}
.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-logo-wrap { margin-bottom: 1rem; }
.login-title  { font-size: 1.2rem; font-weight: 700; color: var(--c-heading); margin-top: .5rem; }
.login-subtitle { color: var(--c-muted); font-size: .85rem; margin-top: .2rem; }
.login-hint {
  font-size: .8rem; color: var(--c-muted); text-align: center; margin-top: 1rem;
  line-height: 1.5;
}
.login-divider {
  display: flex; align-items: center; gap: .75rem; margin: 1rem 0;
  font-size: .8rem; color: var(--c-muted);
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--c-border);
}

/* ── Forms ───────────────────────────────────────────────────── */
.login-form, .upload-form { display: flex; flex-direction: column; gap: .85rem; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { font-size: .82rem; color: var(--c-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
input[type=text], input[type=password], input[type=email],
input[type=number], textarea, select {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); color: var(--c-text);
  padding: .6rem .85rem; font-size: .9rem; width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--c-red);
  box-shadow: 0 0 0 3px rgba(204,0,0,.1);
}
input.input-disabled { opacity: .5; cursor: not-allowed; background: var(--c-surface2); }
.input-code {
  font-size: 1.5rem; letter-spacing: .35em; text-align: center; font-weight: 600;
}
.form-check  { display: flex; align-items: center; gap: .5rem; }
.form-check input[type=checkbox] { width: auto; accent-color: var(--c-red); }
.form-check label { font-size: .9rem; color: var(--c-text); margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400; }
.mt-2 { margin-top: .5rem; }

/* ── Public Downloads Card ───────────────────────────────────── */
.public-downloads-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow);
  border-top: 3px solid var(--c-red);
}
.downloads-empty { text-align: center; color: var(--c-muted); }
.downloads-header { margin-bottom: 1.25rem; }
.downloads-icon  { font-size: 1.8rem; }
.downloads-title {
  font-size: 1.1rem; font-weight: 700; color: var(--c-heading); margin-top: .4rem;
}
.downloads-subtitle { font-size: .85rem; color: var(--c-muted); margin-top: .2rem; }
.download-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.download-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem; background: var(--c-surface2);
  border-radius: var(--radius-sm); border: 1px solid var(--c-border);
  transition: border-color var(--transition);
}
.download-item:hover { border-color: var(--c-red); }
.download-info  { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.download-name  { font-weight: 600; color: var(--c-heading); font-size: .9rem; }
.download-desc  { font-size: .8rem; color: var(--c-muted); }
.download-meta  { font-size: .75rem; color: var(--c-muted); }

/* ── TOTP Setup ──────────────────────────────────────────────── */
.totp-setup     { text-align: center; margin-bottom: 1rem; }
.totp-instruction { font-size: .9rem; color: var(--c-muted); margin-bottom: 1rem; line-height: 1.5; }
.qr-container   {
  background: #fff; display: inline-block; padding: 1rem;
  border-radius: var(--radius-sm); border: 2px solid var(--c-border);
}
.qr-image       { display: block; }
.totp-manual    { margin-top: 1rem; font-size: .85rem; color: var(--c-muted); }
.totp-secret    {
  display: block; margin-top: .5rem; font-family: monospace; font-size: .9rem;
  background: var(--c-surface2); padding: .5rem; border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
}
.back-link      { display: block; text-align: center; margin-top: 1rem; font-size: .85rem; color: var(--c-red); }

/* ── Module Grid ─────────────────────────────────────────────── */
.modules-section { margin-bottom: 2.5rem; }
.modules-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.module-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.5rem;
  display: flex; flex-direction: column; gap: .6rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  border-top: 3px solid transparent;
}
.module-card:hover {
  border-top-color: var(--c-red); box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.module-card--placeholder { opacity: .55; }
.module-card--placeholder:hover {
  transform: none; box-shadow: none; border-top-color: transparent;
}
.module-icon  { font-size: 1.8rem; }
.module-title { font-size: .95rem; font-weight: 700; color: var(--c-heading); }
.module-desc  { font-size: .83rem; color: var(--c-muted); flex: 1; }
.module-link  { font-size: .85rem; font-weight: 600; color: var(--c-red); }
.module-link--disabled { color: var(--c-muted); cursor: default; }

/* ── Upload Section ──────────────────────────────────────────── */
.upload-section     { margin-bottom: 2.5rem; }
.upload-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.upload-dropzone {
  border: 2px dashed var(--c-border); border-radius: var(--radius-sm);
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer; margin-bottom: .75rem;
}
.upload-dropzone.dragover { border-color: var(--c-red); background: var(--c-red-light); }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2rem 1rem; }
.dropzone-icon  { font-size: 2.2rem; }
.dropzone-label { font-weight: 600; color: var(--c-heading); }
.dropzone-hint  { font-size: .82rem; color: var(--c-muted); }
.file-input     { display: none; }
.file-input-inline { padding: .4rem 0; }
.selected-file  { font-size: .85rem; color: var(--c-red); margin-top: .25rem; font-weight: 500; }

/* ── Data Table ──────────────────────────────────────────────── */
.uploads-list-section { margin-bottom: 2.5rem; }
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--c-border); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table thead { background: var(--c-heading); }
.data-table th {
  padding: .7rem 1rem; text-align: left;
  color: #ffffff; font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 2px solid var(--c-red);
}
.data-table td {
  padding: .7rem 1rem; border-bottom: 1px solid var(--c-border);
  vertical-align: middle; background: var(--c-surface);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--c-surface2); }
.data-table tr.row-inactive td { opacity: .5; }
.td-filename { font-weight: 600; color: var(--c-heading); }
.td-meta     { color: var(--c-muted); font-size: .82rem; white-space: nowrap; }
.td-actions  { display: flex; gap: .3rem; align-items: center; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .18rem .55rem;
  border-radius: 99px; font-size: .72rem; font-weight: 700;
  white-space: nowrap; letter-spacing: .03em;
}
.badge-ok    { background: #dcfce7; color: #166534; }
.badge-warn  { background: #fef3c7; color: #92400e; }
.badge-off   { background: #f3f4f6; color: #6b7280; }
.badge-admin { background: var(--c-red); color: #fff; }
.badge-user  { background: #dbeafe; color: #1e40af; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  border-top: 3px solid var(--c-red);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--c-border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--c-heading); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--c-muted); font-size: 1.1rem; }
.modal-close:hover { color: var(--c-red); }
.modal-body   { padding: 1.5rem; display: flex; flex-direction: column; gap: .9rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: .75rem;
  padding: 1rem 1.5rem; border-top: 1px solid var(--c-border);
  background: var(--c-surface2);
}

/* ── Info-Seiten (Impressum, Kontakt, Datenschutz) ───────────── */
.info-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow);
  max-width: 800px;
}
.info-card h2 {
  font-size: 1rem; font-weight: 700; color: var(--c-heading);
  margin: 1.5rem 0 .5rem; padding-bottom: .3rem;
  border-bottom: 2px solid var(--c-red); display: inline-block;
}
.info-card h2:first-child { margin-top: 0; }
.info-card p  { color: var(--c-text); margin-bottom: .75rem; line-height: 1.7; }
.info-card ul { padding-left: 1.5rem; color: var(--c-text); line-height: 1.9; }

.contact-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1rem;
}
.contact-item {
  display: flex; gap: .75rem; align-items: flex-start;
  background: var(--c-surface2); padding: 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
}
.contact-icon { font-size: 1.4rem; flex-shrink: 0; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--c-muted); }
.empty-icon  { font-size: 3rem; display: block; margin-bottom: .75rem; }

/* ── Table Card (Admin-Seiten) ───────────────────────────────── */
.table-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto;
}
.table-card .data-table { border-collapse: collapse; width: 100%; }

/* ── Modal (backdrop-Variante) ───────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 300; display: flex; align-items: center; justify-content: center;
}
.modal-backdrop .modal { width: 100%; max-width: 520px; margin: 1rem; }

/* ── Kunden-Portal Module ────────────────────────────────────── */
.module-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-top: 1.5rem;
}
.module-card-soon { opacity: .6; }
.badge-soon {
  display: inline-block; background: #e5e7eb; color: #6b7280;
  font-size: .72rem; font-weight: 700; padding: .2rem .55rem;
  border-radius: 99px; letter-spacing: .04em;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .login-wrapper { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .navbar { flex-wrap: wrap; padding: .75rem 1rem; height: auto; }
  .main-content { padding: 1rem; }
}
