/* ═══════════════════════════════════════════════════════════════════════════
   Outlook Calendar Sync — calendar.css
   
   All colors resolve through Elementor global CSS variables:
     --e-global-color-primary   #E7273A  header bg · today dot · modal accent
     --e-global-color-secondary #36526D  event chips
     --e-global-color-text      #101010  body text · day numbers · modal text
     --e-global-color-accent    #FFC759  (available for theme overrides)
     --e-global-color-bcd134a   #F5F5F5  DOW row · empty cells
   
   Typography, font-size and background are fully inherited from the theme.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Scoped design tokens ────────────────────────────────────────────────── */
.ocs-calendar {
  /* Map Elementor globals to short local aliases.
       These are the ONLY place hex fallbacks appear.             */
  --ocs-c-primary: var(--e-global-color-primary, #e7273a);
  --ocs-c-secondary: var(--e-global-color-secondary, #36526d);
  --ocs-c-text: var(--e-global-color-text, #101010);
  --ocs-c-accent: var(--e-global-color-accent, #ffc759);
  --ocs-c-surface: var(--e-global-color-bcd134a, #f5f5f5);
  --ocs-c-white: #ffffff;

  /* Derived tokens — single source of truth for opacity variants */
  --ocs-border: rgba(16, 16, 16, 0.1);
  --ocs-border-light: rgba(16, 16, 16, 0.07);
  --ocs-today-tint: rgba(231, 39, 58, 0.06); /* primary at 6% */

  /* Typography & layout inherit from the page */
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: var(--ocs-c-text);

  /* Shell */
  max-width: 900px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ocs-border);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.09);
  background: var(--ocs-c-white);
}

/* ── Loading overlay (shown during AJAX month switch) ────────────────────── */
.ocs-calendar.is-loading .ocs-cal-body,
.ocs-calendar.is-loading .ocs-cal-dow {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.15s;
}

.ocs-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--ocs-c-white);
  border-radius: 50%;
  animation: ocs-spin 0.6s linear infinite;
  flex-shrink: 0;
}

.ocs-calendar.is-loading .ocs-spinner {
  display: inline-block;
}

@keyframes ocs-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Header bar ──────────────────────────────────────────────────────────── */
.ocs-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  background-color: var(--ocs-c-primary);
}

/* Month + year label
   1.2rem bold = 19.2 px = ~14.4 pt bold → WCAG "large text" threshold (14 pt bold)
   White on #E7273A = 4.42:1 → passes AA for large text (threshold 3:1)          */
h2.ocs-month-title,
.elementor-kit-136 h2,
.ocs-month-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--ocs-c-white) !important;
}

/* ── Left nav group (prev + Today) ──────────────────────────────────────── */
.ocs-nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Prev / Next arrow buttons
   Design: white pill so #101010 text sits on near-white — guaranteed contrast.
   Arrows use --ocs-c-text (#101010) as requested.                               */
.ocs-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ocs-c-text);
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);

  transition:
    background 0.15s,
    transform 0.12s,
    border-color 0.15s;
  flex-shrink: 0;
  text-decoration: none;
}

.ocs-nav-btn:hover,
.ocs-nav-btn:focus-visible {
  background: var(--ocs-c-white);
  color: var(--ocs-c-text);
  transform: scale(1.08);

  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.ocs-today-btn {
  width: auto;
}

/* Hide Today pill when not needed (JS removes the element entirely,
   but this acts as a safety net)                                    */
.ocs-today-btn[hidden] {
  display: none;
}

/* ── Day-of-week header row ──────────────────────────────────────────────── */
.ocs-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.ocs-cal-dow {
  background: var(--ocs-c-surface);
  border-bottom: 1px solid var(--ocs-border);
}

.ocs-dow-cell {
  padding: 7px 4px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ocs-c-text);
  opacity: 0.55;
}

/* ── Day cells ───────────────────────────────────────────────────────────── */
.ocs-cal-body {
  border-top: 1px solid var(--ocs-border-light);
}

.ocs-day-cell {
  min-height: 88px;
  border-right: 1px solid var(--ocs-border-light);
  border-bottom: 1px solid var(--ocs-border-light);
  padding: 6px 5px 4px;
  background: transparent;
  position: relative;
  overflow: hidden;
}

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

/* Off-month padding cells */
.ocs-day-cell.ocs-empty {
  background: var(--ocs-c-surface);
  opacity: 0.45;
}

/* Today highlight */
.ocs-day-cell.ocs-today {
  background: var(--ocs-today-tint);
}

/* Today day-number circle */
.ocs-day-cell.ocs-today .ocs-day-num {
  background-color: var(--ocs-c-primary);
  color: var(--ocs-c-white);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  opacity: 1; /* override the general .ocs-day-num opacity */
}

.ocs-day-num {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ocs-c-text);
  opacity: 0.6;
  line-height: 26px;
  width: 26px;
  text-align: center;
  margin-bottom: 2px;
}

/* ── Event chips ─────────────────────────────────────────────────────────── */
.ocs-event-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ocs-c-secondary);
  color: var(--ocs-c-white);
  border-radius: 4px;
  padding: 2px 5px;
  margin: 2px 0;
  font-size: 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  transition: filter 0.14s;
}

.ocs-event-chip:hover,
.ocs-event-chip:focus-visible {
  filter: brightness(0.8);
}

.ocs-event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  flex-shrink: 0;
}

.ocs-event-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Event detail modal ──────────────────────────────────────────────────── */
.ocs-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ocs-modal-content {
  background: var(--ocs-c-white);
  color: var(--ocs-c-text);
  border-radius: 10px;
  padding: 26px 30px;
  max-width: 420px;
  width: 100%;
  position: relative;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
  border-top: 4px solid var(--ocs-c-primary);
}

.ocs-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--ocs-c-text);
  opacity: 0.38;
  line-height: 1;
  padding: 0;
  transition: opacity 0.15s;
}

.ocs-modal-close:hover {
  opacity: 0.85;
}

.ocs-modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px;
  padding-right: 22px;
  color: var(--ocs-c-primary);
}

.ocs-modal-time,
.ocs-modal-location,
.ocs-modal-preview {
  font-size: 0.87rem;
  color: var(--ocs-c-text);
  opacity: 0.7;
  margin: 5px 0;
  line-height: 1.5;
}

.ocs-modal-time::before {
  content: "🕐 ";
}
.ocs-modal-location::before {
  content: "📍 ";
}

.ocs-modal-location:empty,
.ocs-modal-preview:empty {
  display: none;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .ocs-day-cell {
    min-height: 56px;
    padding: 3px 2px;
  }
  .ocs-event-label {
    display: none;
  }
  .ocs-event-chip {
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }
  .ocs-event-dot {
    display: none;
  }
  .ocs-today-btn {
    display: none;
  }
}
