/**
 * campus.css — Trouver ma salle (T31)
 *
 * Panneau plein écran ouvert depuis le tag lieu d'une carte échéance.
 * Pattern : overlay fixed, slide-up entrance, navigation par onglets
 * type Linear/Notion. Utilise les tokens sémantiques --color-*.
 */

.campus-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--color-surface);
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.campus-overlay.open {
  display: block;
  animation: campusSlideUp .28s cubic-bezier(.2, .8, .2, 1);
}

@keyframes campusSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .campus-overlay.open { animation: none; }
}

.campus-panel {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 32px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 720px) {
  .campus-panel { padding: 0 24px 40px; }
}

/* ─── Topbar : bouton Retour + titre ────────────────────────────── */

.campus-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 14px;
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 5;
  border-bottom: 1px solid var(--border);
}

.campus-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface-soft);
  border: 0;
  color: var(--color-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .15s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
  flex-shrink: 0;
}

.campus-back:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  transform: translateX(-2px);
}

.campus-title-block {
  flex: 1;
  min-width: 0;
}

.campus-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 4vw, 22px);
  color: var(--color-text);
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campus-subtitle {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Onglets ───────────────────────────────────────────────────── */

.campus-tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 0;
}

.campus-tabs::-webkit-scrollbar { display: none; }

.campus-tab {
  background: var(--color-surface-soft);
  border: 0;
  color: var(--color-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
  flex-shrink: 0;
}

.campus-tab:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  transform: scale(1.04);
}

.campus-tab.active {
  background: var(--color-primary-strong);
  color: #fff;
}

/* ─── Zone contenu ──────────────────────────────────────────────── */

.campus-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.campus-tab-body {
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  animation: campusFadeIn .25s ease;
}

@keyframes campusFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .campus-tab-body { animation: none; }
}

/* ─── Onglet Indice ─────────────────────────────────────────────── */

.campus-tab-body--indice {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.campus-indice-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.campus-indice-text {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(18px, 4vw, 22px);
  line-height: 1.4;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin: 0;
}

.campus-indice-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

@media (min-width: 540px) {
  .campus-indice-meta { grid-template-columns: 1fr 1fr; }
}

.campus-indice-meta > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.campus-indice-meta dt {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.campus-indice-meta dd {
  font-size: 14px;
  color: var(--color-text);
  margin: 0;
  font-weight: 500;
}

/* ─── Onglet Plan SVG ───────────────────────────────────────────── */

.campus-tab-body--plan {
  padding: 16px;
  background: var(--color-surface-soft);
}

.campus-plan-svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  overflow: visible;
}

/* Salle cible : pulse subtil pour attirer l'oeil sans agresser. */
.campus-plan-room--target rect {
  animation: campusTargetPulse 2s ease-in-out infinite;
}

@keyframes campusTargetPulse {
  0%, 100% { stroke-width: 2; filter: drop-shadow(0 0 0 transparent); }
  50%      { stroke-width: 2.5; filter: drop-shadow(0 0 8px var(--color-primary)); }
}

/* Chemin pointillé entrée → salle : animation de dessin. */
.campus-plan-route {
  stroke-dasharray: 6 5;
  animation: campusRouteDraw 1.6s cubic-bezier(.2, .8, .2, 1) .2s both,
             campusRouteFlow 1.4s linear 1.8s infinite;
}

@keyframes campusRouteDraw {
  from { stroke-dashoffset: 480; opacity: 0; }
  to   { stroke-dashoffset: 0;   opacity: 1; }
}

@keyframes campusRouteFlow {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -22; }
}

@media (prefers-reduced-motion: reduce) {
  .campus-plan-room--target rect,
  .campus-plan-route {
    animation: none;
  }
}

html.low-bandwidth .campus-plan-room--target rect,
html.low-bandwidth .campus-plan-route {
  animation: none;
}

/* ─── États empty / unknown / home ─────────────────────────────── */

.campus-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 40px 20px 32px;
  gap: 14px;
}

.campus-empty-icon {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  background: var(--color-surface-soft);
  color: var(--color-muted);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}

.campus-empty-state h2 {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 4.4vw, 24px);
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.01em;
  max-width: 480px;
}

.campus-empty-state p {
  font-size: 14px;
  color: var(--color-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 480px;
}

.campus-search {
  width: 100%;
  max-width: 480px;
  margin-top: 12px;
  background: var(--color-surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--color-text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.campus-search:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
}

.campus-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campus-search-item {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--color-text);
  transition: border-color .15s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
}

.campus-search-item:hover {
  border-color: var(--color-primary);
  transform: translateX(2px);
}

.campus-search-item strong {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-text);
}

.campus-search-item span {
  font-size: 12px;
  color: var(--color-muted);
}

/* ─── Bouton lieu cliquable dans la hero card ──────────────────── */

.exam-hero-location {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface-soft);
  border: 1px solid var(--border);
  color: var(--color-text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 4px;
  transition: background-color .15s ease,
              border-color .15s ease,
              transform .18s cubic-bezier(.2, .8, .2, 1);
}

.exam-hero-location:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.exam-hero-location svg {
  flex-shrink: 0;
}

.exam-hero-location-arrow {
  margin-left: 2px;
  opacity: 0.6;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}

.exam-hero-location:hover .exam-hero-location-arrow {
  transform: translateX(3px);
  opacity: 1;
}

/* Sur la card secondaire : version compacte dans le bas (ne casse
   pas le layout horizontal time/progress/pct). */
.exam-card-location {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 0;
  padding: 4px 6px;
  margin-top: 6px;
  color: var(--color-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  align-self: flex-start;
  transition: background-color .15s ease, color .15s ease;
  text-align: left;
}

.exam-card-location:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.exam-card-location svg {
  flex-shrink: 0;
}
