/* NXT-Short — NXT / Nextwork Design Guide
   Maison Neue (Regular + Black), ein Akzent (NXT Orange), eckige Ecken (0–2px),
   keine Verläufe und keine Schatten. */

@font-face {
  font-family: 'MaisonNeue';
  src: url('/fonts/MaisonNeue-Book.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MaisonNeue';
  src: url('/fonts/MaisonNeue-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --nxt-orange: #FF5F00;
  --nxt-black: #1B1D1F;
  --nxt-dark-grey: #4F4E4F;
  --nxt-medium-grey: #807F80;
  --nxt-light-grey: #BBBABB;
  --nxt-soft-grey: #EAEAEA;
  --nxt-white: #FFFFFF;
  --nxt-page-grey: #F7F7F7;  /* Seitenhintergrund der Hauptseite (nicht im Styleguide, von nextwork.de gemessen) */

  --font: 'MaisonNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --radius: 2px;

  --text-intro: 1.3rem;
  --text-body: 1rem;
  --text-small: 0.85rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--nxt-page-grey);
  color: var(--nxt-black);
  font-family: var(--font);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible { outline: 2px solid var(--nxt-orange); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Typografie ---------- */
.heading {
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.heading .subhead { display: block; color: var(--nxt-orange); }

.lead { font-size: var(--text-intro); line-height: 1.4; color: var(--nxt-dark-grey); }

.caption {
  font-size: var(--text-small);
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nxt-dark-grey);
}

.muted { color: var(--nxt-dark-grey); }

/* ---------- Card ---------- */
.card {
  background: var(--nxt-soft-grey);
  border-radius: var(--radius);
  padding: 32px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Primär: Orange, weiße Schrift (nur Black-Schnitt) */
.btn-primary { background: var(--nxt-orange); border-color: var(--nxt-orange); color: var(--nxt-white); }
.btn-primary:hover:not(:disabled) { background: var(--nxt-black); border-color: var(--nxt-black); }

/* Sekundär: Outline, Hover füllt mit Orange */
.btn-secondary, .btn-outline { background: transparent; border-color: var(--nxt-black); color: var(--nxt-black); }
.btn-secondary:hover:not(:disabled), .btn-outline:hover:not(:disabled) {
  background: var(--nxt-orange); border-color: var(--nxt-orange); color: var(--nxt-white);
}

.btn-destructive { background: transparent; border-color: var(--nxt-orange); color: var(--nxt-orange); }
.btn-destructive:hover:not(:disabled) { background: var(--nxt-orange); color: var(--nxt-white); }

.btn-sm { height: 34px; padding: 0 14px; font-size: var(--text-small); border-width: 1.5px; }
.btn-lg { height: 52px; padding: 0 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 8px; border: 0; min-width: 0; }
.field + .field { margin-top: 24px; }

.input {
  width: 100%;
  height: 52px;
  background: var(--nxt-white);
  border: 1px solid var(--nxt-light-grey);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-family: inherit;
  font-size: var(--text-body);
  color: var(--nxt-black);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder { color: var(--nxt-medium-grey); }
.input:hover { border-color: var(--nxt-medium-grey); }
.input:focus { border-color: var(--nxt-orange); box-shadow: 0 0 0 1px var(--nxt-orange); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-small);
  font-weight: 900;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-solid { background: var(--nxt-black); color: var(--nxt-white); }
.badge-soft, .badge-ok { background: var(--nxt-soft-grey); color: var(--nxt-black); }
.badge-outline, .badge-never { background: transparent; color: var(--nxt-dark-grey); border-color: var(--nxt-light-grey); }
.badge-exp { background: var(--nxt-white); color: var(--nxt-black); border-color: var(--nxt-orange); }

/* ---------- Alert ---------- */
.alert {
  display: none;
  margin-top: 24px;
  padding: 12px 16px;
  border-left: 4px solid var(--nxt-orange);
  background: var(--nxt-white);
  color: var(--nxt-black);
}
.alert.visible { display: block; }

/* ---------- Footer / Logo ---------- */
.site-header {
  display: flex;
  justify-content: center;
  background: var(--nxt-white);
  border-bottom: 1px solid var(--nxt-light-grey);
  padding: 17px 0 13px;
}
.logo { display: inline-flex; align-items: center; }
.logo img { display: block; width: 80px; height: 80px; object-fit: contain; }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 4px 24px;
  font-size: var(--text-small);
  color: var(--nxt-dark-grey);
}
.footer a { text-decoration: none; transition: color 0.15s; }
.footer a:hover { color: var(--nxt-orange); }

/* ---------- Spinner ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--nxt-white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================
   Startseite
   ===================================================== */
.page-center { display: flex; flex-direction: column; align-items: center; gap: 64px; padding: 64px 24px 48px; }
.page-center .container { width: 100%; max-width: 680px; display: flex; flex-direction: column; gap: 48px; }
.stack { display: flex; flex-direction: column; gap: 48px; }
.intro { display: flex; flex-direction: column; gap: 16px; }
.legend { margin-bottom: 8px; padding: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--nxt-light-grey);
  border-radius: var(--radius);
  background: var(--nxt-white);
  font-size: 0.9rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover span { border-color: var(--nxt-black); }
.chip input:checked + span { background: var(--nxt-black); border-color: var(--nxt-black); color: var(--nxt-white); font-weight: 900; }
.chip input:focus-visible + span { outline: 2px solid var(--nxt-orange); outline-offset: 2px; }

.submit-row { margin-top: 32px; }

.result {
  display: none;
  margin-top: 24px;
  padding: 20px;
  background: var(--nxt-white);
  border-left: 4px solid var(--nxt-orange);
}
.result.visible { display: block; animation: fadeUp 0.25s ease both; }
.result-url-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.result-url {
  flex: 1; min-width: 0;
  font-size: 1.3rem; font-weight: 900;
  color: var(--nxt-orange);
  text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-url:hover { text-decoration: underline; text-underline-offset: 4px; }
.result-meta { margin-top: 8px; font-size: var(--text-small); color: var(--nxt-dark-grey); }

/* =====================================================
   Login
   ===================================================== */
.login-wrap { min-height: calc(100vh - 111px); display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-box { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 32px; animation: fadeUp 0.35s ease both; }
.login-box .heading { font-size: 2.25rem; }
.back-link { font-size: var(--text-small); color: var(--nxt-dark-grey); text-decoration: none; }
.back-link:hover { color: var(--nxt-orange); }
.login-btn-row { margin-top: 32px; }

/* =====================================================
   Admin
   ===================================================== */
.admin-body { padding: 0 0 64px; opacity: 0; transition: opacity 0.3s; }
.admin-body.ready { opacity: 1; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 48px 24px 0; display: flex; flex-direction: column; gap: 32px; }

.topbar { display: flex; flex-direction: column; align-items: stretch; gap: 32px; }
.topbar .heading { font-size: 2.25rem; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 0; background: none; }
.stat { background: var(--nxt-soft-grey); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.stat-value { font-size: 2.75rem; line-height: 1.1; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-value.accent { color: var(--nxt-orange); }

.search-row { display: flex; align-items: center; gap: 16px; }
.search-wrap { position: relative; flex: 1; }
.search-wrap .input { padding-left: 46px; }
.search-wrap svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--nxt-dark-grey); }
.count { font-size: var(--text-small); color: var(--nxt-dark-grey); white-space: nowrap; }

.card.table-card { padding: 0; overflow: hidden; background: var(--nxt-white); border: 1px solid var(--nxt-soft-grey); }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 700px; border-collapse: collapse; }

thead th {
  background: var(--nxt-white);
  border-bottom: 2px solid var(--nxt-black);
  padding: 14px 16px;
  text-align: left;
  font-size: var(--text-small); font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--nxt-black);
}
thead th.num, td.td-clicks { text-align: right; font-variant-numeric: tabular-nums; }

tbody tr:nth-child(even) { background: var(--nxt-soft-grey); }
td { padding: 14px 16px; vertical-align: middle; }

.td-code a { font-weight: 900; text-decoration: none; }
.td-code a:hover { color: var(--nxt-orange); }
.td-url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nxt-dark-grey); }
.td-date { white-space: nowrap; color: var(--nxt-dark-grey); }
.td-actions { text-align: right; white-space: nowrap; }
.td-actions .btn + .btn { margin-left: 8px; }

.empty { text-align: center; padding: 64px 16px; color: var(--nxt-dark-grey); }

.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 100;
  transform: translate(-50%, 8px);
  background: var(--nxt-black); color: var(--nxt-white);
  padding: 12px 20px; border-radius: var(--radius);
  font-weight: 900;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .page-center { padding: 24px 16px 32px; gap: 48px; }
  .page-center .container, .stack { gap: 32px; }
  .heading { font-size: 2rem; }
  .lead { font-size: 1.1rem; }
  .card { padding: 20px; }
  .card.stats { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 16px; }
  .stat-value { font-size: 2rem; }
  .search-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .count { text-align: right; }
  .result-url-row { flex-wrap: wrap; }
}
