/* ================================================================
   fragebogen.css  –  HHU KPP Präferenz-App
   Modern redesign, 2026.
   Accent colour: --c-accent (#4a90b8, derived from legacy #a3c6dc)
   Workgroup accent:  --c-wg   (#5f7d91, derived from legacy #7892a3)
================================================================ */

/* ── Reset & tokens ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:          #f2f5f8;
  --c-surface:     #ffffff;
  --c-border:      #d0dae3;
  --c-accent:      #3a7fa8;       /* course-list highlight */
  --c-accent-soft: #dceef7;
  --c-wg:          #5a7d93;       /* workgroup-list highlight */
  --c-wg-soft:     #dde8ef;
  --c-text:        #1a2633;
  --c-muted:       #5a6e7e;
  --c-danger:      #c0392b;
  --c-success:     #1a7a40;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow:        0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 10px rgba(0,0,0,.09), 0 2px 4px rgba(0,0,0,.06);
  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                   'Helvetica Neue', Arial, sans-serif;
  --counter-size:  2.4em;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
}

/* ── Page shell ─────────────────────────────────────────────── */
body {
  padding-top: 0;
}

div.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* ── Page header bar (full viewport width) ──────────────────── */
/*
  Lives inside div.main in the PHP output, so we use a negative
  margin trick to break it out to full width.
*/
.page-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow);
  padding: 14px clamp(16px, 4vw, 40px);
  margin: 0 -16px 28px;          /* bleed out of div.main padding */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  /* keep text constrained even on wide viewports */
  max-width: none;
}
.page-header h1 {
  margin: 0;
  flex: 1 1 0;
  min-width: 0;
}
.page-header img {
  height: 44px;
  width: auto;
  flex-shrink: 0;
}

/* ── Cards / panels ─────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin-bottom: 24px;
}

/* ── Typography ─────────────────────────────────────────────── */
h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--c-text);
  margin: 0 0 4px;
}
h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--c-accent);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--c-accent-soft);
}
h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-text);
  margin: 20px 0 10px;
}
p { margin: 0 0 10px; }
a { color: var(--c-accent); }
a:hover { text-decoration: underline; }

/* ── Fragebogen container ───────────────────────────────────── */
div.fragebogen,
div.content,
div.repsonsebogen {
  /* No legacy fixed-width box; layout now handled by div.main */
  /* Classes kept for back-compat but no longer add decoration */
}

/* ── Info / danke / warning blocks ─────────────────────────── */
div.danke {
  background: #edfaf2;
  border: 1px solid #a3ddb8;
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 1rem;
  margin-bottom: 20px;
}
div.danke p { margin: 0 0 8px; }
div.danke p:last-child { margin-bottom: 0; }

div.info {
  background: var(--c-accent-soft);
  border: 1px solid #b0d0e8;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
}

div.warning {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 20px 24px;
  color: var(--c-danger);
  font-weight: 500;
  margin-bottom: 20px;
}

/* ── Inline instructions ────────────────────────────────────── */
div.text {
  margin-bottom: 16px;
}
div.text p { color: var(--c-muted); font-size: .93rem; }
div.text b, div.text strong { color: var(--c-text); }

/* ── Meta info row (Anmeldezeitraum etc.) ───────────────────── */
.meta-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-accent-soft);
  border: 1px solid #b0d0e8;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: .88rem;
  color: var(--c-accent);
  font-weight: 500;
  margin-bottom: 18px;
}

/* ── ═══════════════════════════════════════════════════════════
   SORTABLE PREFERENCE LISTS
   ═══════════════════════════════════════════════════════════ */

/* Shared list container */
#courses,
#workgroups,
#courses_saved,
#workgroups_saved {
  list-style: none;
  width: 100%;
  padding: 0;
  margin: 12px 0 20px;
}

/* ── Course list items ──────────────────────────────────────── */
#courses li,
#courses_saved li {
  display: flex;
  align-items: stretch;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
#courses li:hover {
  border-color: var(--c-accent);
  box-shadow: var(--shadow-md);
  cursor: grab;
}
#courses_saved li:hover { cursor: default; }

/* ── Workgroup list items ───────────────────────────────────── */
#workgroups li,
#workgroups_saved li {
  display: flex;
  align-items: stretch;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
#workgroups li:hover {
  border-color: var(--c-wg);
  box-shadow: var(--shadow-md);
  cursor: grab;
}
#workgroups_saved li:hover { cursor: default; }

/* ── Order-number badge ─────────────────────────────────────── */
/*
  The badge is rendered by CSS counter + ::before.
  For course lists: --c-accent background.
  For workgroup lists: --c-wg background.
*/

/* Reset counters on each list */
#courses,  #courses_saved  { counter-reset: course-num; }
#workgroups, #workgroups_saved { counter-reset: wg-num; }

#courses li,     #courses_saved li     { counter-increment: course-num; }
#workgroups li,  #workgroups_saved li  { counter-increment: wg-num; }

#courses li::before,
#courses_saved li::before {
  content: counter(course-num);
  background: var(--c-accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  min-width: var(--counter-size);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 0;          /* flush with the card edge */
  flex-shrink: 0;
  border-bottom-right-radius: var(--radius);
  border-top-right-radius:    var(--radius);
}

#workgroups li::before,
#workgroups_saved li::before {
  content: counter(wg-num);
  background: var(--c-wg);
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  min-width: var(--counter-size);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  flex-shrink: 0;
  border-bottom-right-radius: var(--radius);
  border-top-right-radius:    var(--radius);
}

/* ── Item inner layout ──────────────────────────────────────── */
/*
  The PHP renders a <table> inside each <li>.
  We override the table to behave like a flex container so
  the badge + content line up cleanly regardless of content length.
*/
#courses li > table,
#workgroups li > table,
#courses_saved li > table,
#workgroups_saved li > table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

/* Topic / title span */
.course_topic,
.workgroup_topic {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--c-text);
  padding: 10px 14px 4px;
  line-height: 1.35;
}

/* Inner info + time tables */
.course_body_table,
.workgroup_body_table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 6px;
}

.info_column {
  vertical-align: top;
  padding: 4px 14px 8px;
}

.course_info_table,
.workgroup_info_table {
  border-collapse: collapse;
  font-size: .87rem;
  color: var(--c-muted);
}
.course_info_table td,
.workgroup_info_table td {
  padding: 1px 6px 1px 0;
  vertical-align: top;
  border: none;
  background: transparent;
}

.course_time_table,
.workgroup_time_table {
  border-collapse: collapse;
  font-size: .87rem;
  color: var(--c-muted);
}
.course_time_table td,
.workgroup_time_table td {
  padding: 1px 8px 1px 0;
  vertical-align: top;
  border: none;
  background: transparent;
  white-space: nowrap;
}
.course_time_table td:first-child,
.workgroup_time_table td:first-child {
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
}

/* group_num badge inside course_info_table */
.group_num {
  display: inline-block;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-weight: 700;
  font-size: .82rem;
  border-radius: 4px;
  padding: 1px 8px;
}

/* ── Drag ghost ─────────────────────────────────────────────── */
.ghost {
  opacity: .5;
  border: 2px dashed var(--c-accent) !important;
  background: var(--c-accent-soft) !important;
}

/* ── Student data form ──────────────────────────────────────── */
div.fragen {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
}

.fragen table {
  width: auto;
  border-collapse: separate;
  border-spacing: 8px 10px;
  table-layout: auto;
}
.fragen table tr:nth-child(even),
.fragen table tr:nth-child(odd) {
  background: transparent;
}
.fragen td.label10 {
  font-weight: 600;
  font-size: .9rem;
  color: var(--c-muted);
  white-space: nowrap;
  width: auto;
  padding-right: 8px;
}
.fragen input[type="text"],
.fragen textarea {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font: inherit;
  font-size: .92rem;
  color: var(--c-text);
  background: var(--c-bg);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.fragen input[type="text"]:focus,
.fragen textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(58,127,168,.15);
  background: #fff;
}
.fragen textarea {
  resize: vertical;
  min-height: 70px;
}

/* ── Submit button ──────────────────────────────────────────── */
.submit_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-accent);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 11px 32px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .15s, box-shadow .15s, transform .1s;
  margin: 10px 0 20px;
}
.submit_button:hover  { background: #2d6a8e; box-shadow: var(--shadow-md); }
.submit_button:active { transform: scale(.97); }
.submit_button:disabled { opacity: .5; cursor: not-allowed; }

/* ── Response / confirmation page ──────────────────────────── */

/* Personal data summary table */
.summary-table {
  border-collapse: collapse;
  font-size: .9rem;
  margin-bottom: 16px;
  width: auto;
}
.summary-table td {
  padding: 3px 18px 3px 0;
  vertical-align: top;
  border: none;
  background: transparent;
}
.summary-table td:first-child {
  font-weight: 600;
  color: var(--c-muted);
  white-space: nowrap;
}

/* section headings on success/error pages */
.pref-section-heading {
  font-size: .92rem;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--c-border);
}

/* ── Global table defaults ───────────────────────────────────── */
/*
  The original CSS set table { table-layout:fixed; width:100% } globally
  which broke the inner course/time tables. We set a sane baseline instead:
  width and layout are opt-in at the component level.
*/
table {
  border-collapse: collapse;
  table-layout: auto;
  width: auto;
  /* reset row striping from original */
}
table tr:nth-child(even),
table tr:nth-child(odd) {
  background: transparent;
}
th { text-align: left; }
th, td { padding: 3px; }

/* ── Table utility classes (label10…label80) ─────────────────── */
/* Used in index_pre/post, submit_error, and legacy markup        */
th.label10, td.label10 { width: 10%; }
th.label20, td.label20 { width: 20%; }
th.label25, td.label25 { width: 25%; }
th.label33, td.label33 { width: 33%; }
th.label50, td.label50 { width: 50%; }
th.label75, td.label75 { width: 75%; }
th.label80, td.label80 { width: 80%; }
th.white,   td.white   { background: #ffffff; }
td.invis               { display: none; }
td.center              { text-align: center; }

/* ── form_remarks / anmerkung block ──────────────────────────── */
/*  The anmerkung.php include renders an <hr> + <p> block.
    Style it as a soft info callout.                             */
.anmerkung-wrap,
form .card hr + p,
form hr + p {
  background: var(--c-accent-soft);
  border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  font-size: .92rem;
  margin: 12px 0 16px;
}
form hr {
  margin: 16px 0 0;
}

/* ── Utility ─────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 20px 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  div.main          { padding: 0 10px 40px; }
  .card             { padding: 16px; }
  h1                { font-size: 1.2rem; }
  .fragen table     { border-spacing: 4px 8px; }
  
  /* Stack the counter badge above the content on narrow screens */
  #courses li,
  #workgroups li,
  #courses_saved li,
  #workgroups_saved li {
    flex-direction: column;
  }
  #courses li::before,
  #workgroups li::before,
  #courses_saved li::before,
  #workgroups_saved li::before {
    border-radius: 0;
    border-bottom-left-radius:  var(--radius);
    border-bottom-right-radius: var(--radius);
    padding: 6px;
    min-width: unset;
    font-size: 1rem;
  }
}

/* ── Pref badges ─────────────────────────────────────────────── */
/* produced by: <span class="courses_pref_num"> */
/* only needed for mail, hidden on page: <span class="courses_pref_num"> */
.courses_pref_num {
  display: none;
}
/* produced by: <span class="workgroups_pref_num"> */
/* only needed for mail, hidden on page: <span class="workgroups_pref_num"> */
.workgroups_pref_num {
  display: none;
}