/* app/css/screens-calendar.css — Calendar (.cal-*), test editor (.te-*), Profile (.pf-*)
   Owner: A4. Spec: docs/redesign/plan.md §2.6, §2.8; look: docs/redesign/mockups/05-calendar.html, 06-profile.html.
   Class contract: docs/tasks/redesign/README.md §4–§5. */

/* ── Calendar Screen ───────────────────────────────────────────────────────── */

.cal-page {
  /* Inherits .b-page */
}

.cal-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.cal-actions .b-btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 359px) {
  .cal-actions {
    flex-direction: column;
  }
  .cal-actions .b-btn {
    width: 100%;
  }
}

.cal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cal-li {
  margin: 0;
  padding: 0;
}

.cal-item {
  position: relative;
  border: var(--rule, 2.5px) solid var(--ink);
  border-left-width: 10px;
  border-left-color: var(--subject-accent, var(--fill-sand));
  border-radius: var(--radius, 7px);
  box-shadow: var(--shadow, 7px 7px 0 var(--ink));
  padding: 18px 18px 16px;
  background: var(--paper);
  box-sizing: border-box;
}

.cal-item__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cal-item__name {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 4px 0 8px;
}

.cal-item__when {
  font-size: 15px;
  color: var(--ink-2);
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-weight: 500;
}

.cal-item__count {
  margin: 8px 0 14px;
}

.cal-big {
  font-size: 34px;
  font-weight: 850;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.cal-big small {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 6px;
}

.cal-topics {
  list-style: none;
  padding: 0;
  margin: 12px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-topics li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cal-topics .b-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 6px 14px;
  font-size: 14px;
  text-decoration: none;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-weight: 700;
  box-sizing: border-box;
}

.cal-topics .b-pill:hover,
.cal-topics .b-pill:focus-visible {
  background: var(--ink);
  color: var(--on-ink);
}

.cal-item__progress {
  font-size: 14px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-weight: 700;
  margin: 8px 0 14px;
}

.cal-item__btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.cal-item__btns .b-btn {
  min-height: 48px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* EXAM card: the entire card is a button */
.cal-item--exam {
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: block;
  font-family: inherit;
  color: inherit;
  min-height: 48px;
}

.cal-item--exam:active {
  transform: translate(3px, 3px);
  box-shadow: var(--shadow-sm, 4px 4px 0 var(--ink));
}

/* ── Test Editor Sheet (.te-*) ─────────────────────────────────────────────── */

.te-sheet {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 22px 20px 16px;
  background: var(--paper);
  border: var(--rule, 2.5px) solid var(--ink);
  border-radius: var(--radius, 7px) var(--radius, 7px) 0 0;
  box-shadow: var(--shadow, 7px 7px 0 var(--ink));
  max-height: 88vh;
  overflow-y: auto;
}

.te-sheet .b-h2 {
  margin: 0 0 18px;
}

.te-field {
  margin-bottom: 16px;
  border: 0;
  padding: 0;
}

.te-subjects-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.te-subject-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  position: relative;
}

.te-subject-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.te-subject-label:has(input:checked),
.te-subject-label.is-checked {
  background: var(--ink);
  color: var(--on-ink);
}

.te-datetime-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.te-datetime-row > .b-field {
  flex: 1;
  min-width: 130px;
}

.te-topics {
  max-height: 45vh;
  overflow-y: auto;
  padding: 8px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-2);
  margin-bottom: 16px;
}

.te-ch {
  margin-bottom: 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 4px 10px;
}

.te-ch summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  cursor: pointer;
  font-weight: 800;
  font-size: 16px;
}

.te-units {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.te-unit-label {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
}

.te-ch-box,
.te-unit-box {
  width: 22px;
  height: 22px;
  accent-color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.te-counter {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin: 4px 0 8px;
}

.te-error {
  font-size: 14px;
  color: var(--ink);
  background: var(--fill-rose);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm, 6px);
  padding: 8px 12px;
  margin: 6px 0 10px;
  font-weight: 700;
  line-height: 1.3;
}

.te-actions {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding: 12px 0 8px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 2px solid var(--ink);
  margin-top: 16px;
  z-index: 10;
}

.te-actions .b-btn {
  min-height: 48px;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Profile Screen (.pf-*) ────────────────────────────────────────────────── */

.pf-page {
  /* Inherits .b-page */
}

.pf-list {
  border: var(--rule, 2.5px) solid var(--ink);
  border-radius: var(--radius, 7px);
  box-shadow: var(--shadow, 7px 7px 0 var(--ink));
  background: var(--paper);
  margin-bottom: 22px;
  overflow: hidden;
}

.pf-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--ink);
  min-height: 52px;
  box-sizing: border-box;
}

.pf-row:last-child {
  border-bottom: 0;
}

.pf-row b {
  font-weight: 800;
  font-size: 17px;
}

.pf-row .sub {
  font-size: 14px;
  color: var(--ink-2);
  margin-top: 2px;
}

.pf-big {
  font-weight: 850;
  font-size: 34px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

.pf-big small {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pf-seg {
  display: flex;
  border: 2px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
}

.pf-seg button {
  font-weight: 800;
  font-size: 14px;
  padding: 0 14px;
  min-height: 48px;
  border: 0;
  border-right: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.pf-seg button:last-child {
  border-right: 0;
}

.pf-seg button[aria-checked="true"],
.pf-seg button.is-active {
  background: var(--ink);
  color: var(--on-ink);
}

/* ── Sheet slide-in (.is-open) ─────────────────────────────────────────────── */
/* The base .b-sheet-backdrop rule lives in brutal.css. This only adds "hidden until JS adds .is-open".
   .pdf-modal (js/pdf.js) never gets .is-open, so it is left out and shows as soon as it is added. */

.b-sheet-backdrop:not(.pdf-modal) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.b-sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.b-sheet-backdrop:not(.pdf-modal) .b-sheet {
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.b-sheet-backdrop.is-open .b-sheet {
  transform: translateY(0);
}
