/* ============================================================
   Latvijas Universitāte — Lecture Schedule
   Styled after luis.lu.lv  |  Primary: #004a87
   ============================================================ */

/* --- Reset & base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: #f4f4f4;
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: #004a87; text-decoration: none; }
a:hover { text-decoration: underline; color: #003366; }

/* --- LU page header (mirrors luis.lu.lv exactly) ---------- */
.pageHeader {
  background-color: #004a87;
  background-size: cover;
  background-position: center;
  color: #fff;
  padding-top: 10px;
  position: relative;
}
/* dark overlay on the photo */
.pageHeader::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 40, 100, 0.62);
  pointer-events: none;
}
.pageHeader > * { position: relative; }

/* Top row — language switcher */
div.rb_top { height: 35px; overflow: hidden; }
div.rb_top div.lng {
  float: right;
  padding: 6px 14px 0 0;
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .88rem;
  font-weight: 700;
}
div.rb_top div.lng a { color: rgba(255,255,255,.6); text-decoration: none; }
div.rb_top div.lng a.active { color: #fff; }
div.rb_top div.lng a:hover { color: #fff; }
.lang-sep { color: rgba(255,255,255,.35); }

/* Logo */
.menuRibbon__logo-wrap { padding-left: 0; }
.menuRibbon__logo { display: inline-block; }
.menuRibbon__logo:hover { opacity: .88; }
.menuRibbon__logo img { display: block; }

/* Navigation rows */
div.navigation_inner { clear: both; }
div.navigation_inner.pad_b2 { padding-bottom: 7px; color: #fff; display: block; }
div.left_mrg { margin-left: 28px; }

div.txtb_small_link {
  color: #fff;
  padding: 2px 10px;
  display: inline;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
div.txtb_small_curent_levpages_link {
  color: #fff;
  padding: 2px 10px;
  float: left;
  margin-right: 4px;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
div.dp { padding: 4px 10px; }

a.white { color: #fff; text-decoration: none; }
a.white:hover { color: #fff; text-decoration: underline; }
a.white.active { color: #fff; font-weight: 900; }
a.fs2 { font-weight: 700; font-size: 1.35rem; letter-spacing: .08em; }
a.fs4 { font-weight: 700; font-size: 3.2rem;  letter-spacing: .06em; line-height: 1.1; }

/* --- Info bar (term + group) ------------------------------ */
.info-bar {
  background: #eeeeee;
  border-bottom: 1px solid #d8d8d8;
}
.info-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .4rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .82rem;
  color: #333;
}
.info-term  { font-weight: 600; color: #004a87; }
.info-sep   { color: #aaa; }
.info-group { font-weight: 600; color: #333; }
.info-dept  { color: #777; font-size: .78rem; }

/* --- Main & footer ---------------------------------------- */
.site-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}
.site-footer {
  background: #004a87;
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: .65rem 1rem;
  font-size: .78rem;
  margin-top: auto;
}
.site-footer-inner { }
.site-footer a { color: rgba(255,255,255,.85); }
.site-footer a:hover { color: #fff; text-decoration: underline; }

/* --- Buttons --------------------------------------------- */
.btn {
  display: inline-block;
  padding: .35rem .9rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #004a87;
  background: #fff;
  color: #004a87;
  text-decoration: none;
  transition: background .1s, color .1s;
}
.btn:hover { background: #e6eef5; text-decoration: none; }
.btn-primary { background: #004a87; color: #fff; }
.btn-primary:hover { background: #003575; color: #fff; }
.btn-secondary { background: #eeeeee; border-color: #ccc; color: #333; }
.btn-secondary:hover { background: #e0e0e0; }
.btn-ghost { border-color: transparent; background: transparent; color: #004a87; }
.btn-ghost:hover { background: #e6eef5; }

/* --- Index page ------------------------------------------- */
.page-index { max-width: 900px; }

.page-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: #004a87;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: baseline;
  gap: .65rem;
  flex-wrap: wrap;
  padding-bottom: .5rem;
  border-bottom: 2px solid #004a87;
}
.heading-term {
  font-size: .88rem;
  font-weight: 400;
  color: #666;
}

/* Department accordion */
.dept-list { display: flex; flex-direction: column; gap: .4rem; }

.dept-details {
  border: 1px solid #ccd9e6;
  background: #fff;
}

.dept-summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: #e6eef5;
  border-left: 4px solid #004a87;
}
.dept-summary::-webkit-details-marker { display: none; }
.dept-summary::before {
  content: "▶";
  font-size: .6rem;
  color: #004a87;
  flex-shrink: 0;
  transition: transform .15s;
}
.dept-details[open] > .dept-summary::before { transform: rotate(90deg); }
.dept-summary:hover { background: #d4e4f0; }

.dept-name { font-weight: 700; font-size: .92rem; color: #004a87; flex: 1; }
.dept-meta { font-size: .75rem; color: #666; white-space: nowrap; }

.dept-body {
  border-top: 1px solid #ccd9e6;
  padding: .5rem .75rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

/* Course accordion */
.course-details {
  border: 1px solid #e2eaf2;
  background: #fafbfd;
}
.course-details[open] { background: #fff; border-color: #ccd9e6; }

.course-summary {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem .75rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.course-summary::-webkit-details-marker { display: none; }
.course-summary::before {
  content: "▶";
  font-size: .55rem;
  color: #99b3cc;
  flex-shrink: 0;
  transition: transform .15s;
}
.course-details[open] > .course-summary::before { transform: rotate(90deg); color: #004a87; }
.course-summary:hover { background: #eef4f9; }

.course-name { font-weight: 500; font-size: .88rem; color: #1a1a1a; flex: 1; }
.course-id   { font-size: .73rem; color: #999; font-family: "Courier New", monospace; white-space: nowrap; }
.course-meta { font-size: .73rem; color: #999; white-space: nowrap; }

.course-other .course-name { color: #666; font-style: italic; }

/* Group list inside course */
.group-list { list-style: none; padding: .2rem .75rem .5rem 2rem; display: flex; flex-direction: column; gap: .2rem; }
.group-link {
  display: block;
  padding: .3rem .6rem;
  font-size: .85rem;
  color: #004a87;
  border: 1px solid transparent;
  transition: background .1s, border-color .1s;
}
.group-link:hover {
  background: #e6eef5;
  border-color: #b3c9de;
  text-decoration: none;
}

.hint-msg, .empty-msg {
  color: #666;
  font-size: .9rem;
  padding: 1.5rem 0;
}

/* --- Weekly view ------------------------------------------ */
.weekly-page {}

.week-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.week-label {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: .92rem;
  color: #004a87;
}
.week-num { color: #888; font-size: .8rem; margin-left: .4rem; }

.timetable-wrap {
  overflow-x: auto;
  border: 1px solid #ccd9e6;
  background: #fff;
}

.timetable {
  display: grid;
  grid-template-columns: 50px repeat(6, minmax(120px, 1fr));
  min-width: 820px;
}

/* Day header cells */
.tt-time-col { background: #f4f4f4; border-right: 1px solid #dde6ef; }

.tt-day-header {
  padding: .45rem .4rem;
  text-align: center;
  border-bottom: 2px solid #ccd9e6;
  border-left: 1px solid #dde6ef;
  background: #f4f4f4;
}
.tt-day-header.today { background: #e6eef5; border-bottom-color: #004a87; }
.day-name { font-size: .75rem; font-weight: 700; color: #004a87; text-transform: uppercase; letter-spacing: .05em; }
.day-date { font-size: .72rem; color: #888; }

/* Body columns */
.tt-body-time {
  position: relative;
  border-right: 1px solid #dde6ef;
}
.hour-label {
  position: absolute;
  right: 4px;
  font-size: .67rem;
  color: #aaa;
  transform: translateY(-50%);
  white-space: nowrap;
  line-height: 1;
}

.tt-day-col {
  position: relative;
  border-left: 1px solid #dde6ef;
}
.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #f0f0f0;
}
.hour-line:nth-child(3n) { border-top-color: #dde6ef; }

/* Event blocks */
.ev-block {
  position: absolute;
  left: 1px;
  right: 1px;
  padding: 3px 5px;
  font-size: .7rem;
  line-height: 1.3;
  overflow: hidden;
  border-left: 3px solid transparent;
  cursor: default;
  transition: opacity .15s;
}
.ev-block:hover { opacity: .85; }

.ev-bachelor { background: #dbeafe; border-left-color: #004a87; color: #003366; }
.ev-master   { background: #d1fae5; border-left-color: #057a55; color: #064e3b; }
.ev-online   { background: #fef3c7; border-left-color: #b45309; color: #78350f; }
.ev-default  { background: #eeeeee; border-left-color: #888;    color: #333; }

.ev-time  { font-weight: 700; font-size: .65rem; white-space: nowrap; }
.ev-title { font-weight: 600; margin-top: 1px; }
.ev-title .ev-cat-link { color: inherit; text-decoration: underline dotted; }
.ev-title .ev-cat-link:hover { text-decoration: underline; }
.ev-meta  { color: inherit; opacity: .8; font-size: .72rem; margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ev-meta-staff { font-weight: 600; font-size: .75rem; }
.ev-meta-room  { font-size: .73rem; }

/* --- Chronological view ----------------------------------- */
.chrono-page {}

.chrono-filter {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #ccd9e6;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.chrono-filter label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .78rem;
  color: #555;
  font-weight: 600;
}
.chrono-filter input[type="date"] {
  padding: .3rem .55rem;
  border: 1px solid #ccc;
  font-size: .88rem;
}

.day-section { margin-bottom: 1.5rem; }
.day-heading {
  font-size: .95rem;
  font-weight: 700;
  color: #004a87;
  padding: .35rem 0 .35rem;
  border-bottom: 2px solid #004a87;
  margin-bottom: .5rem;
}

.event-list { list-style: none; display: flex; flex-direction: column; gap: .25rem; }
.event-row {
  display: flex;
  gap: 1rem;
  background: #fff;
  border: 1px solid #dde6ef;
  padding: .5rem .85rem;
  align-items: flex-start;
  transition: border-color .1s;
}
.event-row:hover { border-color: #004a87; }
.event-row.past { opacity: .5; }

.ev-row-time {
  min-width: 95px;
  font-size: .82rem;
  font-weight: 700;
  color: #004a87;
  white-space: nowrap;
  padding-top: .1rem;
}
.time-sep { margin: 0 .15rem; color: #aaa; }

.ev-row-body { flex: 1; }
.ev-row-title { font-weight: 600; font-size: .9rem; color: #1a1a1a; }
.ev-row-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; align-items: center; }
.meta-item { font-size: .82rem; color: #444; }
.meta-staff { font-weight: 600; font-size: .86rem; color: #1a1a1a; }
.meta-room  { font-size: .82rem; color: #444; }
.meta-badge {
  font-size: .67rem;
  background: #eeeeee;
  color: #555;
  padding: .1rem .4rem;
  border: 1px solid #ccc;
  font-weight: 600;
}
.meta-badge.online { background: #fef3c7; color: #92400e; border-color: #f6d860; }

/* --- Form controls --------------------------------------- */
.select-dept, .input-search, select, input[type="date"] {
  padding: .35rem .6rem;
  border: 1px solid #ccc;
  font-size: .88rem;
  color: #333;
  background: #fff;
}
select:focus, input:focus { outline: 2px solid #004a87; outline-offset: 0; }

/* --- Hover tooltip ---------------------------------------- */
.ev-tooltip {
  position: fixed;
  z-index: 1500;
  background: #fff;
  border: 1px solid #ccd9e6;
  border-left: 4px solid #004a87;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
  padding: .55rem .85rem;
  max-width: 300px;
  min-width: 160px;
  pointer-events: none;
  font-size: .82rem;
  color: #222;
  line-height: 1.4;
}
.ev-tooltip-time   { font-weight: 700; color: #004a87; font-size: .75rem; margin-bottom: .2rem; }
.ev-tooltip-title  { font-weight: 600; color: #1a1a1a; }
.ev-tooltip-row    { color: #555; margin-top: .2rem; font-size: .78rem; }

/* --- Detail modal ----------------------------------------- */
.ev-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ev-modal {
  background: #fff;
  max-width: 500px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  border-top: 4px solid #004a87;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,.3);
}
.ev-modal-close {
  position: absolute;
  top: .55rem;
  right: .7rem;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #777;
  line-height: 1;
  padding: .15rem .3rem;
}
.ev-modal-close:hover { color: #004a87; }

.ev-modal-header {
  background: #e6eef5;
  padding: .85rem 2.5rem .85rem 1.1rem;
  border-bottom: 1px solid #ccd9e6;
}
.ev-modal-title    { font-size: 1.05rem; font-weight: 700; color: #004a87; line-height: 1.35; }
.ev-modal-title-en { font-size: .85rem; color: #666; margin-top: .25rem; }

.ev-modal-body {
  padding: .9rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.ev-modal-row {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  font-size: .88rem;
}
.ev-modal-label {
  color: #888;
  min-width: 76px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}
.ev-modal-value { color: #1a1a1a; flex: 1; }
.ev-modal-value a { color: #004a87; }
.ev-modal-value a:hover { text-decoration: underline; }
.ev-modal-online { margin-top: .3rem; display: inline-block; }

/* --- 404 page --------------------------------------------- */
.error-page {
  text-align: center;
  padding: 4rem 1rem;
}
.error-code  { font-size: 5rem; font-weight: 800; color: #ccd9e6; line-height: 1; }
.error-title { font-size: 1.4rem; font-weight: 700; margin: .5rem 0; color: #004a87; }
.error-msg   { color: #666; margin-bottom: 1.5rem; }

/* --- Group schedule heading -------------------------------- */
.group-heading {
  margin-bottom: 1rem;
  padding: .65rem 1rem .7rem;
  background: #fff;
  border-left: 4px solid #004a87;
  border-bottom: 1px solid #ccd9e6;
}

.group-heading-term {
  font-size: .78rem;
  color: #888;
  margin-bottom: .15rem;
}

.group-heading-course {
  font-size: .88rem;
  color: #444;
  margin-bottom: .2rem;
}

.group-heading-group {
  font-size: 1.4rem;
  font-weight: 700;
  color: #004a87;
  line-height: 1.2;
}

/* --- Week-list view (Nedēļa / RSU style) ------------------ */
.week-list-page {}

.wl-day {
  margin-bottom: 1rem;
  border: 1px solid #ccd9e6;
  background: #fff;
}
.wl-day.wl-today { border-color: #004a87; }
.wl-today .wl-day-heading { background: #e6eef5; border-left-color: #004a87; }

.wl-day-heading {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .5rem .85rem;
  background: #f4f7fb;
  border-left: 4px solid #99b3cc;
  border-bottom: 1px solid #ccd9e6;
}
.wl-day-name { font-weight: 700; font-size: .9rem; color: #004a87; text-transform: uppercase; letter-spacing: .04em; }
.wl-day-date { font-size: .8rem; color: #777; }

.wl-event-list { list-style: none; }
.wl-event-row {
  display: flex;
  gap: .85rem;
  padding: .55rem .85rem;
  border-bottom: 1px solid #f0f4f8;
  cursor: pointer;
  transition: background .1s;
}
.wl-event-row:last-child { border-bottom: none; }
.wl-event-row:hover { background: #f4f7fb; }

.wl-ev-time {
  min-width: 100px;
  font-size: .85rem;
  font-weight: 700;
  color: #004a87;
  white-space: nowrap;
  padding-top: .1rem;
  flex-shrink: 0;
}
.wl-ev-body { flex: 1; }
.wl-ev-title {
  font-weight: 600;
  font-size: .9rem;
  color: #1a1a1a;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
}
.wl-cat-link { color: #004a87; }
.wl-cat-link:hover { text-decoration: underline; }
.wl-ev-type {
  font-size: .72rem;
  color: #777;
  font-weight: 400;
  white-space: nowrap;
}
.wl-ev-meta {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .2rem;
  font-size: .8rem;
  color: #555;
}
.wl-ev-lecturer { font-weight: 600; color: #333; }
.wl-ev-room     { color: #555; }
.wl-ev-building { color: #888; font-size: .76rem; }

.wl-no-events {
  padding: .45rem .85rem;
  font-size: .82rem;
  color: #aaa;
  font-style: italic;
}

/* --- Bottom view switcher --------------------------------- */
.view-switcher {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border: 1px solid #004a87;
  width: fit-content;
}
.view-link {
  display: inline-block;
  padding: .4rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  color: #004a87;
  text-decoration: none;
  border-right: 1px solid #004a87;
  letter-spacing: .03em;
  transition: background .1s, color .1s;
}
.view-link:last-child { border-right: none; }
.view-link:hover { background: #e6eef5; text-decoration: none; }
.view-link.active { background: #004a87; color: #fff; }

/* --- Semester schedule — Nedēļas skats ------------------------ */

/* Level 1 — Day section */
.ns-day-section {
  margin-bottom: 1.25rem;
  border: 1px solid #ccd9e6;
  background: #fff;
}

.ns-day-heading {
  margin: 0;
  padding: .45rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: #004a87;
}

/* Level 2 — Timeslot row (flex: time label + event list) */
.ns-slot {
  display: flex;
  align-items: stretch;
  border-top: 1px solid #dde6ef;
}

.ns-slot-time {
  flex-shrink: 0;
  width: 110px;
  padding: .55rem .75rem;
  font-family: "Courier New", monospace;
  font-size: .82rem;
  font-weight: 700;
  color: #004a87;
  background: #f4f7fb;
  border-right: 2px solid #ccd9e6;
  white-space: nowrap;
}

/* Level 3 — Event list */
.ns-events {
  list-style: none;
  flex: 1;
  margin: 0;
  padding: 0;
}

.ns-event {
  padding: .5rem .85rem;
  border-bottom: 1px solid #f0f4f8;
  cursor: pointer;
  transition: background .1s;
}

.ns-event:last-child { border-bottom: none; }
.ns-event:hover { background: #f4f7fb; }

.ns-event-name {
  font-weight: 600;
  font-size: .88rem;
  color: #1a1a1a;
}

.ns-event-link { color: #004a87; }
.ns-event-link:hover { text-decoration: underline; }

.ns-event-meta {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: .2rem;
  font-size: .78rem;
  color: #555;
}

.ns-event-staff { font-weight: 600; color: #333; }
.ns-event-staff a,
.ns-event-room a  { color: #004a87; }
.ns-event-staff a:hover,
.ns-event-room a:hover { text-decoration: underline; }

.ns-event-building { color: #888; font-size: .73rem; }

.ns-event-weeks {
  margin-top: .25rem;
  font-size: .75rem;
  color: #777;
  line-height: 1.5;
}

/* --- Print / PDF ------------------------------------------ */
@media print {
  .pageHeader, .info-bar, .chrono-filter, .view-switcher,
  .ev-modal-overlay, #ev-tooltip { display: none !important; }
  .site-main { padding: 0; }
  .site-footer { display: none; }
  .event-row.past { opacity: 1; }
  body { background: #fff; font-size: 11pt; }
  .event-row { break-inside: avoid; border: 1px solid #ccc; margin-bottom: 4pt; }
  .day-heading { border-bottom: 1pt solid #004a87; color: #004a87; }
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 680px) {
  .week-nav { gap: .3rem; }
  .week-label { order: -1; width: 100%; }
  .topbar-inner { flex-wrap: wrap; }
  .gnav-links { margin-left: 0; }
}
