/* Elternsprechtag erstellen / Weitere Einstellungen (Präfix .evt-)
   und Kalender-Komponente js/components/calendar-picker.js (Präfix .calp-) */

/* ---------- Seite ---------- */

.evt-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* [hidden] muss auch bei Bausteinen mit eigener display-Angabe (z. B. .btn) gelten */
.evt-page [hidden] {
  display: none !important;
}
.evt-page > .page-header {
  margin-bottom: 4px;
}
.evt-page > .back-link {
  margin-bottom: -8px;
  align-self: flex-start;
}
.evt-page .page-header .subtitle {
  max-width: 760px;
}

.evt-summary {
  scroll-margin-top: 140px;
}
.evt-summary:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus);
}
.evt-summary p {
  margin-bottom: 6px;
}
.evt-summary-list {
  margin: 0;
  padding-left: 20px;
}
.evt-summary-link {
  font: inherit;
  color: var(--c-danger);
  background: none;
  border: 0;
  padding: 2px 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  vertical-align: top;
  cursor: pointer;
}
.evt-summary-link:hover {
  color: #8f1f1f;
}

.evt-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Schrittnummer als kleines gelbes Schild */
.evt-step {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-small);
  background: var(--c-accent);
  color: var(--c-ink);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}
.evt-card-intro {
  margin-bottom: 16px;
}

/* ---------- Tage: Kalender links, Liste rechts ---------- */

.evt-days-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 24px 32px;
  align-items: start;
}
@media (max-width: 860px) {
  .evt-days-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .evt-calendar-col {
    display: flex;
    justify-content: center;
  }
}

.evt-list-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  container-type: inline-size;
}
.evt-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  flex-wrap: wrap;
}
.evt-list-title {
  margin: 0;
}
.evt-list-title:focus {
  outline: none;
}
.evt-list-title:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus);
  border-radius: 4px;
}
.evt-day-count {
  margin: 0;
  color: var(--c-muted);
  font-size: 0.9rem;
}
.evt-empty {
  padding: 28px 16px;
}
.evt-copy {
  align-self: flex-start;
  white-space: normal;
  text-align: left;
}

.evt-day-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.evt-day {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    'head times remove'
    'error error error';
  align-items: center;
  gap: 6px 16px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--c-surface-2);
}
.evt-day-invalid {
  border-color: #f1b9b9;
  background: var(--c-danger-soft);
}
.evt-day-head {
  grid-area: head;
  min-width: 0;
}
.evt-day-title {
  font-weight: 700;
}
.evt-day-info {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--c-muted);
}
.evt-day-times {
  grid-area: times;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.evt-time {
  gap: 2px;
}
.evt-time > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-muted);
}
.evt-time input[type='time'] {
  width: 144px;
  min-height: 40px;
  padding: 6px 8px 6px 10px;
}
.evt-day-sep {
  padding-bottom: 9px;
  color: var(--c-muted);
  font-size: 0.9rem;
}
.evt-day-remove {
  grid-area: remove;
  align-self: center;
  gap: 6px;
  color: var(--c-muted);
}
.evt-day-remove:hover:not(:disabled) {
  color: var(--c-danger);
  background: var(--c-danger-soft);
}
.evt-day-error {
  grid-area: error;
  font-weight: 600;
}
.evt-days-error {
  font-weight: 600;
}

/* Schmale Liste (Smartphone, Tablet, kleiner Laptop): Uhrzeiten in eigener Zeile,
   damit Datum und Terminanzahl nicht in eine schmale Spalte gequetscht werden */
@container (max-width: 700px) {
  .evt-day {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'head remove'
      'times times'
      'error error';
  }
  .evt-day-times {
    gap: 10px;
  }
  .evt-day-times > .evt-time {
    flex: 1 1 0;
    min-width: 0;
    max-width: 240px;
  }
  .evt-day-sep {
    display: none;
  }
  .evt-time input[type='time'] {
    width: 100%;
  }
  .evt-day-remove {
    align-self: start;
  }
}
/* Smartphone: Entfernen-Knopf als kompaktes Symbol, damit das Datum in eine Zeile passt */
@container (max-width: 440px) {
  .evt-day-remove {
    align-self: start;
    width: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 1rem;
  }
  .evt-day-remove-text {
    display: none;
  }
}

/* ---------- Aktionen ---------- */

.evt-actions {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
}
.evt-dirty {
  color: var(--c-warning);
  font-weight: 600;
  font-size: 0.9rem;
}
.evt-dirty:empty {
  display: none;
}
.evt-dirty-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.evt-discard {
  color: var(--c-muted);
}
@media (max-width: 560px) {
  .evt-actions > .btn {
    width: 100%;
    white-space: normal;
  }
}

/* ---------- Einstellungen: Profil und Gefahrenbereich ---------- */

.evt-extra {
  margin-top: 16px;
  align-items: start;
}
.evt-profile {
  margin: 0 0 12px;
  display: grid;
  /* Beschriftung so breit wie nötig, damit die Codes nicht mitten im Code umbrechen */
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  align-items: baseline;
}
.evt-profile-row {
  display: contents;
}
.evt-profile dt {
  color: var(--c-muted);
  font-weight: 600;
  font-size: 0.9rem;
}
.evt-profile dd {
  margin: 0;
  font-weight: 600;
  min-width: 0;
}
@media (max-width: 420px) {
  .evt-profile {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .evt-profile dd {
    margin-bottom: 8px;
  }
}
.evt-danger {
  background: var(--c-danger-soft);
}
.evt-danger > h2 {
  color: var(--c-danger);
}
.evt-danger .btn-danger {
  white-space: normal;
  text-align: left;
}
.evt-affected {
  margin: 0;
  padding-left: 20px;
  font-size: 0.95rem;
}

/* ---------- Kalender (calendar-picker) ---------- */

.calp {
  width: 100%;
  max-width: 360px;
}
.calp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.calp-title {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}
.calp-nav {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-small);
  border: 2px solid var(--c-ink);
  background: var(--c-surface);
  color: var(--c-ink);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}
.calp-nav:hover:not(:disabled) {
  background: var(--c-accent-soft);
}
.calp-nav:active:not(:disabled) {
  transform: scale(0.95);
}
.calp-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
/* Punkt: im vorherigen/nächsten Monat sind Tage ausgewählt */
.calp-nav.calp-nav-has::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-primary);
}
.calp-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 3px;
}
.calp-grid th {
  padding: 4px 0;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--c-muted);
}
.calp-grid th.calp-weekend {
  color: #5d6b6a;
}
.calp-grid td {
  padding: 0;
  text-align: center;
}
.calp-day {
  position: relative;
  width: 100%;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-small);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition:
    background-color var(--dur-press) var(--ease-out),
    border-color var(--dur-press) var(--ease-out),
    color var(--dur-press) var(--ease-out);
}

.calp-day.calp-weekend {
  background: var(--c-surface-2);
  border-color: transparent;
  color: var(--c-muted);
  font-weight: 500;
}

.calp-day.calp-today {
  border: 2px solid var(--c-accent-border);
}
.calp-day.calp-today::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--c-accent-border);
}
.calp-day[aria-pressed='true'] {
  background: var(--c-wall);
  border-color: var(--c-wall-dark);
  color: #fff;
  font-weight: 700;
}

.calp-day[aria-pressed='true'].calp-today {
  border-color: var(--c-accent);
}
.calp-day[aria-disabled='true'] {
  background: transparent;
  border-color: transparent;
  color: #a3b1af;
  font-weight: 400;
  cursor: not-allowed;
}
/* Hover nur bei Maus/Trackpad – auf Touch-Geräten bliebe der Effekt nach dem Tippen „kleben“ */
@media (hover: hover) {
  .calp-day:hover,
  .calp-day.calp-weekend:hover {
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
  }
  .calp-day.calp-today:hover {
    border-color: var(--c-accent-border);
  }
  .calp-day[aria-pressed='true']:hover {
    background: var(--c-primary-dark);
    border-color: var(--c-primary-dark);
  }
  .calp-day[aria-pressed='true'].calp-today:hover {
    border-color: var(--c-accent);
  }
  .calp-day[aria-disabled='true']:hover {
    background: transparent;
    border-color: transparent;
  }
}
.calp-day:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  z-index: 1;
  box-shadow: var(--focus);
}
.calp-legend {
  margin-top: 8px;
  justify-content: center;
  font-size: 0.8rem;
}
.calp-swatch-selected {
  background: var(--c-wall);
}
.calp-swatch-today {
  background: var(--c-surface);
  border: 2px solid var(--c-accent-border);
}
.calp-swatch-weekend {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
}
@media (max-width: 400px) {
  .calp-grid {
    border-spacing: 2px;
  }
  .calp-day {
    height: 40px;
  }
}

/* Hinweis auf einem neuen Gerät: Zwischenstand laden statt alles neu einzugeben */
.evt-empty-device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.evt-empty-device p {
  flex: 1 1 320px;
  margin: 0;
}

/* ---------- Einstellungen: digitaler Briefkasten ---------- */

.evt-mailbox {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.evt-mailbox > p,
.evt-mailbox .alert p {
  margin: 0;
}
.evt-mailbox .alert {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.evt-mailbox-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.evt-mailbox-head h2 {
  margin: 0;
}
.evt-mailbox-facts {
  margin: 0;
}
.evt-mailbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.evt-mailbox-actions .btn {
  white-space: normal;
  text-align: center;
}
.evt-mailbox-status:empty {
  display: none;
}
.evt-mailbox-status .alert {
  display: block;
}
.evt-mailbox-status .alert p + p {
  margin-top: 6px;
}
/* Knopf, an dem gerade etwas läuft: nicht verblasst, aber gesperrt */
.evt-page .btn.evt-busy {
  opacity: 1;
  cursor: progress;
}
/* Auf hellen Knöpfen ist der weiße Ring des Standard-Spinners nicht sichtbar */
.evt-page .btn-secondary .evt-spinner {
  width: 16px;
  height: 16px;
  border-color: var(--c-border);
  border-top-color: currentColor;
}
@media (max-width: 560px) {
  .evt-mailbox-actions .btn {
    width: 100%;
  }
}
