/* Calendario Historia Contemporánea — vars + UI (adaptado de GEO/DSV) */
:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --ink: #222222;
  --text: #222222;
  --muted: #555555;
  --line: rgba(0, 0, 0, 0.12);
  --atlantic: #00AA89;
  --atlantic-deep: #0f766e;
  --sand: #EF801B;
  --font: Georgia, "Times New Roman", serif;
  --display: Georgia, "Times New Roman", serif;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.hc-cal-wrap {
  margin: 0.5rem 0 1.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
.hc-cal-wrap .muted { color: var(--muted); }
/* Encabezado largo de la página del calendario */
#exe-node-cal #nodeTitle {
  font-size: 1.15em;
  line-height: 1.4;
  font-weight: 600;
}

.cal-fullwidth {
  width: 100%;
  box-sizing: border-box;
}
.hc-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 0 0 1.1rem;
  font-size: 0.85em;
}
.hc-cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.hc-cal-legend i {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
}

/* Leyenda propia arriba; ocultar la del motor del calendario */
.moodle-cal-legend {
  display: none !important;
}


/* —— Calendario mensual (estilo DSV / Moodle) —— */
.cal-page-top {
  padding-bottom: 0.5rem;
}

.cal-dashboard {
  display: grid;
  grid-template-columns: minmax(250px, 300px) 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .cal-dashboard {
    grid-template-columns: 1fr;
  }
}

.week-plan-panel,
.moodle-cal-panel,
.cal-dashboard-main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.week-plan-panel {
  padding: 1.35rem 1.25rem;
}

.week-plan-title {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.week-plan-note {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}

.week-plan-list {
  display: flex;
  flex-direction: column;
}

.week-plan-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.week-plan-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.week-plan-day {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--atlantic) 12%, white);
  color: var(--atlantic);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.week-plan-abbr {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.week-plan-num {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.85;
}

.week-plan-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.week-plan-text strong {
  font-family: var(--display);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
}

.week-plan-text span {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.cal-dashboard-main {
  overflow: hidden;
}

.cal-dashboard-head {
  padding: 1.1rem 1.25rem 0.25rem;
}

.cal-dashboard-heading {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.cal-dashboard-sub {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.cal-dashboard-main .moodle-cal {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.moodle-cal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin: 0 0 2rem;
}

@media (max-width: 960px) {
  .moodle-cal-layout {
    grid-template-columns: 1fr;
  }
}

.moodle-cal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.moodle-cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--atlantic) 5%, white);
  border-bottom: 1px solid var(--line);
}

.moodle-cal-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.moodle-cal-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 170px;
  text-align: center;
}

.moodle-cal-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.moodle-cal-btn:hover:not(:disabled) {
  border-color: var(--atlantic);
  color: var(--atlantic);
}

.moodle-cal-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.moodle-cal-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.moodle-cal-year-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--atlantic);
  background: color-mix(in srgb, var(--atlantic) 12%, white);
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
}

.moodle-cal-today {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.moodle-cal-today:hover {
  border-color: var(--atlantic);
  color: var(--atlantic);
}

.moodle-cal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.moodle-cal-weekday {
  padding: 0.6rem 0.35rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: color-mix(in srgb, var(--sand) 10%, white);
  border-bottom: 1px solid var(--line);
}

.moodle-cal-day {
  min-height: 100px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.4rem;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.moodle-cal-day:nth-child(5n) {
  border-right: none;
}

.moodle-cal-day--empty {
  background: rgba(148, 163, 184, 0.08);
  cursor: default;
}

.moodle-cal-day:not(.moodle-cal-day--empty):hover {
  background: color-mix(in srgb, var(--atlantic) 6%, white);
}

.moodle-cal-day--today .moodle-cal-daynum {
  background: var(--atlantic);
  color: #fff;
}

.moodle-cal-day--selected {
  outline: 2px solid var(--atlantic);
  outline-offset: -2px;
  z-index: 1;
}

.moodle-cal-daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
}

.moodle-cal-events {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
  flex: 1;
}

.moodle-cal-event {
  display: block;
  font-size: 0.68rem;
  line-height: 1.25;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ev-color) 18%, var(--surface));
  border-left: 3px solid var(--ev-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

a.moodle-cal-event--link {
  text-decoration: none;
}

a.moodle-cal-event--link:hover {
  text-decoration: underline;
}

.moodle-cal-more {
  font-size: 0.65rem;
  color: var(--muted);
  padding-left: 0.2rem;
}

.moodle-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--line);
}

.moodle-cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.moodle-cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.moodle-cal--compact .moodle-cal-day {
  min-height: 74px;
  padding: 0.3rem;
}

.moodle-cal--compact .moodle-cal-event {
  font-size: 0.6rem;
  padding: 0.15rem 0.3rem;
}

.moodle-cal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.moodle-cal-panel {
  padding: 1.15rem;
}

.moodle-cal-panel h3 {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1rem;
}

.moodle-upcoming-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
  padding: 0.6rem 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

.moodle-upcoming-item:last-child {
  border-bottom: none;
}

.moodle-upcoming-item:hover .moodle-upcoming-text {
  color: var(--atlantic);
}

a.moodle-upcoming-item--link {
  text-decoration: none;
  color: inherit;
}

.moodle-upcoming-date {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.45rem;
  border-left: 3px solid;
  background: var(--bg);
  border-radius: 4px;
  min-width: 52px;
  text-align: center;
}

.moodle-upcoming-text {
  font-size: 0.85rem;
  line-height: 1.35;
}

.moodle-upcoming-empty,
.moodle-detail-hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.moodle-detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.moodle-detail-list li {
  padding: 0.65rem 0 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.moodle-detail-dot {
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.moodle-detail-link {
  font-weight: 700;
  color: var(--atlantic);
  text-decoration: none;
}

.moodle-detail-link:hover {
  text-decoration: underline;
}

.calendar-trimesters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.trimester-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  border-top: 4px solid var(--atlantic);
  box-shadow: var(--shadow);
}

.trimester-card h3 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

.trimester-dates {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.trimester-card ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

.trimester-1 {
  border-top-color: var(--atlantic);
}

.trimester-2 {
  border-top-color: var(--navarra);
}

.trimester-3 {
  border-top-color: var(--atlantic-deep);
}

.calendar-edit-note {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  background: color-mix(in srgb, var(--sand) 14%, white);
  border: 1px solid color-mix(in srgb, var(--sand) 40%, var(--line));
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.calendar-edit-note code {
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .moodle-cal-day {
    min-height: 64px;
    padding: 0.25rem;
  }

  .moodle-cal-event {
    font-size: 0.55rem;
    border-left-width: 2px;
  }

  .moodle-cal-daynum {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.75rem;
  }
}
