/* components.css — shared component styles. */

/* Card */
.card {
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.card.placeholder { color: var(--color-muted); font-style: italic; }
.card h2, .card h3 { margin-top: 0; }

/* Inline helpers */
.muted   { color: var(--color-muted); }
.right   { text-align: right; }
.row     { display: flex; gap: .75rem; align-items: center; }
.row > * { min-width: 0; }
.stack > * + * { margin-top: .75rem; }

/* Buttons */
.btn {
  display: inline-block;
  min-height: 44px;
  padding: .5rem 1rem;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost {
  background: transparent;
  color: var(--color-primary);
}
.btn--danger {
  border-color: var(--color-error);
  background: var(--color-error);
}
.btn--full { width: 100%; display: block; }

/* Form inputs */
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  color: inherit;
  font: inherit;
}
.textarea { min-height: 96px; resize: vertical; }
.field    { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: .25rem;
}
.field .hint {
  font-size: .85rem;
  color: var(--color-muted);
  margin-top: .25rem;
}

/* Alerts / banners */
.alert {
  border-left: 4px solid var(--color-warn);
  padding-left: .75rem;
  background: var(--color-warn-bg);
}
.alert--error   { border-left-color: var(--color-error);   background: var(--color-error-bg); }
.alert--success { border-left-color: var(--color-success); background: var(--color-success-bg); }

/* List items */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 0;
  border-bottom: 1px solid var(--color-divider);
  gap: .75rem;
}
.list-item:last-child { border-bottom: none; }
.list-item a { color: inherit; text-decoration: none; }

/* Pills / badges */
.pill {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  background: var(--color-bg-soft);
  color: var(--color-muted);
}
.pill--success { background: var(--color-success-bg); color: var(--color-success); }
.pill--warn    { background: var(--color-warn-bg);    color: var(--color-warn); }
.pill--draft   { background: var(--color-bg-soft);    color: var(--color-muted); }
.pill--signed  { background: var(--color-success-bg); color: var(--color-success); }
.pill--pending { background: var(--color-warn-bg);    color: var(--color-warn); }

/* Progress */
.progress {
  height: 6px;
  background: var(--color-bg-soft);
  border-radius: 3px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--color-primary);
  transition: width .2s;
}
.progress-tile {
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
}
.progress-tile .label { font-size: .85rem; color: var(--color-muted); }
.progress-tile .count { font-size: 1.25rem; font-weight: 600; }

/* Floating action button */
.fab {
  position: fixed;
  right: 1rem;
  bottom: 4.5rem;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
@media (min-width: 768px) {
  /* On tablet/desktop the floating bottom-right FAB sits far from the
   * centred 960px content column — the user perceives it as missing.
   * Each list screen also renders a `.add-action` inline primary button
   * next to the title; we hide the FAB at this breakpoint so we have a
   * single, predictable affordance per breakpoint. */
  .fab { display: none; }
}

/* Inline "+ Neuer …" primary button rendered at the top of each list
 * screen. Hidden on phones — the .fab takes its place there. */
.add-action { display: none; }
@media (min-width: 768px) {
  .add-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-left: auto;        /* push to the right of a flex header row */
    white-space: nowrap;
  }
}

/* Flex container for screen titles paired with an action button.
 * Use as: <div class="screen-header"><h1>…</h1><button class="btn add-action">…</button></div> */
.screen-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin: 0 0 .5rem 0;
}
.screen-header h1 { margin: 0; }

/* Toast / snackbar — non-blocking save feedback. See components/toast.js
 * On phones lifted above the bottom-nav (56px + gap); on tablet/desktop
 * (where the bottom-nav is hidden) it sits at bottom-right of viewport. */
.toast {
  position: fixed;
  right: 1rem;
  bottom: calc(56px + 1rem);
  z-index: 250;
  max-width: 90vw;
  padding: .7rem 1rem;
  border-radius: 6px;
  font-size: .95rem;
  color: #fff;
  background: #2c2f33;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.toast--show       { opacity: 1; transform: translateY(0); }
.toast--success    { background: #00702e; }            /* matches alert--success */
.toast--error      { background: #c00018; }
.toast--info       { background: #2c2f33; }
@media (min-width: 768px) {
  .toast { bottom: 1.25rem; right: 1.25rem; }
}

/* Likert rows — 5-button radio group for feedback rating scales.
 * Each <fieldset> renders a labelled row of 5 mutually-exclusive
 * buttons that visually highlight the selected value. Radio input is
 * visually hidden but still focusable for keyboard / screen-reader use. */
.likert-row {
  margin: .75rem 0;
  border: none;
  padding: 0;
}
.likert-row legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: .35rem;
}
.likert-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .25rem;
}
.likert-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  background: var(--color-bg);
  color: var(--color-fg);
  font-weight: 500;
  user-select: none;
}
.likert-btn input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.likert-btn:hover         { border-color: var(--color-primary); }
.likert-btn:has(input:checked) {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.likert-btn:has(input:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.likert-row .likert-hint {
  font-size: .8rem;
  color: var(--color-muted);
  margin-top: .25rem;
}

/* Feedback-form upload thumbnail. The <img> source is set lazily after
 * a Bearer-authenticated fetch (see feedback-form.js::renderThumbnail). */
.feedback-thumb-box     { margin: .5rem 0 1rem; }
.feedback-thumb-link    { display: inline-block; }
.feedback-thumb {
  max-width: 100%;
  max-height: 240px;
  border-radius: 6px;
  display: block;
  border: 1px solid var(--color-border);
}

/* Persönliche-Lernziele list rows: a tick checkbox left of the label,
 * with the body clickable to open the edit form. */
.goal-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.goal-tick {
  flex: 0 0 auto;
  margin-top: .2rem;
  width: 22px; height: 22px;
  cursor: pointer;
}
.goal-body {
  flex: 1 1 auto;
  cursor: pointer;
  min-width: 0;
}
.goal-label { white-space: normal; }
.goal-meta  { margin-top: .25rem; }

/* Pre-v0.7 "Bestands-Eintrag" block on meeting forms — visually marked
 * so the student knows it's a legacy single-textarea entry that will be
 * replaced by the new structured fields above on first save. Includes a
 * "Löschen" button to discard explicitly. */
.legacy-field {
  border-left: 3px solid var(--color-muted);
  padding-left: .75rem;
  margin-top: 1rem;
  background: rgba(0,0,0,.02);
}
.legacy-field label { color: var(--color-muted); }

.btn--small {
  padding: .25rem .5rem;
  font-size: .85rem;
  min-height: 0;
}

/* When a <button> uses the .list-item class (action rows in the Mehr hub
 * that don't navigate but instead POST), strip native button styling so
 * it visually matches the anchor rows next to it. */
button.list-item {
  appearance: none;
  background: none;
  border: none;
  padding: inherit;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  width: 100%;
}
button.list-item:disabled { opacity: .6; cursor: not-allowed; }

/* Danger-zone card on /profile — DSGVO self-erasure (Konto löschen). */
.danger-zone           { border: 1px solid #c00018; }
.danger-zone h2        { color: #c00018; margin-top: 0; }
.danger-panel          { margin-top: .75rem; }
.danger-panel code     { background: rgba(0,0,0,.06); padding: 0 .3rem; border-radius: 3px; }

/* Segmented control (used for mode toggles, sub-tabs) */
.segmented {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
}
.segmented button {
  border: none;
  background: var(--color-bg);
  color: var(--color-fg);
  padding: .5rem 1rem;
  cursor: pointer;
  min-height: 40px;
  font: inherit;
}
.segmented button[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
}

/* Locked banner */
.locked-banner {
  background: var(--color-bg-soft);
  border: 1px dashed var(--color-border);
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
  color: var(--color-muted);
}

/* Signature card */
.signature-card .methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  margin-top: .75rem;
}
@media (min-width: 768px) {
  .signature-card .methods {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 1em; height: 1em;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Placement-context label in topbar */
.topbar .placement-context {
  display: inline-block;
  padding: .25rem .5rem;
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
  cursor: pointer;
  font-size: .85rem;
}
.topbar .placement-context:hover, .topbar .placement-context:focus-visible {
  background: rgba(255,255,255,.22);
}

/* Placement switcher menu */
.placement-menu {
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  padding: .25rem;
  display: flex;
  flex-direction: column;
}
.placement-menu__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--color-fg);
  padding: .65rem .75rem;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
}
.placement-menu__item:hover,
.placement-menu__item:focus-visible {
  background: var(--color-bg-soft);
  outline: none;
}
.placement-menu__item.is-active {
  font-weight: 600;
  color: var(--color-primary);
}
.placement-menu__main { flex: 1; }
.placement-menu__meta {
  font-size: .8rem;
  color: var(--color-muted);
}
.placement-menu__item--new {
  margin-top: .25rem;
  border-top: 1px solid var(--color-divider);
  color: var(--color-primary);
}

/* Dashboard */
.dash-tertial {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 1rem;
  background: var(--color-bg-soft);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.dash-tertial h2 {
  margin: 0 0 .25rem;
  font-size: 1.1rem;
}
.dash-tertial .right { text-align: right; }
.dash-tertial .week  {
  font-size: .85rem;
  color: var(--color-muted);
  margin-top: .25rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
@media (min-width: 768px) {
  .dash-grid { grid-template-columns: repeat(4, 1fr); }
}
.progress-tile-link {
  text-decoration: none;
  color: inherit;
}
.progress-tile-link:hover .progress-tile {
  border-color: var(--color-primary);
}

/* Missing list */
.missing-list .list-item .pill { margin-right: .5rem; }
.missing-list .list-item:hover  { background: var(--color-bg-soft); }

/* Inbox list */
.inbox-list .list-item:hover { background: var(--color-bg-soft); }
