/**
 * Grade horária pública das turmas (/turmas) — CSS reaproveitado 1:1 (mesmos
 * seletores e valores) do dashboard do aluno (aluno.peac.com.br):
 *   local/peac_custom/scss/dashboard.css       (.peac-course-card*, .peac-course-image)
 *   local/peac_custom/scss/peac-responsive.css (.peac-schedule-*, .peac-slot-*)
 *
 * Escopado sob #turmas-horarios para não colidir com o resto do site.
 * .peac-course-main-col fica com largura fixa 280px (no painel autenticado esse
 * valor é ajustado por JS que não é reaproveitado aqui — 280px é o valor "de
 * repouso" já definido no CSS de origem).
 */

#turmas-horarios {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#turmas-horarios .peac-course-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  position: relative;
}

#turmas-horarios .peac-course-card-with-schedule {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

#turmas-horarios .peac-course-main-col {
  flex: 0 0 280px;
  width: 280px;
  min-width: 280px;
}

#turmas-horarios .peac-course-card-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

#turmas-horarios .peac-course-image {
  display: block;
  flex: 1;
  min-height: 180px;
  position: relative;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

#turmas-horarios .peac-course-info {
  position: absolute;
  bottom: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  border-radius: 6px;
  box-sizing: border-box;
}

#turmas-horarios .peac-course-info h3 {
  margin: 0;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#turmas-horarios .peac-course-schedule-inline {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid #e9ecef;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#turmas-horarios .peac-course-schedule-inline .peac-turma-schedule {
  margin-bottom: 0;
}

#turmas-horarios .peac-course-schedule-inline .peac-schedule-table {
  font-size: 0.75rem;
}

#turmas-horarios .peac-course-schedule-inline .peac-schedule-table th,
#turmas-horarios .peac-course-schedule-inline .peac-schedule-table td {
  padding: 6px 4px;
}

#turmas-horarios .peac-course-schedule-inline .peac-schedule-slot {
  padding: 4px;
}

/* Mobile: coluna esquerda/direita empilham (mesma adaptação do painel) */
@media (max-aspect-ratio: 4/3) {
  #turmas-horarios .peac-course-card-with-schedule {
    flex-direction: column;
  }

  #turmas-horarios .peac-course-main-col {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  #turmas-horarios .peac-course-schedule-inline {
    border-left: none;
    border-top: 1px solid #e9ecef;
  }
}

/* ===== Tabela horária (peac-responsive.css) ===== */

#turmas-horarios .peac-turma-schedule {
  margin-bottom: 20px;
}

#turmas-horarios .peac-schedule-empty {
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  color: #999;
  font-size: 0.9em;
  text-align: center;
}

#turmas-horarios .peac-nonclass-alert {
  padding: 12px 16px;
  background: linear-gradient(135deg, #fff3cd, #ffeeba);
  border: 1px solid #ffc107;
  border-radius: 8px;
  color: #856404;
  margin-bottom: 15px;
  font-size: 0.9em;
}

#turmas-horarios .peac-nonclass-alert i {
  color: #f0ad4e;
  margin-right: 5px;
}

#turmas-horarios .peac-schedule-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

#turmas-horarios .peac-schedule-daterange-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #1a73e8 0%, #1565c0 100%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 10px 10px 0 0;
  letter-spacing: 0.02em;
}

#turmas-horarios .peac-schedule-daterange-bar i {
  font-size: 0.72rem;
  opacity: 0.85;
}

#turmas-horarios .peac-schedule-daterange-bar .peac-schedule-meta-tag {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

#turmas-horarios .peac-schedule-daterange-bar .peac-schedule-special-tag {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}

#turmas-horarios .peac-schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85em;
}

#turmas-horarios .peac-schedule-table th,
#turmas-horarios .peac-schedule-table td {
  padding: 8px 6px;
  text-align: center;
  border: 1px solid #e9ecef;
}

#turmas-horarios .peac-schedule-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #666;
}

#turmas-horarios .peac-schedule-table th.peac-period-col,
#turmas-horarios .peac-schedule-table td.peac-period-col {
  text-align: left;
  background: #f8f9fa;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}

#turmas-horarios .peac-schedule-table thead th.peac-period-col {
  z-index: 3;
}

#turmas-horarios .peac-schedule-table th:not(.peac-period-col),
#turmas-horarios .peac-schedule-table td:not(.peac-period-col) {
  white-space: nowrap;
}

#turmas-horarios .peac-period-name {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

#turmas-horarios .peac-period-time {
  display: block;
  font-size: 0.85em;
  color: #666;
}

#turmas-horarios .peac-schedule-table th.peac-today,
#turmas-horarios .peac-schedule-table td.peac-today {
  background: linear-gradient(135deg, #f0f4ff, #e8edff);
}

#turmas-horarios .peac-schedule-table th.peac-today {
  color: #667eea;
}

#turmas-horarios .peac-schedule-table td.peac-live-now {
  background: linear-gradient(135deg, #e8ffe8, #d4ffd4);
  animation: turma-schedule-live-pulse 2s ease-in-out infinite;
}

@keyframes turma-schedule-live-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(40, 167, 69, 0.2); }
  50% { box-shadow: inset 0 0 0 2px rgba(40, 167, 69, 0.5); }
}

#turmas-horarios .peac-live-badge {
  display: inline-block;
  font-size: 0.7em;
  font-weight: 700;
  color: #28a745;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

#turmas-horarios .peac-live-badge .fa-circle {
  font-size: 0.6em;
  animation: turma-schedule-live-dot 1.5s ease-in-out infinite;
}

@keyframes turma-schedule-live-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#turmas-horarios .peac-schedule-slot {
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  margin: 2px 0;
  text-align: left;
}

#turmas-horarios .peac-schedule-slot > .peac-live-badge {
  display: block;
}

#turmas-horarios .peac-slot-split {
  padding: 6px 8px;
}

#turmas-horarios .peac-slot-line {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 3px solid transparent;
  padding-left: 6px;
}

#turmas-horarios .peac-slot-line + .peac-slot-line {
  margin-top: 4px;
}

#turmas-horarios .peac-slot-subject {
  display: inline;
  font-weight: 600;
  font-size: 0.9em;
  color: #333;
}

#turmas-horarios .peac-slot-lesson {
  display: inline-flex;
  align-items: center;
  font-size: .72rem;
  font-weight: 700;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: #e9edf7;
  border: 1px solid #d6deee;
  color: #324260;
  vertical-align: middle;
  line-height: 1.35;
  white-space: nowrap;
}

#turmas-horarios .peac-slot-empty {
  color: #ccc;
}

/* ===== Dark mode (adapta ao tema do site, não ao peac-dark do Moodle) ===== */

body.theme-dark #turmas-horarios .peac-course-card {
  background: var(--peac-surface, #1d2329);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.theme-dark #turmas-horarios .peac-course-schedule-inline {
  border-left-color: var(--peac-border, #2b333b);
}

@media (max-aspect-ratio: 4/3) {
  body.theme-dark #turmas-horarios .peac-course-schedule-inline {
    border-top-color: var(--peac-border, #2b333b);
  }
}

body.theme-dark #turmas-horarios .peac-schedule-table th,
body.theme-dark #turmas-horarios .peac-schedule-table td,
body.theme-dark #turmas-horarios .peac-schedule-table th.peac-period-col,
body.theme-dark #turmas-horarios .peac-schedule-table td.peac-period-col {
  background: var(--peac-surface, #1d2329);
  border-color: var(--peac-border, #2b333b);
  color: var(--peac-text, #e5e8ea);
}

body.theme-dark #turmas-horarios .peac-period-name {
  color: var(--peac-text, #e5e8ea);
}

body.theme-dark #turmas-horarios .peac-period-time,
body.theme-dark #turmas-horarios .peac-schedule-table th {
  color: var(--peac-text-soft, #a7b1ba);
}

body.theme-dark #turmas-horarios .peac-schedule-slot {
  background: var(--peac-bg-alt, #171b20);
}

body.theme-dark #turmas-horarios .peac-slot-subject {
  color: var(--peac-text, #e5e8ea);
}

body.theme-dark #turmas-horarios .peac-schedule-empty {
  background: var(--peac-bg-alt, #171b20);
  color: var(--peac-text-soft, #a7b1ba);
}

/* ===== Liquid Glass nativo para os horários importados do Moodle ===== */
#turmas-horarios .peac-course-card {
  isolation: isolate;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .68), rgba(226, 238, 255, .42)) !important;
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 18px;
  box-shadow:
    0 24px 54px -30px rgba(15, 23, 42, .62),
    inset 0 1px 0 rgba(255, 255, 255, .94),
    inset 0 -1px 0 rgba(255, 255, 255, .24);
  transition: transform .28s cubic-bezier(.2, .72, .2, 1), box-shadow .28s ease, border-color .28s ease;
}

#turmas-horarios .peac-course-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(90% 100% at var(--glass-x, 50%) var(--glass-y, 50%), rgba(255, 255, 255, .30), transparent 56%),
    linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 26%);
  mix-blend-mode: screen;
}

#turmas-horarios .peac-course-card > * {
  position: relative;
  z-index: 1;
}

@media (hover: hover) {
  #turmas-horarios .peac-course-card:hover {
    border-color: rgba(255, 255, 255, .96);
    box-shadow:
      0 32px 68px -32px rgba(15, 23, 42, .72),
      0 12px 30px -24px rgba(37, 99, 235, .58),
      inset 0 1px 0 #fff;
    transform: translateY(-4px) scale(1.004);
  }
}

#turmas-horarios .peac-course-image {
  filter: saturate(1.24) contrast(1.08);
}

#turmas-horarios .peac-course-info {
  background: linear-gradient(145deg, rgba(15, 23, 42, .88), rgba(30, 41, 59, .76));
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .20);
}

#turmas-horarios .peac-course-schedule-inline {
  background: linear-gradient(145deg, rgba(255, 255, 255, .48), rgba(235, 243, 255, .30));
  border-left-color: rgba(255, 255, 255, .66);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
}

#turmas-horarios .peac-schedule-table-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(255, 255, 255, .24);
  border: 1px solid rgba(255, 255, 255, .70);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .84);
}

#turmas-horarios .peac-schedule-daterange-bar {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .15), transparent 48%),
    linear-gradient(135deg, #2784ff 0%, #0759c7 100%);
  border-radius: 13px 13px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42);
  filter: saturate(1.22) contrast(1.05);
}

#turmas-horarios .peac-schedule-table {
  background: transparent;
}

#turmas-horarios .peac-schedule-table th,
#turmas-horarios .peac-schedule-table td,
#turmas-horarios .peac-schedule-table th.peac-period-col,
#turmas-horarios .peac-schedule-table td.peac-period-col {
  color: #263244;
  background: rgba(255, 255, 255, .42);
  border-color: rgba(148, 163, 184, .22);
}

#turmas-horarios .peac-schedule-table th,
#turmas-horarios .peac-schedule-table th.peac-period-col {
  color: #425066;
  background: rgba(239, 245, 255, .66);
}

#turmas-horarios .peac-schedule-table td.peac-today,
#turmas-horarios .peac-schedule-table th.peac-today {
  background: linear-gradient(145deg, rgba(205, 222, 255, .86), rgba(231, 238, 255, .64));
}

#turmas-horarios .peac-schedule-slot {
  background: linear-gradient(145deg, rgba(255, 255, 255, .76), rgba(235, 241, 250, .58));
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .88), 0 6px 16px -14px rgba(15, 23, 42, .65);
}

#turmas-horarios .peac-slot-lesson {
  background: linear-gradient(145deg, rgba(215, 226, 248, .96), rgba(236, 242, 255, .88));
  border-color: rgba(91, 116, 165, .28);
  color: #263b61;
}

body.theme-dark #turmas-horarios .peac-course-card {
  background: linear-gradient(145deg, rgba(31, 45, 66, .78), rgba(10, 17, 31, .64)) !important;
  border-color: rgba(255, 255, 255, .16);
  box-shadow: 0 28px 62px -30px rgba(0, 0, 0, .92), inset 0 1px 0 rgba(255, 255, 255, .17);
}

body.theme-dark #turmas-horarios .peac-course-schedule-inline {
  background: linear-gradient(145deg, rgba(31, 41, 59, .62), rgba(9, 15, 27, .46));
  border-left-color: rgba(255, 255, 255, .12);
}

body.theme-dark #turmas-horarios .peac-schedule-table-wrapper {
  background: rgba(8, 15, 27, .34);
  border-color: rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
}

body.theme-dark #turmas-horarios .peac-schedule-table th,
body.theme-dark #turmas-horarios .peac-schedule-table td,
body.theme-dark #turmas-horarios .peac-schedule-table th.peac-period-col,
body.theme-dark #turmas-horarios .peac-schedule-table td.peac-period-col {
  color: #e7eef8;
  background: rgba(22, 32, 48, .54);
  border-color: rgba(255, 255, 255, .09);
}

body.theme-dark #turmas-horarios .peac-schedule-table th,
body.theme-dark #turmas-horarios .peac-schedule-table th.peac-period-col {
  color: #b9c7da;
  background: rgba(37, 50, 70, .68);
}

body.theme-dark #turmas-horarios .peac-schedule-slot {
  background: linear-gradient(145deg, rgba(43, 57, 78, .82), rgba(19, 29, 44, .70));
  border-color: rgba(255, 255, 255, .11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

body.theme-dark #turmas-horarios .peac-slot-lesson {
  color: #dce8ff;
  background: linear-gradient(145deg, rgba(62, 83, 116, .90), rgba(37, 53, 78, .82));
  border-color: rgba(154, 181, 226, .22);
}

@media (max-aspect-ratio: 4/3) {
  #turmas-horarios .peac-course-schedule-inline,
  body.theme-dark #turmas-horarios .peac-course-schedule-inline {
    border-left: 0;
    border-top-color: rgba(255, 255, 255, .18);
  }
}
