/**
 * Weymouth Climate Hub - Events Styling
 * Teal/Blue Theme: #2a6d65
 */

/* Events Header */
.events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  margin-top: -2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Modern Segmented Control View Switcher */
.view-switcher {
  display: inline-flex;
  background: #f0f0f0;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  background: transparent;
  color: #666;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.view-btn:hover {
  background: rgba(42, 109, 101, 0.1);
  color: #2a6d65;
}

.view-btn.active {
  background: white;
  color: #2a6d65;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.view-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Calendar View */
.calendar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0.75rem;
  background: #f8f8f8;
  border-radius: 8px;
}

.calendar-nav button {
  padding: 0.5rem 1rem;
  border: none;
  background: #2a6d65;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease;
}

.calendar-nav button:hover {
  background: #1f5048;
}

#current-month {
  font-size: 1.3rem;
  font-weight: 600;
  color: #2a6d65;
  cursor: pointer;
  padding: 0.5rem;
  margin: 0.5rem 0;
  border-radius: 4px;
  transition: background 0.3s ease;
}

#current-month:hover {
  background: #e0f0ed;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #ddd;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.calendar-header {
  background: #2a6d65;
  color: white;
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.calendar-day {
  background: white;
  min-height: 100px;
  padding: 0.5rem;
  position: relative;
  overflow: hidden;
}

.calendar-day.other-month {
  background: #f5f5f5;
  color: #999;
}

.calendar-day.today {
  background: #fff9e6;
}

.calendar-day.today .day-number {
  background: #2a6d65;
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-number {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: #333;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-marker {
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.event-marker:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.event-title {
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-time {
  font-size: 0.7rem;
  opacity: 0.8;
  display: block;
}

/* Category Colors */
.category-general {
  background: #e3f2fd;
  border-left-color: #2196f3;
  color: #1565c0;
}

.category-workshop {
  background: #f3e5f5;
  border-left-color: #9c27b0;
  color: #6a1b9a;
}

.category-talk {
  background: #e8f5e9;
  border-left-color: #4caf50;
  color: #2e7d32;
}

.category-social {
  background: #fff3e0;
  border-left-color: #ff9800;
  color: #e65100;
}

.category-protest {
  background: #ffebee;
  border-left-color: #f44336;
  color: #c62828;
}

.category-meeting {
  background: #e0f2f1;
  border-left-color: #009688;
  color: #00695c;
}

.category-community {
  background: #e8f5e9;
  border-left-color: #4caf50;
  color: #2e7d32;
}

.category-education {
  background: #e3f2fd;
  border-left-color: #2196f3;
  color: #1565c0;
}

.category-activism {
  background: #ffebee;
  border-left-color: #f44336;
  color: #c62828;
}

/* Cards View */
#cards-container {
  max-width: 900px;
}

.month-group {
  margin-bottom: 2rem;
}

.month-group:not(:first-child) {
  margin-top: 3rem;
}

.month-divider {
  color: #2a6d65;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0;
  border-bottom: none;
}

.event-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid #2a6d65;
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Category-colored borders for cards */
.event-card.category-general {
  border-left-color: #2196f3;
}
.event-card.category-workshop {
  border-left-color: #9c27b0;
}
.event-card.category-talk {
  border-left-color: #4caf50;
}
.event-card.category-social {
  border-left-color: #ff9800;
}
.event-card.category-protest {
  border-left-color: #f44336;
}
.event-card.category-meeting {
  border-left-color: #009688;
}
.event-card.category-community {
  border-left-color: #4caf50;
}
.event-card.category-education {
  border-left-color: #2196f3;
}
.event-card.category-activism {
  border-left-color: #f44336;
}

.event-card-image {
  height: 200px;
  background-size: cover;
  background-position: center;
}

.event-card-content {
  padding: 1.5rem;
}

.event-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.event-card.category-general .event-category {
  background: #e3f2fd;
  color: #1565c0;
}

.event-card.category-workshop .event-category {
  background: #f3e5f5;
  color: #6a1b9a;
}

.event-card.category-talk .event-category {
  background: #e8f5e9;
  color: #2e7d32;
}

.event-card.category-social .event-category {
  background: #fff3e0;
  color: #e65100;
}

.event-card.category-protest .event-category {
  background: #ffebee;
  color: #c62828;
}

.event-card.category-meeting .event-category {
  background: #e0f2f1;
  color: #00695c;
}

.event-card.category-community .event-category {
  background: #e8f5e9;
  color: #2e7d32;
}

.event-card.category-education .event-category {
  background: #e3f2fd;
  color: #1565c0;
}

.event-card.category-activism .event-category {
  background: #ffebee;
  color: #c62828;
}

.event-card-title {
  font-size: 1.4rem;
  margin: 0 0 0.75rem 0;
  color: #333;
}

.event-card-date,
.event-card-time,
.event-card-location {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.event-card-description {
  margin-top: 1rem;
  color: #555;
  line-height: 1.6;
}

.no-events {
  text-align: center;
  color: #999;
  padding: 3rem;
  font-size: 1.1rem;
}

.see-more {
  text-align: center;
  margin-top: 2rem;
}

.see-more button {
  padding: 0.75rem 2rem;
  background: #2a6d65;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.see-more button:hover {
  background: #1f5048;
}

/* Table View */
.events-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.events-table thead {
  background: #2a6d65;
  color: white;
}

.events-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
}

.events-table td {
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.event-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.event-row:hover {
  background: #f8f8f8;
}

.category-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.category-badge.category-general {
  background: #e3f2fd;
  color: #1565c0;
}

.category-badge.category-workshop {
  background: #f3e5f5;
  color: #6a1b9a;
}

.category-badge.category-talk {
  background: #e8f5e9;
  color: #2e7d32;
}

.category-badge.category-social {
  background: #fff3e0;
  color: #e65100;
}

.category-badge.category-protest {
  background: #ffebee;
  color: #c62828;
}

.category-badge.category-meeting {
  background: #e0f2f1;
  color: #00695c;
}

.category-badge.category-community {
  background: #e8f5e9;
  color: #2e7d32;
}

.category-badge.category-education {
  background: #e3f2fd;
  color: #1565c0;
}

.category-badge.category-activism {
  background: #ffebee;
  color: #c62828;
}

.time-display {
  color: #666;
  font-size: 0.9em;
}

.expand-cell {
  text-align: center;
  width: 40px;
}

.expand-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  color: #2a6d65;
  font-size: 1.2em;
  cursor: pointer;
}

.event-row.expanded .expand-icon {
  transform: rotate(180deg);
}

.event-details {
  background: #f9f9f9;
}

.event-details-content {
  padding: 1rem;
}

.event-details-content p {
  margin: 0.5rem 0;
}

.event-details-content a {
  color: #2a6d65;
  text-decoration: none;
  font-weight: 600;
}

.event-details-content a:hover {
  text-decoration: underline;
}

.rsvp-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #2a6d65;
  color: white !important;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.rsvp-link:hover {
  background: #1f5048;
  text-decoration: none !important;
}

/* Event Modal */
#event-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-modal-inner {
  max-width: 700px;
  width: 100%;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin: auto;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-modal:hover {
  background: #f5f5f5;
  transform: rotate(90deg);
}

.modal-header {
  position: relative;
  padding: 2rem;
  border-left: 6px solid #2a6d65;
}

.modal-header.category-general {
  border-left-color: #2196f3;
  background: rgba(227, 242, 253, 0.3);
}

.modal-header.category-workshop {
  border-left-color: #9c27b0;
  background: rgba(243, 229, 245, 0.3);
}

.modal-header.category-talk {
  border-left-color: #4caf50;
  background: rgba(232, 245, 233, 0.3);
}

.modal-header.category-social {
  border-left-color: #ff9800;
  background: rgba(255, 243, 224, 0.3);
}

.modal-header.category-protest {
  border-left-color: #f44336;
  background: rgba(255, 235, 238, 0.3);
}

.modal-header.category-meeting {
  border-left-color: #009688;
  background: rgba(224, 242, 241, 0.3);
}

.modal-header.category-community {
  border-left-color: #4caf50;
  background: rgba(232, 245, 233, 0.3);
}

.modal-header.category-education {
  border-left-color: #2196f3;
  background: rgba(227, 242, 253, 0.3);
}

.modal-header.category-activism {
  border-left-color: #f44336;
  background: rgba(255, 235, 238, 0.3);
}

.modal-image {
  height: 250px;
  background-size: cover;
  background-position: center;
  margin: -2rem -2rem 1.5rem -2rem;
}

.modal-category {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 2rem;
  color: #333;
}

.modal-body {
  padding: 2rem;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 8px;
}

.meta-item {
  font-size: 1rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.modal-description {
  line-height: 1.8;
  color: #444;
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  display: inline-block;
}

.btn-primary {
  background: #2a6d65;
  color: white;
}

.btn-primary:hover {
  background: #1f5048;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background: white;
  color: #2a6d65;
  border: 2px solid #2a6d65;
}

.btn-secondary:hover {
  background: #f0f9f8;
  transform: translateY(-2px);
}

/* Month Picker */
.month-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.month-picker {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.month-picker h3 {
  margin: 0 0 1.5rem 0;
  color: #2a6d65;
  text-align: center;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.month-btn {
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.month-btn:hover {
  border-color: #2a6d65;
  background: #f0f9f8;
}

.month-btn.active {
  background: #2a6d65;
  color: white;
  border-color: #2a6d65;
}

.year-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.year-selector button {
  padding: 0.5rem 1rem;
  border: none;
  background: #2a6d65;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2rem;
}

.year-selector button:hover {
  background: #1f5048;
}

#picker-year {
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  min-width: 80px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.this-month-btn {
  width: 100%;
  padding: 0.75rem;
  background: #2a6d65;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: inherit;
}

.this-month-btn:hover {
  background: #1f5048;
}

.close-picker {
  width: 100%;
  padding: 0.75rem;
  background: #f5f5f5;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.close-picker:hover {
  background: #e0e0e0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .calendar-grid {
    font-size: 0.85rem;
  }

  .calendar-day {
    min-height: 80px;
    padding: 0.25rem;
  }

  .event-marker {
    font-size: 0.7rem;
  }

  .event-time {
    display: none;
  }

  .view-switcher {
    flex-wrap: wrap;
  }

  .view-switcher button {
    flex: 1;
    min-width: 100px;
  }

  .events-table {
    font-size: 0.9rem;
  }

  .events-table th,
  .events-table td {
    padding: 0.5rem;
  }

  .modal-header h2 {
    font-size: 1.5rem;
  }

  .month-picker {
    margin: 1rem;
  }
}

@media (max-width: 480px) {
  .calendar-controls {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .calendar-nav {
    display: flex;
    gap: 0.25rem;
  }

  .calendar-nav button {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
  }

  #current-month {
    font-size: 0.95rem;
    white-space: nowrap;
    padding: 0.25rem;
    margin: 0;
    flex-shrink: 1;
    min-width: 0;
    text-align: center;
  }

  .event-card-title {
    font-size: 1.2rem;
  }

  #event-modal {
    padding: 0.5rem;
  }

  .modal-header,
  .modal-body {
    padding: 1rem;
  }
}
