/* RivaGoLead - Material Design (Light/Dark), responsive */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --on-primary: #ffffff;
  --green: #16a34a;
  --green-dark: #15803d;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #eceef7;
  --text: #1c1e2b;
  --text-2: #5b6072;
  --border: #e2e4ef;
  --shadow: 0 6px 24px rgba(30, 34, 68, 0.10), 0 2px 6px rgba(30, 34, 68, 0.08);
  --shadow-sm: 0 2px 8px rgba(30, 34, 68, 0.08);
  --danger: #dc2626;
  --radius: 16px;
}

body.dark {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --on-primary: #10122b;
  --green: #4ade80;
  --green-dark: #22c55e;
  --bg: #0f1120;
  --surface: #191b2e;
  --surface-2: #232640;
  --text: #e8eaf6;
  --text-2: #9aa0bd;
  --border: #2c2f4a;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

body { display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--text);
  text-decoration: none;
}
.brand span { color: var(--primary); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg button.active { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.seg button:not(.active):hover { color: var(--text); }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { transform: scale(1.06); }

/* ---------- Layout ---------- */
#view { flex: 1; width: 100%; }
.container { margin: 0 auto; padding: 28px 10px 60px; }

h1 { font-size: 1.7rem; margin: 0 0 18px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.muted { color: var(--text-2); }
.small { font-size: 0.82rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---------- Hero / Login ---------- */
.hero {
  min-height: calc(100vh - 58px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 8px;
  background:
    linear-gradient(rgba(20, 22, 45, 0.55), rgba(20, 22, 45, 0.72)),
    url("../img/login_bg.jpg") center / cover no-repeat fixed;
}
.hero-card {
  width: 100%;
  max-width: 440px;
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  border: none;
}
body.dark .hero-card { background: rgba(25, 27, 46, 0.96); }

.brand-big {
  font-size: 3.2rem;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: 0.5px;
  color: #1c1e2b;
}
.brand-big span { color: var(--primary); }
body.dark .brand-big { color: var(--text); }

.subtitle { color: var(--text-2); margin: 0 0 26px; font-size: 0.98rem; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 6px; text-align: left; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}
textarea { min-height: 110px; resize: vertical; }
input[type="color"] { width: 100%; height: 42px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }

.err-text, .err { color: var(--danger); font-size: 0.88rem; min-height: 1.2em; margin-top: 8px; text-align: left; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.outlined { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
body.dark .btn.outlined { color: var(--primary); }
.btn.outlined:hover { background: rgba(79, 70, 229, 0.10); }
.btn.text { background: transparent; color: var(--primary); }
.btn.text:hover { background: rgba(79, 70, 229, 0.10); }
.btn.text.danger { color: var(--danger); }
.btn.text.danger:hover { background: rgba(220, 38, 38, 0.10); }
.btn.green { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.btn.green:hover { background: var(--green-dark); }
.btn.block { width: 100%; margin-top: 18px; padding: 12px; font-size: 1rem; }
.btn.sm { padding: 5px 11px; font-size: 0.78rem; border-radius: 8px; }
.btn.sm-text { font-size: 0.78rem; }

.test-area { margin-top: 16px; text-align: left; }
.btn:disabled, .btn[disabled] {
  background: var(--surface-2) !important;
  color: var(--text-2) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 0.75;
}

/* ---------- Dashboard ---------- */
.section { margin-bottom: 34px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 12px; }
.section-head h2 { margin: 0; }
.count-badge {
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 10px;
}

.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th {
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(79, 70, 229, 0.04); }
.title-cell { font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Survey ---------- */
.survey-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.survey-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 10px; }
.survey-desc { color: var(--text-2); max-width: 760px; font-size: 0.95rem; }
.survey-desc.white-box { max-width: none; }
.white-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
}
.kind-line { margin-top: 14px; font-weight: 700; }
.code-line { color: var(--text-2); font-size: 0.85rem; margin-top: 4px; }
.code-line.end { margin-top: 28px; }

.hint { font-size: 0.9rem; color: var(--text-2); margin: 18px 0 10px; }

.q-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface); }
table.questions { border-collapse: collapse; width: 100%; min-width: 900px; }
table.questions th, table.questions td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: center; vertical-align: top; }
table.questions th { background: var(--surface-2); font-size: 0.62rem; color: var(--text-2); line-height: 1.25; max-width: 90px; }
table.questions th .opt-nr { display: block; font-size: 0.72rem; font-weight: 800; color: var(--text); }
table.questions th.q-text, table.questions td.q-text { text-align: left; min-width: 320px; font-size: 0.9rem; }
table.questions th.q-nr, table.questions td.q-nr { text-align: center; color: var(--text-2); font-size: 0.85rem; width: 44px; }
table.questions td.q-text { font-weight: 500; }
table.questions th.opt-zero, table.questions td.opt-zero { border-left: 1px solid var(--border); padding-left: 26px; }
table.questions tr.unanswered td { background: rgba(79, 70, 229, 0.07); }
table.questions input[type="radio"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.q-table-wrap.locked { opacity: 0.55; }
.q-table-wrap.locked table.questions { filter: grayscale(0.5); }
.q-table-wrap.locked input[type="radio"] { cursor: not-allowed; }

.progress-line { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; font-size: 0.85rem; color: var(--text-2); }
.progress-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.25s ease; }

.done-area .success-banner { margin-top: 0; margin-bottom: 18px; }
.success-banner {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 12px;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.45);
  color: var(--green-dark);
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body.dark .success-banner { color: var(--green); }

/* ---------- Auswertung ---------- */
.eval-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 8px; }
.eval-topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.eval-title { font-size: 2rem; font-weight: 800; margin: 0; }
.eval-code { color: var(--text-2); font-size: 0.88rem; margin-top: 4px; }
.eval-brand { text-align: right; }
.eval-brand .b1 { font-size: 1.7rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.eval-brand .b2 { font-size: 0.75rem; color: var(--text-2); }

.bar-list { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.bar-row { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover { background: rgba(79, 70, 229, 0.07); }
.bar-label { font-weight: 600; font-size: 0.92rem; display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; }
.chip { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.bar-track { position: relative; background: var(--surface-2); border-radius: 8px; height: 22px; }
.bar-fill { height: 100%; border-radius: 8px; min-width: 2px; transition: width 0.4s ease; }
.bar-val { position: absolute; right: 8px; top: 2px; font-size: 0.8rem; font-weight: 700; color: var(--text); }
.bar-na { position: absolute; left: 10px; top: 2px; font-size: 0.78rem; color: var(--text-2); font-style: italic; }

.radar-wrap { display: flex; justify-content: center; margin: 26px 0 8px; }
.radar { max-width: 720px; width: 100%; height: auto; }
.radar-grid { fill: none; stroke: var(--border); stroke-width: 1; }
.radar-axis { stroke: var(--border); stroke-width: 1; }
.radar-poly { stroke-width: 2; }
.radar-spoke { fill: none; stroke-width: 6; stroke-linecap: round; }
.radar-label { font-size: 12px; fill: var(--text); font-weight: 600; }

.style-img { max-height: 64px; border-radius: 10px; }

/* ---------- Admin ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 20px; }
.tabs button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
}
.tabs button.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
}
.modal h3 { margin: 0 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.admin-thumb { max-height: 48px; max-width: 80px; border-radius: 8px; display: block; }
.style-preview { max-height: 120px; max-width: 100%; border-radius: 10px; display: block; margin: 4px 0 10px; }
.upload-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.82rem;
  margin-top: 8px;
}
.upload-label input[type="file"] { font-size: 0.78rem; max-width: 100%; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  box-shadow: var(--shadow);
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .container { padding: 18px 7px 48px; }
  h1 { font-size: 1.4rem; }
  .brand-big { font-size: 2.5rem; }
  .hero { background-attachment: scroll; }
  .card { padding: 18px; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
  .eval-brand { display: none; }
  .actions .btn { padding: 7px 10px; font-size: 0.8rem; }
  #topbar { padding: 8px 6px; }
}
