/*========================================
= ARCHIVE EVENT LAYOUT (ONE PER ROW)     =
========================================*/

.event-archive-grid {
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Force full width for main containers on event archive */
/* Force full width for main containers on event archive */
.post-type-archive-event #primary,
.post-type-archive-event #main,
.event-archive-main {
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  /* max-width: 1000px; REMOVED per user request to use full width */
}

/* Ensure grid is full width within container */
.event-archive-grid {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

/* Header Styles (Matched to Profile Archive) */
.post-type-archive-event {
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --text-muted: #6b7280;
  --text-secondary: #4b5563;
}

.event-archive-main {
  background: var(--bg-gradient);
  padding: 20px 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
}

.event-archive-main .archive-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

.event-archive-main .archive-header {
  margin-bottom: 6px;
}

.event-archive-main .archive-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 !important;
}

.event-archive-main .archive-header-content {
  flex: 1;
  text-align: left;
}

.event-archive-main .archive-title {
  font-size: 2.6rem !important;
  font-weight: 700;
  margin: 0;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding-left: 12px;
  letter-spacing: -0.5px;
}

.event-archive-main .archive-subtitle {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-secondary);
  text-align: left;
  padding-left: 12px;
  margin-top: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.event-archive-main .btn-add-event {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  border-radius: 25px;
  background: var(--primary-gradient);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  margin-right: 5px;
}

.event-archive-main .btn-add-event svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.event-archive-main .btn-add-event:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.2);
  color: white;
}

/*========================================
= AVERAGE STAR RATING (From Profile)     =
========================================*/

.profile-average-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
  border-left: 4px solid #ffc107;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(255, 193, 7, 0.15);
  width: auto; /* Allow it to shrink/grow as needed */
}
.profile-average-rating .avg-single-star {
  color: #ffc107;
  font-size: 14px;
  line-height: 1;
}
.profile-average-rating .avg-info {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  line-height: 1;
}
.profile-average-rating .avg-value {
  font-weight: 700;
  color: #333;
}
.profile-average-rating .avg-slash,
.profile-average-rating .avg-max {
  color: #666;
  font-weight: 500;
}
.profile-average-rating .avg-count {
  color: #666;
  font-weight: 400;
  font-style: italic;
  margin-left: 2px;
}

/*========================================
= INVITE BAR                             =
========================================*/

/*========================================
= INVITE BAR                             =
========================================*/

.modern-event-card .event-card-invite-bar {
  border-top: 1px solid #eee;
  padding: 12px 24px;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: auto; /* Push to bottom if flex column */
}

/* Status badge */
.modern-event-card .event-card-invite-status {
  margin: 0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Colours for statuses */
.modern-event-card .status-pending {
  background: #fff8e1;
  color: #b7791f;
  border: 1px solid #fbd38d;
}

.modern-event-card .status-accepted {
  background: #def7ec;
  color: #03543f;
  border: 1px solid #84e1bc;
}

.modern-event-card .status-rejected {
  background: #fde8e8;
  color: #9b1c1c;
  border: 1px solid #f8b4b4;
}

/* Expert action buttons container */
.modern-event-card .event-card-expert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modern-event-card .expert-action-form {
  margin: 0;
}

.modern-event-card .expert-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.modern-event-card .expert-btn:active {
  transform: translateY(1px);
}

.modern-event-card .accept-btn {
  background: #0e9f6e;
  color: #fff;
}

.modern-event-card .accept-btn:hover {
  background: #057a55;
  box-shadow: 0 4px 6px rgba(14, 159, 110, 0.2);
}

.modern-event-card .reject-btn {
  background: #fff;
  color: #c81e1e;
  border: 1px solid #f8b4b4;
}

.modern-event-card .reject-btn:hover {
  background: #fde8e8;
  border-color: #f05252;
}

/*========================================
= PERSON CHIPS (expert & space)          =
========================================*/

.person-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  text-decoration: none;
  border: 1px solid #e5e7eb;
}

.person-chip.organiser-chip {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.person-chip:hover {
  background: #e5e7eb;
}

.person-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d1d5db;
  flex-shrink: 0;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.person-avatar-fallback {
  font-size: 11px;
  font-weight: 700;
  color: #111827;
}

.person-name {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}

/*========================================
= NO EVENTS MESSAGE                      =
========================================*/

.no-events-message {
  text-align: center;
  padding: 40px 10px;
  font-size: 15px;
  color: #666;
}

/*========================================
= EXPERTS GRID (MATCHING SINGLE SPACE)   =
========================================*/

.experts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.expert-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.expert-card:hover {
  background: #fbfbfb; /* var(--bg-surface) fallback */
}

.expert-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.expert-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.expert-avatar--blue {
  background: #e3f2fd;
  color: #1976d2;
  font-weight: 700;
  font-size: 24px;
}

.expert-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827; /* var(--text-primary) fallback */
  text-align: center;
  line-height: 1.3;
}

@media (max-width: 640px) {
  .experts-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .expert-avatar {
    width: 64px;
    height: 64px;
  }
  .expert-name {
    font-size: 13px;
  }
}

/*========================================
= EVENT CARD TABS                        =
========================================*/

.event-tab-nav {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 2px; /* Reduced gap */
  margin-bottom: 16px;
  border-bottom: 1px solid #e0e0e0; /* Material divider color */
  padding-bottom: 0; /* Tabs sit on the line */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.event-tab-nav::-webkit-scrollbar {
  display: none;
}

.event-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-bottom: 2px solid transparent; /* Indicator */
  padding: 8px 12px; /* Increased padding for better touch target and spacing */
  min-width: 60px; /* Increased min-width */
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  text-align: center;
  color: #5f6368; /* Material secondary text */
  border-radius: 4px 4px 0 0; /* Rounded top corners */
  gap: 4px; /* Ensure gap between icon and text */
}

.event-tab-btn:hover {
  background-color: #f5f5f5;
  color: #202124;
}

.event-tab-btn.active {
  color: #1a73e8; /* Material primary blue */
  border-bottom-color: #1a73e8;
  background: none; /* Remove background for cleaner look */
}

.event-tab-btn .material-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  margin-bottom: 4px;
  /* Ensure SVG doesn't overflow */
  min-width: 24px;
  min-height: 24px;
}

.tab-label {
  font-family: "Roboto", sans-serif;
  font-size: 10px; /* Reduced font size */
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2px; /* Reduced tracking */
  line-height: 1.2;
}

/* Ensure icons in info rows are also sized correctly */
.event-info-icon .material-icon {
  width: 20px;
  height: 20px;
  fill: #5f6368;
}

.event-info-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
  font-size: 14px;
  color: #3c4043;
}

.event-info-icon {
  margin-right: 12px;
  display: flex;
  align-items: center;
  height: 20px; /* Align with text line-height */
}

.event-info-text {
  flex: 1;
}

.event-info-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #5f6368;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.event-info-value {
  color: #202124;
  font-weight: 400;
}

.event-info-value.block {
  margin-top: 4px;
}

.block-content {
  flex-direction: column;
}

.block-content .event-info-icon {
  margin-bottom: 8px;
}

.event-tab-content {
  position: relative;
  min-height: 100px;
  font-family: "Roboto", sans-serif; /* Ensure font consistency */
  color: #202124;
}

.event-tab-pane {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Material Icon General Style */
.material-icon {
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
}

/* Refined Meta Grid for Info Tab */
.event-card-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  margin-bottom: 16px;
}

.meta-item {
  display: flex;
  align-items: center;
  font-size: 14px;
  line-height: 20px;
  color: #3c4043;
}

.meta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: #5f6368;
}

.meta-icon .material-icon {
  width: 20px;
  height: 20px;
}

.meta-label {
  font-weight: 500;
  margin-right: 4px;
  color: #5f6368;
}

.meta-value {
  color: #202124;
}

/* Refined Details Rows & Blocks */
.details-row,
.details-block,
.details-grid {
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.details-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #5f6368;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.details-value,
.details-content {
  color: #202124;
}

.details-row {
  display: flex;
  align-items: baseline;
}

.details-row .details-label {
  margin-bottom: 0;
  margin-right: 8px;
  min-width: 80px; /* Align values */
}

/* Experts Grid Refinement */
.experts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

/* ============================================================================
   FILTER UI FOR EVENT ARCHIVE (Copied & Adapted from Space Archive)
   ============================================================================ */

.filter-space-wrapper {
  margin: 20px 0;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e6e8ec;
  font-family: "Inter", sans-serif;
}

/* Top Bar */
/* Top Bar */
.filter-space-wrapper .filter-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Filter Button */
.filter-space-wrapper .filter-toggle-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.filter-space-wrapper .filter-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

/* Result Count */
.filter-space-wrapper .result-count {
  color: #6b7280; /* text-muted */
  font-size: 0.95rem;
  font-weight: 700;
  transition: opacity 0.2s;
  margin-left: 12px;
  flex-grow: 1;
}

/* Scroll row */
.filter-space-wrapper .filter-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: scroll; /* Force visible scrollbar */
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: #6366f1 transparent;
}

/* Custom Scrollbar for Filters */
.filter-space-wrapper .filter-scroll-row::-webkit-scrollbar {
    height: 6px;
}
.filter-space-wrapper .filter-scroll-row::-webkit-scrollbar-track {
    background: transparent;
}
.filter-space-wrapper .filter-scroll-row::-webkit-scrollbar-thumb {
    background-color: #6366f1;
    border-radius: 4px;
}

.filter-col {
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Labels */
.filter-space-wrapper label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #444;
  margin-bottom: 4px;
}

/* Inputs (Material style) */
.filter-space-wrapper input[type="number"],
.filter-space-wrapper input[type="text"],
.filter-space-wrapper input[type="date"],
.filter-space-wrapper select,
.filter-space-wrapper .filter-input-full {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  font-size: 0.95rem;
  background: #fff;
  transition: 0.25s ease;
  box-sizing: border-box; /* Ensure padding doesn't affect width */
  display: block;
}

.filter-space-wrapper input:focus,
.filter-space-wrapper select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}

/* Hidden state wrapper */
.hidden-filter {
  display: none !important;
}

/* Force Max Fee input width (Matched to Manage Event styles) */
#event-fee-wrap input {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 8px; /* --radius-md fallback */
  border: 1px solid #dee2e6; /* --color-border fallback */
  background: #fff;
  font-size: 16px;
  color: #181c20; /* --color-text fallback */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* --shadow-sm fallback */
}

/* Buttons */
.filter-space-wrapper .filter-actions {
  display: flex;
  gap: 10px;
}

.filter-space-wrapper .btn-apply {
  background: linear-gradient(
    135deg,
    #6366f1 0%,
    #8b5cf6 100%
  ); /* Primary gradient */
  padding: 8px 20px;
  border-radius: 25px;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-space-wrapper .btn-apply:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

.filter-space-wrapper .btn-reset {
  border: 2px solid #e5e7eb;
  padding: 8px 20px;
  border-radius: 25px;
  background: #fff;
  font-weight: 600;
  color: #6b7280; /* text-muted */
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-space-wrapper .btn-reset:hover {
  background: #f9fafb;
  color: #111827;
  border-color: #d1d5db;
}

@media (max-width: 640px) {
  .post-type-archive-event #primary,
  .post-type-archive-event #main {
    padding: 0 !important;
  }
}

/* Desktop Centering & Layout (Matched to Single Event) */
@media (min-width: 768px) {
  .event-archive-grid {
    max-width: 100%; /* Match container/filter width */
    margin: 40px 0; /* Align vertical spacing, remove auto centering since it is full width */
    padding: 0; /* Remove padding to align flush with filter */
  }

  .event-card {
    background: #fff; /* Ensure card has background on desktop */
    border-radius: 16px; /* Restore border radius for desktop card look */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* Add shadow for desktop */
    border: 1px solid #eaeaea;
  }

  .event-card-header {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    padding: 24px 32px 16px; /* More padding on desktop */
  }

  .event-card-details {
    padding: 0 32px 24px;
  }

  /* Smaller, uncropped image for desktop side-by-side layout */
  .event-card-image,
  .placeholder-image {
    height: auto; /* Natural height */
    width: 100%; /* Fill the column */
    aspect-ratio: auto; /* Ensure aspect ratio is preserved */
    border-radius: 12px;
    object-fit: contain; /* Prevent cropping */
  }

  /* Align title left on desktop */
  .event-card-title-under {
    text-align: left;
    margin-top: 0;
  }

  /* Keep Rating and Recommend side-by-side on Desktop */
  .event-card-summary-topline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .event-card-recommend {
    margin-left: auto; /* Push to right */
  }
}

/* Force left alignment for the rating component within the event card */
.event-card-rating .profile-average-rating {
  justify-content: flex-start;
  margin: 0; /* Remove any auto margins */
}

/* ==========================================================================
   MODERN EVENT CARD STYLES (Copied from event.css)
   ========================================================================== */

.modern-event-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 30px;
  border: 1px solid #eee;
}

.modern-event-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

@media (min-width: 768px) {
  .modern-event-card {
    flex-direction: row;
    align-items: stretch;
  }
  .modern-card-image-wrapper {
    width: 35%;
    min-width: 250px;
    position: relative;
    /* Prevent image from stretching to match tall content */
    align-self: flex-start;
  }

  .modern-card-content {
    width: 65%;
  }
  
  /* If content is shorter than image, image sets height */
}

/* Mobile Default: Padding Hack for strictly controlled height */
.modern-card-image-wrapper {
  position: relative;
  background: #f0f0f0;
  width: 100%;
  height: 0 !important;
  padding-bottom: 66.66% !important; /* 3:2 Ratio */
  overflow: hidden;
}

/* Desktop Override: Use modern aspect-ratio */
@media (min-width: 768px) {
  .modern-card-image-wrapper {
    height: auto !important;
    padding-bottom: 0 !important;
    aspect-ratio: 3 / 2 !important;
  }
}

.modern-card-image-link {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.modern-card-image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modern-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 0.9rem;
  background: #eee;
}

.modern-card-organiser-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  padding: 4px 10px 4px 4px;
  border-radius: 50px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  max-width: calc(100% - 24px);
}

.modern-card-organiser-overlay .person-chip {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #333;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  border: none;
  padding: 0;
}

.modern-card-organiser-overlay .person-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 8px;
  flex-shrink: 0;
}

.modern-card-organiser-overlay .person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modern-card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.modern-card-header {
  margin-bottom: 20px;
}

.modern-card-title {
  margin: 0 0 10px 0;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

.modern-card-title a {
  color: #222;
  text-decoration: none;
  transition: color 0.2s;
}

.modern-card-title a:hover {
  color: #0073aa; /* Use theme color */
}

/* Preserve existing layout for rating/recommend */
.event-card-summary-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 15px;
  flex-wrap: wrap;
}

.modern-card-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 500px) {
  .modern-card-details {
    grid-template-columns: 1fr 1fr;
  }
}

.modern-detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #555;
  font-size: 0.95rem;
}

.modern-icon {
  width: 18px;
  height: 18px;
  fill: #777;
  flex-shrink: 0;
}

.modern-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.modern-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #222;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.modern-view-btn:hover {
  background: #444;
  color: #fff;
}

.modern-view-btn svg {
  fill: currentColor;
}

/* Create Space Helper (Copied from Archive Job) */
.create-space-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center; /* Centered alignment */
}

.create-space-helper {
  font-size: 0.9rem; /* Increased size */
  font-weight: 500; /* Medium weight */
  color: #4b5563; /* Darker gray for better contrast */
  margin-top: 6px;
  letter-spacing: 0.01em; /* Slight spacing for quality */
}

/* ============================================================================
   DESKTOP SIDEBAR LAYOUT (Profile Archive Style)
   ============================================================================ */
@media (min-width: 1024px) {

  /* 1. Main Grid Container - Structure Matched to Profile Archive */
  .event-archive-main {
    display: grid !important;
    grid-template-columns: minmax(0, 800px) 260px !important; /* Reduced Content | Sidebar */
    gap: 40px;
    justify-content: center; /* Center the grid blocks */
    align-items: start;
    width: 100% !important;
    max-width: 100% !important;
    border: none !important;
    padding: 0 40px;
    margin: 0 auto;
    position: relative;
  }
  
  /* Safety: Unwrap potential intermediate containers if they exist */
  .event-archive-main > .archive-header,
  .event-archive-main > .archive-container {
      display: contents;
  }

  /* 2. Grid Item Placement */
  .archive-header-top {
    grid-column: 1;
    grid-row: 1;
    margin-top: 0;
    width: 100%;
  }

  .event-archive-grid {
    grid-column: 1;
    grid-row: 2;
    margin-top: 10px;
    max-width: 100%;
  }

  .posts-pagination,
  .no-events-message {
    grid-column: 1;
    grid-row: 3;
  }

  /* 3. Filter Sidebar */
  .filter-space-wrapper {
    grid-column: 2;
    grid-row: 1 / span 10;
    position: sticky;
    top: 80px; /* Adjusted for sticky menu */
    margin: 0;
    
    /* Layout for vertical stack */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px); /* Adjusted for safe area */
    overflow: hidden;
    padding: 10px 4px 10px 10px; /* Minimal padding */
  }

  /* 4. Filter Internals - Vertical Transformation */
  
  /* Hide Mobile Toggle */
  .filter-space-wrapper .filter-toggle-btn {
    display: none !important;
  }

  /* Ensure form takes full space */
  #event-filter-form {
      display: flex;
      flex-direction: column;
      flex: 1;
      overflow: hidden;
      min-height: 0;
      width: 100%;
  }

  /* Force Panel Visible */
  #event-filter-panel, 
  .filter-space-wrapper .filter-panel {
    display: flex !important;
    flex-direction: column;
    animation: none;
    flex: 1;
    overflow: hidden; /* Manage scroll inside row */
    margin-top: 10px;
    min-height: 0;
    padding: 0;
    width: 100%;
  }

  /* Vertical Scroll Row */
  .filter-space-wrapper .filter-scroll-row {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    gap: 16px;
    padding-bottom: 10px;
    padding-right: 6px;
    height: 100%;
    width: 100%;
    /* max-height: 100%; Removed */
  }

  /* Columns fill width */
  .filter-col {
    width: 100%;
    min-width: 0;
  }

  /* Filter Top Area (Actions) */
  .filter-space-wrapper .filter-top {
    flex-direction: column;
    align-items: stretch; gap: 10px; margin-bottom: 0;
  }
  
  .filter-space-wrapper .filter-actions {
    width: 100%;
    justify-content: space-between;
    /* Put buttons at very top if desired, already in .filter-top */
  }
  
  .filter-space-wrapper .btn-apply,
  .filter-space-wrapper .btn-reset {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}

/* ============================================================================
   DESKTOP IMPROVEMENTS (Min Width 1025px) - Matched to Archive Space
   ============================================================================ */

@media (min-width: 1025px) {
    /* Make container span full content width on desktop */
    .event-archive-main .archive-container {
        max-width: 100%;
        width: 100%;
    }

    /* Add spacing from top navigation and proper left-right layout */
    .event-archive-main .archive-header-top {
        margin-top: 20px;
        align-items: center; /* Center align title and button vertically */
        justify-content: space-between; /* Push content left, button right */
        display: flex;
        width: 100%;
    }

    /* Increase Header Font Sizes for Large Screens */
    .event-archive-main .archive-title {
        font-size: 3rem; /* Significantly larger */
        padding-left: 10px; /* Desktop padding */
    }

    .event-archive-main .archive-subtitle {
        font-size: 1.8rem; /* Matched Space font size */
        padding-left: 10px; /* Match title padding */
        margin-top: 0; /* Reduced gap */
    }

    .event-archive-main .btn-add-event {
        font-size: 1rem;
        padding: 10px 24px; /* Larger button for desktop */
        flex-shrink: 0; /* Don't shrink button */
    }
    
    /* Ensure Header Content takes only needed width, not flex:1 */
    .event-archive-main .archive-header-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        flex: 0 1 auto; /* Don't grow to fill space on desktop */
    }
}

/* ============================================================================
   MOBILE EDGE-TO-EDGE FILTER & STICKY
   ============================================================================ */
@media (max-width: 1023px) {
  /* Keep top/bottom padding, only remove left/right for edge-to-edge */
  .event-archive-main {
       padding-left: 0 !important;
       padding-right: 0 !important;
       overflow-x: visible; /* Ensure sticky works */
  }

  /* Remove container horizontal padding on mobile to match Profile */
  .event-archive-main .archive-container {
       padding-left: 0 !important;
       padding-right: 0 !important;
  }

   /* Edge-to-edge filter container */
  .filter-space-wrapper {
    margin: 0 0 20px 0;
    padding: 12px 16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;

    /* Make Sticky */
    position: sticky;
    top: 75px; /* Matches Profile Archive */
    z-index: 99;
    background: #ffffff;
  }
}
