/* =============================================================================
   EVENTS PAGE — THG (Tallinna Humanitaargümnaasium)
   Adapted from College-pro events-extended layout, THG colour palette.
   All classes prefixed ep- to avoid collisions.
   ============================================================================= */

/* ── SECTION WRAPPER ─────────────────────────────────────────────────────────── */

.ep-events-extended {
  padding: 60px 0 80px;
  background: var(--thg-body-bg, #f8f7f4);
}

/* ── PAGE HEADER ─────────────────────────────────────────────────────────────── */

.ep-page-header {
  text-align: center;
  padding-bottom: 50px;
}

.ep-page-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--thg-green-forest);
  position: relative;
  padding-bottom: 1rem;
  margin-bottom: 0.75rem;
}

.ep-page-header h2::before {
  content: '';
  position: absolute;
  display: block;
  width: 160px;
  height: 1px;
  background: #ddd;
  bottom: 0;
  left: calc(50% - 80px);
}

.ep-page-header h2::after {
  content: '';
  position: absolute;
  display: block;
  width: 48px;
  height: 3px;
  background: var(--thg-orange);
  border-radius: 2px;
  bottom: 0;
  left: calc(50% - 24px);
}

/* ── EXPOSED FILTERS ─────────────────────────────────────────────────────────── */

.ep-exposed-filters {
  margin-bottom: 30px;
}

/* ── EVENT LIST ──────────────────────────────────────────────────────────────── */

.ep-events-list {
  margin-bottom: 30px;
}

/* ── EVENT ITEM (horizontal card) ────────────────────────────────────────────── */

.ep-event-item {
  display: flex;
  margin-bottom: 24px;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  background: white;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ep-event-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* ── DATE BADGE (left strip) ─────────────────────────────────────────────────── */

.ep-event-date {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 100px;
  padding: 20px;
  background: var(--thg-orange);
  color: white;
  text-align: center;
}

.ep-event-date__day {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.ep-event-date__month {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

/* ── EVENT CONTENT (right side) ──────────────────────────────────────────────── */

.ep-event-content {
  padding: 24px;
  flex: 1;
  min-width: 0;
}

/* Category badge */
.ep-event-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ep-event-badge--school    { background: rgba(45, 90, 48, 0.1);   color: var(--thg-green-forest); }
.ep-event-badge--sports    { background: rgba(30, 136, 229, 0.1); color: #1e88e5; }
.ep-event-badge--arts      { background: rgba(156, 39, 176, 0.1); color: #9c27b0; }
.ep-event-badge--academic  { background: rgba(232, 114, 12, 0.1); color: var(--thg-orange); }
.ep-event-badge--community { background: rgba(0, 150, 136, 0.1);  color: #009688; }
.ep-event-badge--parents   { background: rgba(233, 30, 99, 0.1);  color: #e91e63; }
.ep-event-badge--guests    { background: rgba(121, 85, 72, 0.1);  color: #795548; }

/* Title */
.ep-event-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--thg-green-forest);
  line-height: 1.3;
}

.ep-event-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.ep-event-title a:hover {
  color: var(--thg-orange);
}

/* Meta row (time, location) */
.ep-event-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  color: #666;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.ep-event-meta span {
  display: inline-flex;
  align-items: center;
}

.ep-event-meta i {
  margin-right: 6px;
  font-size: 1rem;
  color: var(--thg-orange);
}

/* Description */
.ep-event-description {
  margin-bottom: 14px;
  color: #555;
  line-height: 1.7;
  font-size: 0.9rem;
}

/* Action buttons */
.ep-event-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.ep-btn-details {
  display: inline-flex;
  align-items: center;
  color: var(--thg-orange);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.3s ease;
}

.ep-btn-details i {
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.ep-btn-details:hover {
  color: var(--thg-green-forest);
}

.ep-btn-details:hover i {
  transform: translateX(5px);
}

.ep-btn-register {
  display: inline-flex;
  align-items: center;
  background: var(--thg-green-forest);
  color: white !important;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.25s ease;
}

.ep-btn-register i {
  margin-left: 5px;
}

.ep-btn-register:hover {
  background: var(--thg-orange);
  color: white !important;
}

/* Registration link wrapper (preserves Drupal's <a> tag) */
.ep-btn-register-wrap {
  display: inline-flex;
  align-items: center;
}

.ep-btn-register-wrap .field,
.ep-btn-register-wrap .field__item {
  display: inline-flex;
  align-items: center;
}

.ep-btn-register-wrap a {
  display: inline-flex;
  align-items: center;
  background: var(--thg-green-forest);
  color: white !important;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.25s ease;
}

.ep-btn-register-wrap a:hover {
  background: var(--thg-orange);
  color: white !important;
}

/* ── PAGINATION ──────────────────────────────────────────────────────────────── */

.ep-pagination {
  margin-top: 20px;
  text-align: center;
}

.ep-pagination .pager__items {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 6px;
}

.ep-pagination .pager__item a,
.ep-pagination .pager__item span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.ep-pagination .pager__item a:hover {
  background: rgba(232, 114, 12, 0.1);
  border-color: rgba(232, 114, 12, 0.3);
  color: var(--thg-orange);
}

.ep-pagination .pager__item--active a,
.ep-pagination .pager__item--active span,
.ep-pagination .pager__item.is-active a,
.ep-pagination .pager__item.is-active span {
  background: var(--thg-orange);
  border-color: var(--thg-orange);
  color: white;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────────────── */

.ep-empty {
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-size: 1.05rem;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────────── */

.ep-sidebar-item {
  background: white;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.06);
  margin-bottom: 24px;
}

.ep-sidebar-item h4 {
  margin-bottom: 18px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--thg-green-forest);
  position: relative;
  padding-bottom: 12px;
}

.ep-sidebar-item h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--thg-orange);
  border-radius: 2px;
}

/* ── Sidebar: Search ─────────────────────────────────────────────────────────── */

.ep-search-input-group {
  position: relative;
}

.ep-search-input-group .form-control {
  border-radius: 50px;
  padding-right: 52px;
  height: 48px;
  border: 1px solid #ddd;
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.ep-search-input-group .form-control:focus {
  box-shadow: none;
  border-color: rgba(232, 114, 12, 0.5);
}

.ep-search-btn {
  position: absolute;
  right: 0;
  top: 0;
  height: 48px;
  width: 48px;
  z-index: 5;
  border-radius: 50%;
  background: var(--thg-orange);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.3s ease;
}

.ep-search-btn:hover {
  background: var(--thg-green-forest);
}

/* Clear search button (X icon) */
.ep-search-clear {
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ddd;
  color: #555;
  text-decoration: none;
  font-size: 0.75rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.ep-search-clear:hover {
  background: #c00;
  color: white;
}

.ep-search-input-group .form-control:has(~ .ep-search-clear) {
  padding-right: 88px;
}

/* ── Sidebar: Categories ─────────────────────────────────────────────────────── */

.ep-sidebar-categories ul {
  margin: 0;
  padding: 0;
}

.ep-sidebar-categories li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.ep-sidebar-categories li:last-child {
  border-bottom: none;
}

.ep-sidebar-categories a {
  display: flex;
  justify-content: space-between;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.ep-sidebar-categories a span {
  color: #999;
  font-size: 0.85rem;
}

.ep-sidebar-categories a:hover {
  color: var(--thg-orange);
}

/* ── Sidebar: Featured event ─────────────────────────────────────────────────── */

.ep-featured-event {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.ep-featured-event img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.ep-featured-event__placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--thg-green-forest) 0%, #4a8c4f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.4);
}

.ep-featured-event__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
}

.ep-featured-event__overlay h5 {
  color: white;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.ep-featured-event__date {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.ep-featured-event__date i {
  margin-right: 5px;
}

.ep-featured-event .ep-btn-register {
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 50px;
  background: var(--thg-orange);
}

/* ── Sidebar: Google Calendar ────────────────────────────────────────────────── */

.ep-calendar-widget {
  border-radius: 6px;
  overflow: hidden;
}

.ep-calendar-widget iframe {
  display: block;
  width: 100%;
  border-radius: 6px;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────────── */

@media (max-width: 991px) {
  .ep-sidebar {
    margin-top: 40px;
  }
}

@media (max-width: 767px) {
  .ep-events-extended {
    padding: 40px 0 60px;
  }

  .ep-event-item {
    flex-direction: column;
  }

  .ep-event-date {
    min-width: 100%;
    padding: 14px;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }

  .ep-event-date__day {
    font-size: 1.5rem;
  }

  .ep-event-date__day::after {
    content: ',';
  }

  .ep-event-date__month {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
  }

  .ep-event-content {
    padding: 18px;
  }

  .ep-event-meta {
    flex-direction: column;
    gap: 8px;
  }

  .ep-event-title {
    font-size: 1.1rem;
  }

  .ep-page-header {
    padding-bottom: 30px;
  }

  .ep-page-header h2 {
    font-size: 1.6rem;
  }
}

/* ── DARK MODE ───────────────────────────────────────────────────────────────── */

[data-bs-theme="dark"] .ep-events-extended {
  background: #111814;
}

[data-bs-theme="dark"] .ep-page-header h2 {
  color: #a8d5aa;
}

[data-bs-theme="dark"] .ep-page-header h2::before {
  background: #2a3a2c;
}

/* Event item */
[data-bs-theme="dark"] .ep-event-item {
  background: #1c2b1e;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .ep-event-title {
  color: #a8d5aa;
}

[data-bs-theme="dark"] .ep-event-title a:hover {
  color: var(--thg-orange);
}

[data-bs-theme="dark"] .ep-event-meta {
  color: #8a9f8b;
}

[data-bs-theme="dark"] .ep-event-description {
  color: #9ab09b;
}

[data-bs-theme="dark"] .ep-btn-details {
  color: var(--thg-orange);
}

[data-bs-theme="dark"] .ep-btn-details:hover {
  color: #a8d5aa;
}

/* Category badges — dark mode */
[data-bs-theme="dark"] .ep-event-badge--school    { background: rgba(45, 90, 48, 0.25); }
[data-bs-theme="dark"] .ep-event-badge--sports    { background: rgba(30, 136, 229, 0.2); }
[data-bs-theme="dark"] .ep-event-badge--arts      { background: rgba(156, 39, 176, 0.2); }
[data-bs-theme="dark"] .ep-event-badge--academic  { background: rgba(232, 114, 12, 0.2); }
[data-bs-theme="dark"] .ep-event-badge--community { background: rgba(0, 150, 136, 0.2); }
[data-bs-theme="dark"] .ep-event-badge--parents   { background: rgba(233, 30, 99, 0.2); }
[data-bs-theme="dark"] .ep-event-badge--guests    { background: rgba(121, 85, 72, 0.2); }

/* Pagination — dark mode */
[data-bs-theme="dark"] .ep-pagination .pager__item a,
[data-bs-theme="dark"] .ep-pagination .pager__item span {
  border-color: #2a3a2c;
  color: #9ab09b;
}

[data-bs-theme="dark"] .ep-pagination .pager__item a:hover {
  background: rgba(232, 114, 12, 0.15);
  border-color: rgba(232, 114, 12, 0.3);
  color: var(--thg-orange);
}

/* Sidebar — dark mode */
[data-bs-theme="dark"] .ep-sidebar-item {
  background: #1c2b1e;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .ep-sidebar-item h4 {
  color: #a8d5aa;
}

[data-bs-theme="dark"] .ep-search-input-group .form-control {
  background: #141f16;
  border-color: #2a3a2c;
  color: #c8d8c9;
}

[data-bs-theme="dark"] .ep-search-input-group .form-control::placeholder {
  color: #6b8b6d;
}

[data-bs-theme="dark"] .ep-sidebar-categories li {
  border-bottom-color: #243024;
}

[data-bs-theme="dark"] .ep-sidebar-categories a {
  color: #9ab09b;
}

[data-bs-theme="dark"] .ep-sidebar-categories a span {
  color: #6b8b6d;
}

[data-bs-theme="dark"] .ep-sidebar-categories a:hover {
  color: var(--thg-orange);
}

[data-bs-theme="dark"] .ep-featured-event__placeholder {
  background: linear-gradient(135deg, #1c2b1e 0%, #2d5a30 100%);
}

[data-bs-theme="dark"] .ep-empty {
  color: #6b8b6d;
}

/* =============================================================================
   SINGLE EVENT PAGE
   Classes prefixed ep-single to avoid collisions.
   ============================================================================= */

.ep-single-event {
  padding: 60px 0 80px;
  background: var(--thg-body-bg, #f8f7f4);
}

/* Image */
.ep-single__image {
  margin-bottom: 28px;
  border-radius: 10px;
  overflow: hidden;
}

.ep-single__image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

/* Meta row */
.ep-single__meta-row {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.ep-single__meta-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: white;
  padding: 16px 20px;
  border-radius: 10px;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.06);
  flex: 1;
  min-width: 160px;
}

.ep-single__meta-card > i {
  font-size: 1.4rem;
  color: var(--thg-orange);
  margin-top: 2px;
}

.ep-single__meta-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  margin-bottom: 2px;
}

.ep-single__meta-value {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
}

/* Title */
.ep-single__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--thg-green-forest);
  margin-bottom: 24px;
  line-height: 1.3;
}

/* Body */
.ep-single__body {
  margin-bottom: 32px;
  color: #555;
  line-height: 1.8;
  font-size: 0.95rem;
}

/* Registration CTA */
.ep-single__registration {
  margin-bottom: 40px;
}

.ep-single__registration .field__label {
  display: none;
}

.ep-single__registration .field {
  display: block;
}

.ep-single__registration .field__item {
  display: inline;
}

.ep-single__registration a {
  display: inline-flex;
  align-items: center;
  background: var(--thg-orange);
  color: white !important;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.25s ease, transform 0.25s ease;
  /* Override .node__content a / .field__item a inherited underline/padding */
  background-image: none;
  padding-bottom: 12px;
}

.ep-single__registration a:hover {
  background: var(--thg-green-forest);
  color: white !important;
  transform: translateY(-2px);
}

/* ── SINGLE EVENT — Responsive ─────────────────────────────────────────────── */

@media (max-width: 991px) {
  .ep-single-event .ep-sidebar {
    margin-top: 40px;
  }
}

@media (max-width: 767px) {
  .ep-single-event {
    padding: 40px 0 60px;
  }

  .ep-single__meta-row {
    flex-direction: column;
  }

  .ep-single__meta-card {
    min-width: 100%;
  }

  .ep-single__title {
    font-size: 1.5rem;
  }
}

/* ── SINGLE EVENT — Dark mode ──────────────────────────────────────────────── */

[data-bs-theme="dark"] .ep-single-event {
  background: #111814;
}

[data-bs-theme="dark"] .ep-single__meta-card {
  background: #1c2b1e;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .ep-single__meta-label {
  color: #6b8b6d;
}

[data-bs-theme="dark"] .ep-single__meta-value {
  color: #c8d8c9;
}

[data-bs-theme="dark"] .ep-single__title {
  color: #a8d5aa;
}

[data-bs-theme="dark"] .ep-single__body {
  color: #9ab09b;
}
