/* CampusNav "My timetable" panel (js/timetable-panel.js).
   Uses the index.html design tokens when present; the fallbacks keep it usable on its own.
   Logical properties only, so the same rules serve RTL (he, ar) and LTR (en, fr). */

.tp {
  --tp-ink: var(--ink, #15202B);
  --tp-ink-2: var(--ink-2, #2E3A47);
  --tp-muted: var(--muted, #56616D);
  --tp-rule: var(--rule, #D5DBE0);
  --tp-rule-strong: var(--rule-strong, #B7C0C8);
  --tp-ground: var(--ground, #EDF0F2);
  --tp-paper: var(--paper, #FFFFFF);
  --tp-origin: var(--origin, #1C7A50);
  --tp-transfer: var(--transfer, #4F3FC4);
  --tp-error: var(--error, #B42318);
  --tp-error-bg: var(--error-bg, #FDEDEB);
  --tp-warn: #8A4B00;
  --tp-warn-bg: #FFF4DC;
  --tp-focus: var(--focus, #2F6690);
  font-family: var(--font, system-ui, sans-serif);
  color: var(--tp-ink);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.tp [hidden] { display: none !important; }
.tp :focus-visible { outline: 3px solid var(--tp-focus); outline-offset: 2px; }

.tp-title { margin: 0; font-size: 1.25rem; font-weight: 600; }

.tp-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 18px;
  border: 2px dashed var(--tp-rule-strong);
  border-radius: 8px;
  background: var(--tp-paper);
}
.tp-drop.tp-over { border-color: var(--tp-ink); background: var(--tp-ground); }
.tp-drop-text { margin: 0; flex: 1 1 220px; font-size: .9375rem; }

.tp-choose {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--tp-ink);
  color: #fff;
  font-weight: 500;
  font-size: .875rem;
  cursor: pointer;
}
.tp-choose:focus-within { outline: 3px solid var(--tp-focus); outline-offset: 2px; }
/* Visually hidden but focusable and operable by keyboard and screen readers. */
.tp-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.tp-hint { margin: 0; font-size: .8125rem; color: var(--tp-muted); }

.tp-status:empty { display: none; }
.tp-status p { margin: 0; }
.tp-loading { color: var(--tp-ink-2); font-size: .875rem; }
.tp-error {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--tp-error-bg);
  color: var(--tp-error);
  font-size: .875rem;
}
.tp-summary { font-weight: 600; font-size: .9375rem; }
.tp-file { margin-top: 2px !important; font-size: .75rem; color: var(--tp-muted); overflow-wrap: anywhere; }

.tp-body { display: flex; flex-direction: column; gap: 14px; }
.tp-body:empty { display: none; }

.tp-notice { padding: 12px 14px; border-radius: 8px; font-size: .8125rem; }
.tp-notice p { margin: 0; }
.tp-notice p + p { margin-top: 4px; }
.tp-notice-warn { background: var(--tp-warn-bg); color: var(--tp-warn); }
.tp-notice-title { font-weight: 600; }
.tp-notice summary { cursor: pointer; font-weight: 600; }
.tp-warnings { margin: 8px 0 0; padding-inline-start: 18px; }

.tp-day-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--tp-ink);
  font-size: .9375rem;
  font-weight: 600;
}
.tp-today .tp-day-title { border-bottom-color: var(--tp-origin); }
.tp-today-badge {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--tp-origin);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
}

.tp-sessions { list-style: none; margin: 0; padding: 0; }
.tp-session {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--tp-rule);
  font-size: .875rem;
}
.tp-flagged { background: var(--tp-warn-bg); }
.tp-time { font-variant-numeric: tabular-nums; white-space: nowrap; unicode-bidi: isolate; }
.tp-course { display: flex; flex-direction: column; min-width: 0; }
.tp-course-name { font-weight: 500; overflow-wrap: anywhere; }
.tp-course-meta { font-size: .75rem; color: var(--tp-muted); }
.tp-where { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tp-room { font-weight: 600; }
.tp-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--tp-ground);
  color: var(--tp-muted);
}
.tp-mapped { background: #E7F4EE; color: var(--tp-origin); }
.tp-online { background: #ECEAFB; color: var(--tp-transfer); }
.tp-warn { background: var(--tp-paper); color: var(--tp-warn); box-shadow: inset 0 0 0 1.5px var(--tp-warn); }

.tp-nav, .tp-clear {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
}
.tp-nav { border: 1px solid var(--tp-ink); background: var(--tp-paper); color: var(--tp-ink); }
.tp-nav:hover { background: var(--tp-ground); }
.tp-clear {
  align-self: flex-start;
  border: 1px solid var(--tp-rule-strong);
  background: var(--tp-paper);
  color: var(--tp-ink);
}
.tp-clear:hover { background: var(--tp-ground); }

/* Narrow containers and phones: stack each session. */
@media (max-width: 600px) {
  .tp-session {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "time action" "course action" "where action";
  }
  .tp-time { grid-area: time; font-weight: 600; }
  .tp-course { grid-area: course; }
  .tp-where { grid-area: where; }
  .tp-nav { grid-area: action; }
}

@media (prefers-reduced-motion: reduce) {
  .tp * { transition: none !important; animation: none !important; }
}
