/**
 * ChurchFoundry Events Styles
 * Styles for embedded events and calendar from ChurchFoundry
 */

/* Container */
.cf-events-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* Hide WordPress theme page title when plugin renders its own */
.cf-events-container ~ .entry-title,
.entry-title:has(~ .cf-events-container),
body.cf-has-calendar .entry-title,
body.cf-has-calendar .page-title,
body.cf-has-calendar article > header .entry-title {
  display: none !important;
}

/* Page Header */
.cf-page-header {
  margin-top: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e5e7eb;
}

.cf-page-title {
  font-size: 32px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}

/* Theme: Forest */
.cf-events-container[data-theme="forest"] .cf-page-title {
  color: #fff;
}

.cf-events-container[data-theme="forest"] .cf-page-header {
  border-bottom-color: #3d5a3d;
}

/* Theme: Slate */
.cf-events-container[data-theme="slate"] .cf-page-title {
  color: #fff;
}

.cf-events-container[data-theme="slate"] .cf-page-header {
  border-bottom-color: #475569;
}

/* Theme: Minimal */
.cf-events-container[data-theme="minimal"] .cf-page-header {
  border-bottom: 1px solid #e5e7eb;
}

/* Loading state */
.cf-events-loading {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.cf-loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: cf-spin 0.8s linear infinite;
}

/* Every event opens its details */
.cf-event-card {
  cursor: pointer;
}

.cf-event-card:focus-visible,
.cf-calendar-event:focus-visible,
.cf-week-event:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Error state */
.cf-events-error,
.cf-events-error-message {
  padding: 16px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  text-align: center;
}

/* Event List */
.cf-events-list-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 16px;
}

.cf-event-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  transition: box-shadow 0.15s ease;
}

.cf-event-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Event Date Badge */
.cf-event-date-badge {
  flex-shrink: 0;
  width: 60px;
  text-align: center;
  padding: 8px;
  background-color: #eff6ff;
  border-radius: 8px;
}

.cf-event-date-badge .month {
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  text-transform: uppercase;
}

.cf-event-date-badge .day {
  font-size: 24px;
  font-weight: 700;
  color: #1e40af;
  line-height: 1.2;
}

.cf-event-date-badge .weekday {
  font-size: 11px;
  color: #6b7280;
}

/* Event Details */
.cf-event-details {
  flex: 1;
  min-width: 0;
}

.cf-event-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px;
}

.cf-event-title a {
  color: inherit;
  text-decoration: none;
}

.cf-event-title a:hover {
  color: #3b82f6;
}

.cf-event-time {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}

.cf-event-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}

.cf-event-location svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cf-event-description {
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cf-event-description p,
.cf-event-description h1,
.cf-event-description h2,
.cf-event-description h3,
.cf-event-description h4,
.cf-event-description h5,
.cf-event-description h6,
.cf-event-description ul,
.cf-event-description ol,
.cf-event-description blockquote,
.cf-event-description div {
  margin: 0;
  padding: 0;
}

/* Event Cover Image */
.cf-event-image {
  flex-shrink: 0;
  width: 280px;
  max-height: 200px;
  object-fit: cover;
  border-radius: 0 12px 12px 0;
  align-self: flex-start;
  margin: -16px -16px auto 0;
}

/* Empty State */
.cf-events-empty {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.cf-events-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: #d1d5db;
}

/* Calendar View */
.cf-calendar-content {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.cf-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.cf-calendar-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.cf-calendar-nav {
  display: flex;
  gap: 8px;
}

.cf-calendar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.cf-calendar-nav-btn:hover {
  background-color: #f3f4f6;
}

.cf-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cf-calendar-weekday {
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-align: center;
  text-transform: uppercase;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.cf-calendar-day {
  min-height: 100px;
  padding: 8px;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.cf-calendar-day:nth-child(7n) {
  border-right: none;
}

.cf-calendar-day-number {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

.cf-calendar-day.other-month .cf-calendar-day-number {
  color: #d1d5db;
}

.cf-calendar-day.today .cf-calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: #3b82f6;
  color: #fff;
  border-radius: 50%;
}

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

.cf-calendar-event {
  padding: 2px 4px;
  font-size: 11px;
  color: #fff;
  background-color: #3b82f6;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.cf-calendar-event:hover {
  background-color: #2563eb;
}

.cf-calendar-event.study {
  background-color: #8b5cf6;
}

.cf-calendar-more {
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
}

.cf-calendar-more:hover {
  color: #3b82f6;
}

/* Event Detail Modal */
.cf-event-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.cf-event-modal-content {
  background-color: #fff;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.cf-event-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.cf-event-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
}

.cf-event-modal-close:hover {
  color: #111827;
}

.cf-event-modal-body {
  padding: 20px;
}

.cf-event-modal-body p {
  margin: 0 0 12px;
}

/* Modal: Recurring Badge */
.cf-event-recurring-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  background-color: #dbeafe;
  color: #1d4ed8;
  border-radius: 12px;
  margin-left: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .cf-event-card {
    flex-direction: column;
  }

  .cf-event-date-badge {
    width: auto;
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .cf-event-date-badge .day {
    font-size: 18px;
  }

  .cf-event-image {
    width: 100%;
    height: 160px;
  }

  .cf-calendar-day {
    min-height: 60px;
    padding: 4px;
  }

  .cf-calendar-event {
    font-size: 10px;
  }
}

/* =====================================================
   Week View
   ===================================================== */

.cf-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border-top: 1px solid #e5e7eb;
}

.cf-week-day {
  min-height: 120px;
  padding: 10px 8px;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.cf-week-day:last-child {
  border-right: none;
}

.cf-week-day.today {
  background-color: #eff6ff;
}

.cf-week-day-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.cf-week-day-name {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
}

.cf-week-day-number {
  font-size: 18px;
  font-weight: 700;
  color: #374151;
}

.cf-week-day.today .cf-week-day-number {
  color: #3b82f6;
}

.cf-week-day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cf-week-event {
  padding: 4px 6px;
  border-radius: 4px;
  background-color: #eff6ff;
  border-left: 3px solid #3b82f6;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.cf-week-event:hover {
  background-color: #dbeafe;
}

.cf-week-event-time {
  font-size: 11px;
  color: #6b7280;
}

.cf-week-event-title {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Calendar list view */
.cf-calendar-list-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

/* Week view responsive */
@media (max-width: 768px) {
  .cf-week-grid {
    grid-template-columns: 1fr;
  }

  .cf-week-day {
    min-height: auto;
    padding: 12px;
    border-right: none;
  }

  .cf-week-day-header {
    margin-bottom: 6px;
  }

  .cf-week-day-number {
    font-size: 16px;
  }
}

/* =====================================================
   Theme: Minimal — Events
   ===================================================== */

.cf-events-container[data-theme="minimal"] .cf-event-card {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.cf-events-container[data-theme="minimal"] .cf-calendar-content {
  border-radius: 0;
}

.cf-events-container[data-theme="minimal"] .cf-calendar-header {
  background-color: transparent;
}

.cf-events-container[data-theme="minimal"] .cf-calendar-nav-btn {
  border-radius: 0;
}

.cf-events-container[data-theme="minimal"] .cf-week-event {
  border-radius: 0;
}

/* =====================================================
   Theme: Forest (Dark) — Events
   ===================================================== */

.cf-events-container[data-theme="forest"] .cf-event-card {
  background-color: #2d4a2d;
  border-color: #3d5a3d;
  color: #e5e7eb;
}

.cf-events-container[data-theme="forest"] .cf-event-title {
  color: #fff;
}

.cf-events-container[data-theme="forest"] .cf-event-time,
.cf-events-container[data-theme="forest"] .cf-event-location,
.cf-events-container[data-theme="forest"] .cf-event-description {
  color: #9ca3af;
}

.cf-events-container[data-theme="forest"] .cf-event-date-badge {
  background-color: #1a2e1a;
}

.cf-events-container[data-theme="forest"] .cf-event-date-badge .month {
  color: #22c55e;
}

.cf-events-container[data-theme="forest"] .cf-event-date-badge .day {
  color: #4ade80;
}

.cf-events-container[data-theme="forest"] .cf-event-date-badge .weekday {
  color: #9ca3af;
}

.cf-events-container[data-theme="forest"] .cf-calendar-content {
  background-color: #1a2e1a;
  border-color: #3d5a3d;
}

.cf-events-container[data-theme="forest"] .cf-calendar-header {
  background-color: #2d4a2d;
  border-bottom-color: #3d5a3d;
}

.cf-events-container[data-theme="forest"] .cf-calendar-title {
  color: #fff;
}

.cf-events-container[data-theme="forest"] .cf-calendar-nav-btn {
  background-color: #1a2e1a;
  border-color: #3d5a3d;
  color: #e5e7eb;
}

.cf-events-container[data-theme="forest"] .cf-calendar-nav-btn:hover {
  background-color: #3d5a3d;
}

.cf-events-container[data-theme="forest"] .cf-calendar-weekday {
  background-color: #2d4a2d;
  border-bottom-color: #3d5a3d;
  color: #9ca3af;
}

.cf-events-container[data-theme="forest"] .cf-calendar-day {
  border-color: #3d5a3d;
}

.cf-events-container[data-theme="forest"] .cf-calendar-day-number {
  color: #d1d5db;
}

.cf-events-container[data-theme="forest"] .cf-calendar-day.other-month .cf-calendar-day-number {
  color: #4b5563;
}

.cf-events-container[data-theme="forest"] .cf-calendar-day.today {
  background-color: rgba(34, 197, 94, 0.1);
}

.cf-events-container[data-theme="forest"] .cf-calendar-day.today .cf-calendar-day-number {
  background-color: #22c55e;
  color: #fff;
}

.cf-events-container[data-theme="forest"] .cf-calendar-more {
  color: #9ca3af;
}

.cf-events-container[data-theme="forest"] .cf-calendar-more:hover {
  color: #22c55e;
}

.cf-events-container[data-theme="forest"] .cf-events-empty {
  color: #9ca3af;
}

/* Forest: Week view */
.cf-events-container[data-theme="forest"] .cf-week-grid {
  border-top-color: #3d5a3d;
}

.cf-events-container[data-theme="forest"] .cf-week-day {
  border-color: #3d5a3d;
}

.cf-events-container[data-theme="forest"] .cf-week-day.today {
  background-color: rgba(34, 197, 94, 0.1);
}

.cf-events-container[data-theme="forest"] .cf-week-day-name {
  color: #9ca3af;
}

.cf-events-container[data-theme="forest"] .cf-week-day-number {
  color: #d1d5db;
}

.cf-events-container[data-theme="forest"] .cf-week-day.today .cf-week-day-number {
  color: #22c55e;
}

.cf-events-container[data-theme="forest"] .cf-week-event {
  background-color: rgba(34, 197, 94, 0.15);
  border-left-color: #22c55e;
}

.cf-events-container[data-theme="forest"] .cf-week-event:hover {
  background-color: rgba(34, 197, 94, 0.25);
}

.cf-events-container[data-theme="forest"] .cf-week-event-time {
  color: #9ca3af;
}

.cf-events-container[data-theme="forest"] .cf-week-event-title {
  color: #e5e7eb;
}

/* =====================================================
   Theme: Slate (Dark) — Events
   ===================================================== */

.cf-events-container[data-theme="slate"] .cf-event-card {
  background-color: #334155;
  border-color: #475569;
  color: #e5e7eb;
}

.cf-events-container[data-theme="slate"] .cf-event-title {
  color: #fff;
}

.cf-events-container[data-theme="slate"] .cf-event-time,
.cf-events-container[data-theme="slate"] .cf-event-location,
.cf-events-container[data-theme="slate"] .cf-event-description {
  color: #9ca3af;
}

.cf-events-container[data-theme="slate"] .cf-event-date-badge {
  background-color: #1e293b;
}

.cf-events-container[data-theme="slate"] .cf-event-date-badge .month {
  color: #6366f1;
}

.cf-events-container[data-theme="slate"] .cf-event-date-badge .day {
  color: #818cf8;
}

.cf-events-container[data-theme="slate"] .cf-event-date-badge .weekday {
  color: #9ca3af;
}

.cf-events-container[data-theme="slate"] .cf-calendar-content {
  background-color: #1e293b;
  border-color: #475569;
}

.cf-events-container[data-theme="slate"] .cf-calendar-header {
  background-color: #334155;
  border-bottom-color: #475569;
}

.cf-events-container[data-theme="slate"] .cf-calendar-title {
  color: #fff;
}

.cf-events-container[data-theme="slate"] .cf-calendar-nav-btn {
  background-color: #1e293b;
  border-color: #475569;
  color: #e5e7eb;
}

.cf-events-container[data-theme="slate"] .cf-calendar-nav-btn:hover {
  background-color: #475569;
}

.cf-events-container[data-theme="slate"] .cf-calendar-weekday {
  background-color: #334155;
  border-bottom-color: #475569;
  color: #9ca3af;
}

.cf-events-container[data-theme="slate"] .cf-calendar-day {
  border-color: #475569;
}

.cf-events-container[data-theme="slate"] .cf-calendar-day-number {
  color: #d1d5db;
}

.cf-events-container[data-theme="slate"] .cf-calendar-day.other-month .cf-calendar-day-number {
  color: #4b5563;
}

.cf-events-container[data-theme="slate"] .cf-calendar-day.today {
  background-color: rgba(99, 102, 241, 0.1);
}

.cf-events-container[data-theme="slate"] .cf-calendar-day.today .cf-calendar-day-number {
  background-color: #6366f1;
  color: #fff;
}

.cf-events-container[data-theme="slate"] .cf-calendar-more {
  color: #9ca3af;
}

.cf-events-container[data-theme="slate"] .cf-calendar-more:hover {
  color: #6366f1;
}

.cf-events-container[data-theme="slate"] .cf-events-empty {
  color: #9ca3af;
}

/* Slate: Week view */
.cf-events-container[data-theme="slate"] .cf-week-grid {
  border-top-color: #475569;
}

.cf-events-container[data-theme="slate"] .cf-week-day {
  border-color: #475569;
}

.cf-events-container[data-theme="slate"] .cf-week-day.today {
  background-color: rgba(99, 102, 241, 0.1);
}

.cf-events-container[data-theme="slate"] .cf-week-day-name {
  color: #9ca3af;
}

.cf-events-container[data-theme="slate"] .cf-week-day-number {
  color: #d1d5db;
}

.cf-events-container[data-theme="slate"] .cf-week-day.today .cf-week-day-number {
  color: #6366f1;
}

.cf-events-container[data-theme="slate"] .cf-week-event {
  background-color: rgba(99, 102, 241, 0.15);
  border-left-color: #6366f1;
}

.cf-events-container[data-theme="slate"] .cf-week-event:hover {
  background-color: rgba(99, 102, 241, 0.25);
}

.cf-events-container[data-theme="slate"] .cf-week-event-time {
  color: #9ca3af;
}

.cf-events-container[data-theme="slate"] .cf-week-event-title {
  color: #e5e7eb;
}

