/**
 * FCA Events Pro — Shortcodes CSS
 * Styles for all [fca_event] [fca_events] [fca_event_calendar] etc. shortcode output.
 * Uses Fluent Community design tokens (CSS custom properties) for seamless portal integration.
 *
 * Classes: .fca-sc-* (shortcode)
 */

:root {
  --fca-sc-btn-bg: var(--fcom-primary-button, #1877f2);
  --fca-sc-btn-color: #fff;
  --fca-sc-btn-radius: 6px;
  --fca-sc-card-radius: 10px;
  --fca-sc-gap: 16px;
  --fca-sc-shadow: 0 1px 3px rgba(0,0,0,.08);
  --fca-sc-shadow-hover: 0 4px 12px rgba(0,0,0,.12);
}

/* ─── Shared helpers ─── */
.fca-sc-empty { padding: 24px; text-align: center; color: var(--fcom-text-off, #8A8D91); font-size: 14px; }
.fca-sc-sep { color: var(--fcom-text-off, #8A8D91); margin: 0 4px; }

/* ─── Buttons ─── */
.fca-sc-btn { display: inline-block; padding: 8px 18px; background: var(--fca-sc-btn-bg); color: var(--fca-sc-btn-color); border-radius: var(--fca-sc-btn-radius); font-size: 14px; font-weight: 600; text-decoration: none; transition: opacity .15s; border: none; cursor: pointer; }
.fca-sc-btn:hover { opacity: .85; }
.fca-sc-btn-register { background: var(--fca-sc-btn-bg); }

/* ─── Single Event ─── */
.fca-sc-single-event { font-family: var(--fcom-font-family, system-ui, sans-serif); }
.fca-sc-layout-card .fca-sc-card { background: var(--fcom-primary-bg, #fff); border: 1px solid var(--fcom-primary-border, #DADDE1); border-radius: var(--fca-sc-card-radius); overflow: hidden; box-shadow: var(--fca-sc-shadow); transition: box-shadow .2s; max-width: 400px; }
.fca-sc-layout-card .fca-sc-card:hover { box-shadow: var(--fca-sc-shadow-hover); }
.fca-sc-card-image { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--fcom-secondary-bg, #F0F2F5); }
.fca-sc-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fca-sc-card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.fca-sc-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--fcom-primary-text, #050505); line-height: 1.3; }
.fca-sc-title a { color: inherit; text-decoration: none; }
.fca-sc-title a:hover { text-decoration: underline; }
.fca-sc-date, .fca-sc-location { font-size: 13px; color: var(--fcom-secondary-text, #65676B); display: flex; align-items: center; gap: 4px; }
.fca-sc-virtual-badge { display: inline-block; padding: 2px 8px; background: #e0f2fe; color: #0369a1; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; width: fit-content; }
.fca-sc-excerpt { font-size: 13px; color: var(--fcom-secondary-text, #65676B); line-height: 1.5; }
.fca-sc-card-body > .fca-sc-btn { margin-top: 4px; width: fit-content; }
.fca-sc-layout-minimal .fca-sc-minimal { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fca-sc-layout-minimal .fca-sc-title { font-size: 15px; }
.fca-sc-layout-full .fca-sc-full { background: var(--fcom-primary-bg, #fff); border: 1px solid var(--fcom-primary-border, #DADDE1); border-radius: var(--fca-sc-card-radius); overflow: hidden; box-shadow: var(--fca-sc-shadow); }
.fca-sc-full-image { width: 100%; max-height: 280px; overflow: hidden; }
.fca-sc-full-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ─── Events List ─── */
.fca-sc-events-list { display: grid; gap: var(--fca-sc-gap); }
.fca-sc-cols-1 { grid-template-columns: 1fr; }
.fca-sc-cols-2 { grid-template-columns: repeat(2, 1fr); }
.fca-sc-cols-3 { grid-template-columns: repeat(3, 1fr); }
.fca-sc-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) { .fca-sc-cols-3, .fca-sc-cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .fca-sc-cols-2, .fca-sc-cols-3, .fca-sc-cols-4 { grid-template-columns: 1fr; } }

/* ─── By Category ─── */
.fca-sc-by-category { margin-bottom: 24px; }
.fca-sc-category-heading { font-size: 15px; font-weight: 700; color: var(--fcom-primary-text, #050505); margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--fcom-primary-border, #DADDE1); }

/* ─── My Events ─── */
.fca-sc-my-events { display: flex; flex-direction: column; gap: 12px; font-family: var(--fcom-font-family, system-ui, sans-serif); }
.fca-sc-list-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--fcom-primary-bg, #fff); border: 1px solid var(--fcom-primary-border, #DADDE1); border-radius: 8px; }
.fca-sc-list-item-title { font-size: 14px; font-weight: 600; color: var(--fcom-primary-text, #050505); margin-bottom: 4px; }
.fca-sc-list-item-title a { color: inherit; text-decoration: none; }
.fca-sc-list-item-title a:hover { text-decoration: underline; }
.fca-sc-list-item-date { font-size: 12px; color: var(--fcom-secondary-text, #65676B); }
.fca-sc-list-item-location { font-size: 12px; color: var(--fcom-text-off, #8A8D91); font-style: italic; }
.fca-sc-status-confirmed { display: inline-block; padding: 2px 8px; background: #dcfce7; color: #15803d; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; }

/* ─── Countdown ─── */
.fca-sc-countdown { display: flex; align-items: center; gap: 4px; font-family: var(--fcom-font-family, system-ui, sans-serif); }
.fca-sc-countdown-unit { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.fca-sc-countdown-number { font-size: 28px; font-weight: 700; color: var(--fcom-primary-text, #050505); line-height: 1; background: var(--fcom-secondary-bg, #F0F2F5); border-radius: 6px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.fca-sc-countdown-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fcom-text-off, #8A8D91); margin-top: 4px; }
.fca-sc-countdown-sep { font-size: 28px; font-weight: 700; color: var(--fcom-text-off, #8A8D91); line-height: 1; padding-bottom: 20px; }
.fca-sc-countdown-compact { flex-direction: row; gap: 8px; align-items: center; }
.fca-sc-countdown-compact .fca-sc-countdown-number { font-size: 16px; padding: 4px 8px; }
.fca-sc-countdown-compact .fca-sc-countdown-sep { font-size: 16px; padding-bottom: 0; }

/* ─── Calendar ─── */
.fca-sc-calendar { background: var(--fcom-primary-bg, #fff); border: 1px solid var(--fcom-primary-border, #DADDE1); border-radius: var(--fca-sc-card-radius); padding: 16px; font-family: var(--fcom-font-family, system-ui, sans-serif); }
.fca-sc-notice { padding: 12px 16px; background: #fef3c7; color: #92400e; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.fca-sc-cal-wrap { min-height: 200px; }

/* ─── Upcoming ─── */
.fca-sc-upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-family: var(--fcom-font-family, system-ui, sans-serif); }
.fca-sc-upcoming-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px; background: var(--fcom-primary-bg, #fff); border: 1px solid var(--fcom-primary-border, #DADDE1); border-radius: 8px; transition: box-shadow .15s; }
.fca-sc-upcoming-item:hover { box-shadow: var(--fca-sc-shadow-hover); }
.fca-sc-upcoming-date-block { display: flex; flex-direction: column; align-items: center; min-width: 44px; background: var(--fcom-secondary-bg, #F0F2F5); border-radius: 6px; padding: 6px 8px; }
.fca-sc-upcoming-day { font-size: 18px; font-weight: 700; color: var(--fcom-primary-text, #050505); line-height: 1; }
.fca-sc-upcoming-month { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--fcom-text-off, #8A8D91); letter-spacing: .04em; }
.fca-sc-upcoming-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.fca-sc-upcoming-title { font-size: 14px; font-weight: 600; color: var(--fcom-primary-text, #050505); }
.fca-sc-upcoming-title a { color: inherit; text-decoration: none; }
.fca-sc-upcoming-title a:hover { text-decoration: underline; }
.fca-sc-upcoming-meta { font-size: 12px; color: var(--fcom-secondary-text, #65676B); }

/* ─── Dark mode ─── */
@media (prefers-color-scheme: dark) {
  .fca-sc-card, .fca-sc-my-events .fca-sc-list-item, .fca-sc-upcoming-item, .fca-sc-layout-full .fca-sc-full, .fca-sc-calendar { background: var(--fcom-primary-bg-dark, #1c1c1e); border-color: var(--fcom-primary-border-dark, #38383A); }
  .fca-sc-title, .fca-sc-list-item-title, .fca-sc-upcoming-day, .fca-sc-countdown-number { color: var(--fcom-primary-text-dark, #f5f5f7); }
  .fca-sc-date, .fca-sc-location, .fca-sc-excerpt, .fca-sc-list-item-date, .fca-sc-upcoming-meta { color: var(--fcom-secondary-text-dark, #98989d); }
  .fca-sc-category-heading { border-color: var(--fcom-primary-border-dark, #38383A); }
  .fca-sc-countdown-number, .fca-sc-upcoming-date-block { background: var(--fcom-secondary-bg-dark, #2c2c2e); }
}

/* ============================================================================
   [fca_events] — configurable searchable/filterable list (theme-adaptive).

   Self-contained: does NOT depend on FluentCommunity design tokens, so it
   looks intentional on any WordPress theme. Typography is inherited from the
   theme; colours come from a small set of overridable custom properties and
   adapt to the visitor's light/dark preference. Set --fca-ev-accent (or the
   shortcode's accent="" attribute) to match your brand.
   ============================================================================ */
.fca-ev {
  --fca-ev-accent: #3b82f6;
  --fca-ev-text: #1f2328;
  --fca-ev-muted: #656d76;
  --fca-ev-surface: #ffffff;
  --fca-ev-surface-2: #f6f8fa;
  --fca-ev-border: #d8dee4;
  --fca-ev-radius: 12px;
  --fca-ev-gap: 18px;

  font: inherit;
  color: var(--fca-ev-text);
  box-sizing: border-box;
  container-type: inline-size;
}
.fca-ev *, .fca-ev *::before, .fca-ev *::after { box-sizing: inherit; }

/* ─── Controls bar ─── */
.fca-ev-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: var(--fca-ev-gap);
}
.fca-ev-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  display: flex;
  align-items: center;
}
.fca-ev-search-icon {
  position: absolute;
  left: 12px;
  color: var(--fca-ev-muted);
  pointer-events: none;
}
.fca-ev-search-input {
  width: 100%;
  font: inherit;
  font-size: 0.95em;
  padding: 9px 12px 9px 36px;
  color: var(--fca-ev-text);
  background: var(--fca-ev-surface);
  border: 1px solid var(--fca-ev-border);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.fca-ev-search-input:focus {
  border-color: var(--fca-ev-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fca-ev-accent) 25%, transparent);
}

.fca-ev-tabs, .fca-ev-filters, .fca-ev-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fca-ev-view-toggle { margin-left: auto; }

.fca-ev-tab, .fca-ev-pill {
  font: inherit;
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1;
  padding: 8px 14px;
  color: var(--fca-ev-muted);
  background: var(--fca-ev-surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.fca-ev-tab:hover, .fca-ev-pill:hover { color: var(--fca-ev-text); }
.fca-ev-tab.is-active, .fca-ev-pill.is-active {
  color: #fff;
  background: var(--fca-ev-accent);
}

.fca-ev-vt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--fca-ev-muted);
  background: var(--fca-ev-surface);
  border: 1px solid var(--fca-ev-border);
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.fca-ev-vt + .fca-ev-vt { margin-left: -1px; }
.fca-ev-vt:hover { color: var(--fca-ev-text); }
.fca-ev-vt.is-active {
  color: var(--fca-ev-accent);
  border-color: var(--fca-ev-accent);
  background: color-mix(in srgb, var(--fca-ev-accent) 10%, var(--fca-ev-surface));
}

/* ─── Grid ─── */
.fca-ev-grid { display: grid; gap: var(--fca-ev-gap); }
.fca-ev-cols-1 { grid-template-columns: 1fr; }
.fca-ev-cols-2 { grid-template-columns: repeat(2, 1fr); }
.fca-ev-cols-3 { grid-template-columns: repeat(3, 1fr); }
.fca-ev-cols-4 { grid-template-columns: repeat(4, 1fr); }
@container (max-width: 720px) { .fca-ev-cols-3, .fca-ev-cols-4 { grid-template-columns: repeat(2, 1fr); } }
@container (max-width: 440px) { .fca-ev-grid { grid-template-columns: 1fr !important; } }
/* Fallback for browsers without container queries. */
@media (max-width: 768px) { .fca-ev-cols-3, .fca-ev-cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .fca-ev-cols-2, .fca-ev-cols-3, .fca-ev-cols-4 { grid-template-columns: 1fr; } }

/* ─── Cards ─── */
.fca-ev-card {
  background: var(--fca-ev-surface);
  border: 1px solid var(--fca-ev-border);
  border-radius: var(--fca-ev-radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.fca-ev-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.10);
  border-color: color-mix(in srgb, var(--fca-ev-accent) 40%, var(--fca-ev-border));
}
.fca-ev-card.is-past { opacity: .72; }
.fca-ev-card-link { display: block; color: inherit; text-decoration: none; }
.fca-ev-card-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--fca-ev-surface-2); }
.fca-ev-card-media .fca-ev-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fca-ev-card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.fca-ev-card-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8em;
  font-weight: 600;
  color: var(--fca-ev-accent);
}
.fca-ev-card-title { margin: 0; font-size: 1.05em; font-weight: 700; line-height: 1.3; color: var(--fca-ev-text); }
.fca-ev-card-excerpt { margin: 0; font-size: 0.9em; line-height: 1.5; color: var(--fca-ev-muted); }
.fca-ev-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.fca-ev-card-loc { display: inline-flex; align-items: center; gap: 4px; font-size: 0.82em; color: var(--fca-ev-muted); }
.fca-ev-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--fca-ev-accent);
  background: color-mix(in srgb, var(--fca-ev-accent) 14%, transparent);
}
.fca-ev-badge-past { color: var(--fca-ev-muted); background: var(--fca-ev-surface-2); }

/* ─── List view ─── */
.fca-ev-view-list .fca-ev-grid { grid-template-columns: 1fr !important; gap: 10px; }
.fca-ev-view-list .fca-ev-card-link { display: grid; grid-template-columns: 140px 1fr; align-items: stretch; }
.fca-ev-view-list .fca-ev-card-media { aspect-ratio: auto; height: 100%; min-height: 96px; }
.fca-ev-view-list .fca-ev-card-link:not(:has(.fca-ev-card-media)) { grid-template-columns: 1fr; }
@container (max-width: 480px) {
  .fca-ev-view-list .fca-ev-card-link { grid-template-columns: 1fr; }
  .fca-ev-view-list .fca-ev-card-media { display: none; }
}

/* ─── Empty / no-results ─── */
.fca-ev-empty, .fca-ev-noresults {
  padding: 32px 16px;
  text-align: center;
  color: var(--fca-ev-muted);
  font-size: 0.95em;
  background: var(--fca-ev-surface-2);
  border-radius: var(--fca-ev-radius);
}

/* ─── Dark mode (visitor preference) ─── */
@media (prefers-color-scheme: dark) {
  .fca-ev {
    --fca-ev-text: #e6edf3;
    --fca-ev-muted: #9198a1;
    --fca-ev-surface: #0f1620;
    --fca-ev-surface-2: #182029;
    --fca-ev-border: #2a323c;
  }
  .fca-ev-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.4); }
}
