/* ==========================================================================
   SEGi Dental Society — Events & Workshops (`css/events.css`)
   Timeline Feeds, Interactive Date Badges & Status Progression
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Filter Navigation Pills
   -------------------------------------------------------------------------- */
.events-filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.5rem 0 3rem 0;
}

.filter-pill {
  background: var(--bg-card, #1a1e29);
  color: var(--text-muted, #94a3b8);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  padding: 0.45rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  border-color: var(--gold-accent, #e2b714);
  color: var(--text-main, #f8fafc);
}

.filter-pill.active {
  background: var(--gold-accent, #e2b714);
  color: #0d1117;
  border-color: var(--gold-accent, #e2b714);
  box-shadow: 0 0 12px rgba(226, 183, 20, 0.3);
}

/* --------------------------------------------------------------------------
   2. Timeline Container, Rows & Spine Geometry
   -------------------------------------------------------------------------- */
.timeline-container {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: flex-start;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.timeline-date-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

/* Vertical Connecting Spine Line */
.timeline-spine {
  position: absolute;
  top: 90px;
  bottom: -2rem;
  width: 2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.timeline-row.is-last-row .timeline-spine {
  display: none;
}

.spine-solid {
  background-color: var(--gold-accent, #e2b714);
}

.spine-dashed {
  background-image: linear-gradient(to bottom, var(--border-subtle, rgba(255, 255, 255, 0.2)) 50%, transparent 50%);
  background-size: 2px 10px;
  background-repeat: repeat-y;
}

.spine-gap {
  background-color: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* --------------------------------------------------------------------------
   3. Interactive Date Badge
   -------------------------------------------------------------------------- */
.date-badge {
  position: relative;
  z-index: 2;
  width: 80px;
  height: 85px;
  background: var(--bg-card, #161b22);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.date-badge:hover {
  border-color: var(--gold-accent, #e2b714);
}

.date-badge .month {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-accent, #e2b714);
}

.date-badge .day {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main, #ffffff);
  margin: 2px 0;
}

.date-badge .year {
  font-size: 0.7rem;
  color: var(--text-muted, #8b949e);
  font-weight: 600;
}

.date-badge.past-badge {
  opacity: 0.7;
  filter: grayscale(0.3);
}

.date-picker-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   4. Timeline Event Card & Media Posters
   -------------------------------------------------------------------------- */
.timeline-card {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  background: var(--bg-card, #161b22);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.timeline-card:hover {
  border-color: rgba(226, 183, 20, 0.4);
}

.timeline-card.sequence-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
}

/* Media Poster Container */
.timeline-media {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 210px;
  background: #0d1117;
  overflow: hidden;
}

.event-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Card Content Area */
.timeline-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main, #f0f6fc);
  margin: 0;
  line-height: 1.35;
}

.timeline-info p {
  font-size: 0.9rem;
  color: var(--text-muted, #8b949e);
  line-height: 1.5;
  margin: 0;
}

/* Meta Details Strip */
.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted, #8b949e);
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.event-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* --------------------------------------------------------------------------
   5. Category & Status Badges
   -------------------------------------------------------------------------- */
.event-tags {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tag-cat {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main, #c9d1d9);
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-status {
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

/* Status Progression Palette */
.tag-status.upcoming  { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.tag-status.ongoing   { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.tag-status.completed { background: rgba(226, 183, 20, 0.15); color: #fbbf24; border: 1px solid rgba(226, 183, 20, 0.3); }
.tag-status.postponed { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.tag-status.soon      { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.tag-status.cancelled { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Dropdown Hide/Show logic for Admin vs Public */
.status-dropdown {
  display: none;
  background: var(--bg-card, #161b22);
  cursor: pointer;
}

body.is-admin .is-editing .status-dropdown {
  display: inline-block;
}

body.is-admin .is-editing .status-badge-view {
  display: none;
}

/* --------------------------------------------------------------------------
   6. In-Place Editing & Admin Overlay Styles
   -------------------------------------------------------------------------- */
.timeline-card.is-editing [contenteditable="true"] {
  outline: 1px dashed var(--gold-accent, #e2b714);
  outline-offset: 3px;
  border-radius: 3px;
  background: rgba(226, 183, 20, 0.05);
}

.timeline-card.is-dirty {
  border-color: #f59e0b !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

/* Action Control Buttons (Top Right) */
.timeline-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: none;
  gap: 6px;
}

body.is-admin .timeline-card-actions {
  display: flex;
}

/* Poster Upload Hover Overlay */
.poster-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 17, 23, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.2s ease;
  z-index: 5;
}

body.is-admin .timeline-media:hover .poster-upload-overlay {
  opacity: 1;
}

/* Destination Link Field (Admin Mode) */
.event-link-bar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  margin-top: 0.5rem;
}

body.is-admin .event-link-bar {
  display: flex;
}

.event-link-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main, #f0f6fc);
  font-size: 0.8rem;
  outline: none;
}

/* Add Schedule Top Placeholder */
.add-card-placeholder {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  border: 2px dashed var(--border-subtle, rgba(255, 255, 255, 0.2));
  border-radius: 14px;
  color: var(--gold-accent, #e2b714);
  cursor: pointer;
  transition: all 0.2s ease;
}

body.is-admin .add-card-placeholder {
  display: flex;
}

.add-card-placeholder:hover {
  background: rgba(226, 183, 20, 0.05);
  border-color: var(--gold-accent, #e2b714);
}

.plus-icon {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   7. Drag & Drop Visual Feedback
   -------------------------------------------------------------------------- */
.timeline-row.hold-charging {
  outline: 2px dashed var(--gold-accent, #e2b714);
  outline-offset: 4px;
  border-radius: 12px;
}

.timeline-row.drag-ready {
  cursor: grab;
  opacity: 0.9;
}

.timeline-row.is-dragging {
  opacity: 0.3;
  transform: scale(0.98);
  cursor: grabbing;
}

/* --------------------------------------------------------------------------
   8. Pagination Controls
   -------------------------------------------------------------------------- */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2.5rem 0 1rem 0;
}

.pagination-indicator {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #8b949e);
}

/* --------------------------------------------------------------------------
   9. Circular Loaders & Staggered Row Entrance
   -------------------------------------------------------------------------- */
.timeline-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4.5rem 1rem;
  width: 100%;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--maroon-bright, #e11d48);
  border-right-color: var(--gold-accent, #e2b714);
  border-radius: 50%;
  animation: spinTimeline 0.85s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

body.light-theme .spinner-ring {
  border-color: rgba(0, 0, 0, 0.08);
  border-top-color: var(--maroon-base, #800000);
  border-right-color: var(--gold-accent, #e2b714);
}

@keyframes spinTimeline {
  to { transform: rotate(360deg); }
}

.spinner-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted, #8b949e);
  letter-spacing: 0.02em;
}

@keyframes timelineRowPopIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.timeline-row.progressive-reveal {
  animation: timelineRowPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --------------------------------------------------------------------------
   10. Responsive Adaptations
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .timeline-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .timeline-date-wrapper {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    height: auto;
  }

  .date-badge {
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    padding: 0.5rem 1rem;
  }

  .date-badge .day {
    font-size: 1.1rem;
    margin: 0;
  }

  .timeline-spine {
    display: none;
  }

  .timeline-card {
    grid-template-columns: 1fr;
  }

  .timeline-media {
    height: 180px;
    min-height: auto;
  }
}