/**
 * ADExploit Companion - Vector Grid Styles (ADE Faithful Layout)
 */

.ade-grid-wrapper {
  position: relative;
  display: inline-block;
  min-width: 100%;
  user-select: none;
}

/* 1. HEADER ROW (Sticky Top) */
.ade-grid-header-row {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.ade-corner-cell {
  position: sticky;
  left: 0;
  z-index: 35;
  background: var(--bg-secondary);
  border-right: 2px solid var(--border-color);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}

.corner-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.corner-day {
  font-size: 9.5px;
  color: #38bdf8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ade-time-slots-header {
  display: flex;
  flex-shrink: 0;
}

.ade-time-slot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  border-right: 1px dotted rgba(255, 255, 255, 0.08);
  height: 28px;
  flex-shrink: 0;
}

.ade-time-slot.full-hour {
  color: var(--text-primary);
  font-weight: 800;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
}

body.theme-light .ade-time-slot {
  border-right: 1px dotted rgba(0, 0, 0, 0.12);
}
body.theme-light .ade-time-slot.full-hour {
  border-right: 1px solid rgba(0, 0, 0, 0.22);
}

/* 2. GRID BODY & ROWS */
.ade-grid-body {
  position: relative;
  display: flex;
  flex-direction: column;
}

.ade-room-row {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  background: var(--bg-primary);
}

.ade-room-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

body.theme-light .ade-room-row:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

/* SÉPARATEURS BÂTIMENTS */
.ade-room-row.building-separator {
  border-top: 3px solid #0284c7 !important;
}

/* CELLULE AUDITOIRE STICKY GAUCHE */
.ade-room-header-cell {
  position: sticky;
  left: 0;
  z-index: 15;
  background: var(--bg-secondary);
  border-right: 2px solid var(--border-color);
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
}

.room-label {
  font-size: 11.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MINI BADGE APREM SOUS LE NOM DE SALLE (Option A) */
.room-afternoon-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.85);
  margin-top: 2px;
  line-height: 1;
  text-transform: uppercase;
}
.room-afternoon-badge.mc { background: #dc2626; }
.room-afternoon-badge.mb { background: #ea580c; }
.room-afternoon-badge.retrans { background: #7c3aed; }

/* PISTE TEMPORELLE DES COURS */
.ade-room-track {
  position: relative;
  height: 100%;
  flex-shrink: 0;
}

/* LIGNES VERTICALES DES HEURES */
.ade-hour-lines-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ade-v-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
}

.ade-v-line.full-hour {
  border-left: 1px dashed rgba(255, 255, 255, 0.1);
}
.ade-v-line.half-hour {
  border-left: 1px dotted rgba(255, 255, 255, 0.05);
}

body.theme-light .ade-v-line.full-hour {
  border-left: 1px dashed rgba(0, 0, 0, 0.15);
}
body.theme-light .ade-v-line.half-hour {
  border-left: 1px dotted rgba(0, 0, 0, 0.08);
}

/* 3. BLOC DE COURS */
.ade-event-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 4px;
  background: #1e293b;
  border: 1px solid #475569;
  padding: 2px 4px;
  overflow: hidden;
  cursor: pointer;
  z-index: 10;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s ease;
}

.ade-event-block:active {
  transform: scale(0.98);
}

body.theme-light .ade-event-block {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* SURCOUCHE MC / MB */
.ade-event-block.event-mc {
  border: 2.5px solid #dc2626 !important;
  background: rgba(220, 38, 38, 0.18) !important;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.35);
}

body.theme-light .ade-event-block.event-mc {
  background: #fff1f2 !important;
}

/* SURCOUCHE RETRANSMISSION */
.ade-event-block.event-retrans {
  border: 2px solid #7c3aed !important;
  background: rgba(124, 58, 237, 0.16) !important;
}

body.theme-light .ade-event-block.event-retrans {
  background: #f5f3ff !important;
}

.event-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  line-height: 1.15;
}

.event-code {
  font-size: 10.5px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-light .event-code {
  color: #0f172a;
}

.event-prof {
  font-size: 9px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

body.theme-light .event-prof {
  color: #475569;
}

.event-mc-badge {
  align-self: flex-start;
  font-size: 8px;
  font-weight: 900;
  background: #dc2626;
  color: #ffffff;
  padding: 1px 3px;
  border-radius: 2px;
  margin-top: auto;
  line-height: 1;
}

/* REPÈRES HORAIRES :15 / :45 */
.event-quarter-tag {
  position: absolute;
  bottom: 1px;
  font-size: 7.5px;
  font-weight: 900;
  background: #ea580c;
  color: #ffffff;
  padding: 0 2px;
  border-radius: 2px;
  line-height: 1.1;
  pointer-events: none;
}
.event-quarter-tag.tag-start { left: 1px; }
.event-quarter-tag.tag-end { right: 1px; }

/* 4. INDICATEUR EN DIRECT (Live Time Marker) */
.ade-live-time-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 28;
  pointer-events: none;
}

.live-time-bubble {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  background: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.6);
  white-space: nowrap;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  animation: liveBlink 1.2s infinite ease-in-out;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

