* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', Arial, sans-serif;
}

html, body {
  overflow-x: hidden;
  overflow-y: auto;
  max-width: 100vw;
  height: 100%;
}

body {
  background: #f9f9f9;
  color: #1f4068;
  padding-top: 60px;
}

body.modal-open { overflow: hidden; }

/* =========================================================
   SECTION LOADERS (Upcoming + Past) — NEW
========================================================= */
.section-loading{
  position: relative;
}

.section-loading .section-content{
  transition: opacity .25s ease, filter .25s ease;
}

.section-loading:not(.is-ready) .section-content{
  opacity: .58;
  filter: blur(1px);
  pointer-events: none;
}

.section-loader{
  position: absolute;
  inset: 0;
  z-index: 10;

  display: grid;
  place-items: center;

  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  border-radius: 16px;

  transition: opacity .35s ease, visibility .35s ease;
}

.section-loader.hide{
  opacity: 0;
  visibility: hidden;
}

.section-loader .loader-spinner{
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 6px solid rgba(31,64,104,0.18);
  border-top-color: rgba(31,64,104,0.95);
  animation: secSpin .9s linear infinite;
}

@keyframes secSpin{
  to { transform: rotate(360deg); }
}

.section-loader .loader-text{
  margin-top: 10px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .2px;
  color: #0f2d55;
}

/* Loader rounding per section */
#secUpcoming .section-loader{
  border-radius: 15px;
}
#secPast .section-loader{
  border-radius: 0; /* full-width band */
}

/* ================= HERO ================= */
.hero {
  position: relative;
  width: 100%;
  height: 35vh;
  min-height: 300px;
  max-height: 600px;
  background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)),
              url('../static/events.png') center/cover no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  text-align: center;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero h1 { font-size: 48px; font-weight: bold; }
.hero p  { font-size: 20px; margin-top: 15px; }

/* ================= LAYOUT ================= */
.events-container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

.events-layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ================= CALENDAR ================= */
.calendar {
  width: 550px;
  height: 600px;
  background: #fff;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.calendar-header button {
  background: #1f4068;
  color: white;
  border: none;
  font-size: 16px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  gap: 3px;
  margin-bottom: 8px;
}

.calendar-days span {
  font-weight: bold;
  color: #555;
  padding: 6px 0;
  font-size: 14px;
}

.calendar-dates {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  flex: 1;
  min-height: 420px;
}

.calendar-dates div {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  cursor: default;
  background: #f9f9f9;
  font-size: 16px;
  font-weight: normal;
  color: #1f4068;
  height: 60px;
  transition: background 0.3s, color 0.3s;
}

.calendar-dates div.event { background: #eee; font-weight: 600; }
.calendar-dates div.event.active { background: #1f4068; color: #fff; font-weight: bold; }
.calendar-dates div.event:hover { background: #163252; color: #fff; }

.calendar-dates div.today {
  border: 2px solid #1f4068 !important;
  background: #a1b2c7 !important;
  color: #1f4068 !important;
  font-weight: bold;
}

.empty { visibility: hidden; }

.no-event {
  font-style: italic;
  color: #777;
  margin-top: 10px;
  text-align: center;
  clear: both;
}

/* ================= EVENT LIST ================= */
.event-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* keep loader bounded */
  border-radius: 15px;
}

.event-list h2 { margin-bottom: 20px; }

.event-item {
  display: flex;
  gap: 20px;
  background: #fff;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  height: auto !important;
  align-items: flex-start;
  overflow: visible !important;
  cursor: pointer;
}

.event-item img {
  width: 140px;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
}

.event-item video {
  width: 140px;
  height: 95px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.event-info h3 { margin: 0 0 5px 0; font-size: 18px; }
.event-info p  { margin: 2px 0; }

.event-item.active { border: 3px solid #1f4068; transform: scale(1.02); }
.event-item.dim, .past-event-card.dim { opacity: 0.4; }

.event-date { font-size: 14px; color: #7782bb; }

/* ================= PAST EVENTS ================= */
section.past-events-container {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background-color: #f1f1f1;
  padding: 85px 15px;
  box-sizing: border-box;

  /* needed for loader overlay */
  position: relative;
}

.past-events-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  margin: 0 auto;
}

.past-events-header { text-align: center; }

.past-events-header h2 {
  font-size: 28px;
  color: #1f4068;
  margin-bottom: 10px;
}

.past-events-subtitle {
  font-size: 16px;
  color: #555;
  font-style: italic;
}

.past-events-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
}

.past-event-card {
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  width: 320px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.past-event-card img,
.past-event-card video {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  transition: transform 0.3s ease;
}

.past-event-card:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.past-event-card:hover img,
.past-event-card:hover video { transform: scale(1.03); }

.past-event-card .event-info { padding: 15px; }

.past-event-card h3 { margin: 0 0 5px 0; font-size: 18px; }
.past-event-card p  { margin: 2px 0; }

/* ================= MODAL (NO BLACK BARS) ================= */
.event-modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.event-modal.open{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.event-modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.58);
}

/* card */
.event-modal-card{
  position: relative;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0,0,0,0.28);
  overflow: hidden;
  z-index: 2;
}

/* close */
.event-modal-close{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.95);
  color: #1f4068;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 5;
}

/* 2-column layout */
.event-modal-grid{
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  height: min(560px, calc(100vh - 64px));
}

/* media panel: remove dark bg */
.event-modal-media{
  background: #ffffff;
  height: 100%;
  overflow: hidden;
}

/* IMPORTANT: cover removes the black bars */
.event-modal-media img,
.event-modal-media video{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #ffffff;
}

/* details */
.event-modal-body{
  padding: 18px 18px 22px;
  overflow: auto;
}

.event-modal-body h3{
  font-size: 22px;
  color: #1f4068;
  margin: 0 0 6px 0;
}

.event-modal-date{
  font-size: 14px;
  color: #7782bb;
  margin: 0 0 12px 0;
}

.event-modal-desc{
  font-size: 15px;
  color: #22324a;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Mobile stack */
@media (max-width: 820px){
  .event-modal.open{ padding: 18px 12px; }

  .event-modal-grid{
    grid-template-columns: 1fr;
    height: auto;
  }

  .event-modal-media{ height: 260px; }

  .event-modal-media img,
  .event-modal-media video{
    height: 260px;
    object-fit: cover;
  }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
  .events-layout { flex-direction: column; }

  .calendar, .event-list {
    width: 100%;
    height: 600px;
  }

  .calendar-dates { grid-template-rows: repeat(6, 1fr); min-height: 420px; }
  .calendar-dates div { height: 60px; font-size: 14px; }

  .calendar-header button { padding: 5px 10px; font-size: 14px; }
  .calendar-days span { font-size: 12px; }

  .event-item {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
  }

  .event-item img,
  .event-item video {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 600px) {
  .past-event-card img,
  .past-event-card video { height: 150px; }
}
