/* Community Calendar Styles */

/* Sticky topicbar (below hero) */
.topicbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--line, #e6e9ee);
}

.topicbar .wrap {
  padding-top: 12px;
  padding-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: space-between;
}

/* Filter chips in topicbar */
.topicbar .chips {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.topicbar .chips::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.topicbar .chip,
.topicbar .toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-size: 0.9rem;
}

.topicbar .chip:hover,
.topicbar .toggle:hover {
  border-color: var(--ink);
}

.topicbar .chip.is-active,
.topicbar .toggle.is-active {
  background: #0b1d32;
  color: #fff;
  border-color: #0b1d32;
}

/* View toggle in topicbar */
.topicbar .viewtoggle {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ======================================
   CATEGORY DROPDOWN (Mobile/Tablet)
   ====================================== */

/* Hide dropdown on desktop, show chips */
.category-dropdown {
  display: none;
}

.topicbar .chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

/* ======================================
   DROPDOWN STYLING
   ====================================== */

.category-select {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink, #0E2A47);
  background-color: #fff;
  border: 1px solid var(--line, #e6e9ee);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  
  /* Custom dropdown arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230E2A47' d='M1.41 0L6 4.59L10.59 0L12 1.41l-6 6l-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.category-select:hover {
  border-color: var(--ink, #0E2A47);
  background-color: rgba(14, 42, 71, 0.02);
}

.category-select:focus {
  outline: none;
  border-color: var(--accent, #0b9cb3);
  box-shadow: 0 0 0 3px rgba(11, 156, 179, 0.1);
}

/* Calendar header with day names */
.month-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.day-header {
  font-weight: 700;
  color: var(--muted, #5b6472);
  font-size: 0.9rem;
  text-align: center;
  padding: 8px;
}

/* Month grid */
.month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 120px;
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.dow {
  font-weight: 700;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 8px;
}

.date {
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
}

.pill {
  display: block;
  margin-top: 6px;
  font-size: .85rem;
  color: var(--ink);
  font-weight: 600;
  border-bottom: none;
  background: var(--foam);
  padding: 4px 8px;
  border-radius: 6px;
}

/* Event list */
.list {
  display: grid;
  gap: 12px;
}

.event {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  min-height: 120px; /* Ensure minimum height */
}

.event .thumb {
  background: #f2f4f7;
  position: relative;
  overflow: hidden;
  height: 100%; /* Fill full height of event container */
  min-height: 120px;
}

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

.event .meta {
  padding: 16px 18px;
  display: flex;
  align-items: center; /* Vertically center the single line */
}

/* Single horizontal line for all meta */
.event .meta .meta-line {
  display: flex;
  align-items: center; /* Vertically center all text in the line */
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  line-height: 1.5; /* Consistent line height */
}

/* Date styling */
.event .meta .date {
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5 !important;
  display: inline-block;
  vertical-align: middle !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Event title link */
.event .meta .event-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 1.125rem;
  text-decoration: none;
  border-bottom: none;
  line-height: 1.5 !important;
  display: inline-block;
  vertical-align: middle !important;
  margin: 0 !important;
  padding: 0 !important;
}

.event .meta .event-title:hover {
  color: var(--accent);
}

/* Time and location */
.event .meta .time,
.event .meta .loc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5 !important;
  display: inline-block;
  vertical-align: middle !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Pipe separator */
.event .meta .pipe {
  color: var(--line);
  font-weight: 300;
  padding: 0 2px !important;
  line-height: 1.5 !important;
  display: inline-block;
  vertical-align: middle !important;
  margin: 0 !important;
}

/* Old h3 styles removed - now using .event-title in meta-line */

/* Tighter spacing between calendar and list */
#monthview.section {
  padding-bottom: 64px;
}

#listview.section {
  padding-top: 40px;
}

/* View visibility controlled by PHP inline styles based on view parameter */

/* Responsive */

/* Mobile/Tablet: Show dropdown, hide chips */
@media (max-width: 768px) {
  .category-dropdown {
    display: block;
    flex: 1;
    min-width: 0;
  }
  
  .topicbar .chips {
    display: none !important;
  }
  
  .topicbar .wrap {
    gap: 12px;
  }
  
  .topicbar .viewtoggle {
    gap: 8px;
  }
  
  .topicbar .toggle {
    font-size: 0.85rem;
    padding: 9px 12px;
  }
}

/* Small mobile optimization */
@media (max-width: 480px) {
  .category-select {
    font-size: 0.85rem;
    padding: 9px 14px;
    padding-right: 36px;
  }
  
  .topicbar .wrap {
    gap: 10px;
  }
  
  .topicbar .toggle {
    font-size: 0.8rem;
    padding: 8px 10px;
  }
}

@media (max-width: 980px) {
  .month {
    gap: 6px;
  }

  .day {
    min-height: 100px;
    padding: 6px;
  }

  .pill {
    font-size: .75rem;
    padding: 3px 6px;
  }
}

@media (max-width: 640px) {
  .month {
    grid-template-columns: repeat(7, 1fr);
    gap: 3px !important;
    margin: 0 -8px;
  }

  .day {
    min-height: 65px;
    padding: 2px;
  }

  .dow {
    font-size: .65rem;
    padding: 2px 0;
  }

  .date {
    font-size: .75rem;
  }

  .pill {
    font-size: .6rem;
    padding: 1px 3px;
    margin-top: 2px;
    line-height: 1.3;
  }

  .event {
    grid-template-columns: 100px 1fr;
    gap: 0;
    min-height: 100px;
  }

  .event .thumb {
    min-height: 100px;
  }

  .event .meta {
    padding: 12px 14px;
  }

  .event .meta .event-title {
    font-size: 1rem;
    line-height: 1.5 !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .event .meta .date,
  .event .meta .time,
  .event .meta .loc {
    font-size: 0.9rem;
    line-height: 1.5 !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .event .meta .meta-line {
    gap: 8px;
    align-items: center; /* Ensure center alignment on mobile too */
  }
  
  .event .meta .pipe {
    line-height: 1.5 !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 2px !important;
  }
  
  /* Make topicbar scrollable on mobile */
  .topicbar .wrap {
    flex-wrap: nowrap;
    overflow-x: visible;
  }
  
  .topicbar .chip,
  .topicbar .toggle {
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .topicbar .viewtoggle {
    flex-shrink: 0;
  }
}

/* Extra small screens - even more compact calendar */
@media (max-width: 400px) {
  .month {
    gap: 2px !important;
    margin: 0 -10px;
  }

  .day {
    min-height: 60px;
    padding: 1px;
  }

  .dow {
    font-size: .6rem;
  }

  .date {
    font-size: .7rem;
  }

  .pill {
    font-size: .55rem;
    padding: 1px 2px;
    margin-top: 1px;
    line-height: 1.2;
  }
  
  /* Make section padding smaller */
  #monthview.section {
    padding: 40px 0;
  }
}

/* ========================================
   INTERACTIVE ENHANCEMENTS
   ======================================== */

/* Clickable pills in calendar */
.pill {
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.pill:hover {
  background: var(--ink) !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Event card hover effects */
.event {
  transition: all 0.2s ease;
  cursor: pointer;
}

.event:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.event:hover .event-title {
  color: var(--accent);
}

/* Homepage mini calendar interactive cells */
.mini-cal .cell.has-events {
  position: relative;
  background: var(--foam);
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-cal .cell.has-events::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

.mini-cal .cell.has-events:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.1);
}

.mini-cal .cell.has-events:hover::after {
  background: #fff;
}

.mini-cal .cell.has-events.active {
  background: var(--ink);
  color: #fff;
}

.mini-cal .cell.has-events.active::after {
  background: #fff;
}

/* ========================================
   MONTH NAVIGATION
   ======================================== */

.month-navigation {
  background: var(--foam, #f5f7fa);
  border-bottom: 1px solid rgba(14, 42, 71, 0.1);
  padding: 20px 0;
  margin-bottom: 32px;
  border-radius: 12px;
}

.month-navigation .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.month-navigation .nav-prev,
.month-navigation .nav-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.month-navigation .nav-prev:hover,
.month-navigation .nav-next:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(11, 29, 50, 0.15);
}

.month-navigation .nav-prev .arrow,
.month-navigation .nav-next .arrow {
  font-size: 1.1rem;
  line-height: 1;
}

.month-navigation .current-month {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  flex: 1;
  letter-spacing: -0.02em;
}

/* Responsive month navigation */
@media (max-width: 768px) {
  .month-navigation {
    padding: 16px 0;
  }
  
  .month-navigation .wrap {
    gap: 12px;
    padding: 0 16px;
  }
  
  .month-navigation .current-month {
    font-size: 1.2rem;
  }
  
  .month-navigation .nav-prev,
  .month-navigation .nav-next {
    font-size: 0.85rem;
    padding: 8px 12px;
    flex-shrink: 0;
    min-width: fit-content;
  }
}

/* Hide month names on mobile - increased breakpoint for iPhone 15 and similar devices */
@media (max-width: 550px) {
  .month-navigation {
    padding: 12px 0;
  }
  
  .month-navigation .wrap {
    gap: 4px;
    padding: 0 12px;
  }
  
  .month-navigation .current-month {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex: 1 1 auto;
    min-width: 0;
  }
  
  /* Hide month name text in prev/next buttons on mobile */
  .month-navigation .nav-prev .month-text,
  .month-navigation .nav-next .month-text {
    display: none !important;
  }
  
  /* Style buttons to show only arrows */
  .month-navigation .nav-prev,
  .month-navigation .nav-next {
    font-size: 0.75rem;
    padding: 8px;
    gap: 0;
    flex-shrink: 0;
    min-width: 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    text-align: center;
    line-height: 1;
  }
  
  /* Style arrows to be centered */
  .month-navigation .nav-prev .arrow,
  .month-navigation .nav-next .arrow {
    display: inline-block;
    font-size: 1.1rem;
    line-height: 1;
    margin: 0;
    padding: 0;
    position: static;
    transform: none;
    text-indent: 0;
    vertical-align: middle;
  }
}