/* =========================================================
   BVY Season Calendar Widget — bvy-calendar.css
   All classes scoped to .bvy-cal-* to avoid WP theme conflicts
   ========================================================= */

.bvy-cal-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 860px;
  margin: 0 auto;
  color: #111827;
}

/* ---- Header (title + nav) ---- */
.bvy-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.bvy-cal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  text-align: center;
  flex: 1;
}

.bvy-cal-nav {
  background: none;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 1.1rem;
  cursor: pointer;
  color: #374151;
  transition: all 0.15s ease;
  line-height: 1;
}

.bvy-cal-nav:hover {
  background: #f3742d;
  border-color: #f3742d;
  color: #fff;
}

/* ---- Legend ---- */
.bvy-cal-legend {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.bvy-cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bvy-cal-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bvy-cal-dot.tournament {
  background: #f3742d;
}

.bvy-cal-dot.event {
  background: #3b82f6;
}

/* ---- Grid ---- */
.bvy-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.bvy-cal-day-header {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #9ca3af;
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bvy-cal-day {
  min-height: 90px;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 6px;
  position: relative;
  transition: background 0.15s ease;
}

.bvy-cal-day.empty {
  background: #fafafa;
  border-color: transparent;
}

.bvy-cal-day.today {
  border-color: #f3742d;
  background: #fff8f5;
}

.bvy-cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
  display: block;
}

.bvy-cal-day.today .bvy-cal-day-num {
  color: #f3742d;
}

/* ---- Event chips ---- */
.bvy-cal-chip {
  display: block;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}

.bvy-cal-chip:hover {
  opacity: 0.8;
}

.bvy-cal-chip.tournament {
  background: #fff3ec;
  color: #c2410c;
  border-left: 3px solid #f3742d;
}

.bvy-cal-chip.event {
  background: #eff6ff;
  color: #1d4ed8;
  border-left: 3px solid #3b82f6;
}

/* ---- Popup / Tooltip ---- */
.bvy-cal-popup {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 16px 20px;
  min-width: 240px;
  max-width: 320px;
}

.bvy-cal-popup.visible {
  display: block;
}

.bvy-cal-popup-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #f3f4f6;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.bvy-cal-popup-close:hover {
  background: #e5e7eb;
  color: #111827;
  transform: scale(1.12);
}

.bvy-cal-popup-close:active {
  background: #d1d5db;
  transform: scale(0.92);
}

.bvy-cal-popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 24px 6px 0;
}

.bvy-cal-popup-date {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 10px;
}

.bvy-cal-popup-announcement {
  font-size: 0.88rem;
  color: #111827;
  line-height: 1.6;
  margin: 0 0 10px 0;
  padding: 8px 10px;
  background: #f0f9ff;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
}


.bvy-cal-popup-desc {
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
}

.bvy-cal-popup-desc dt {
  font-weight: 600;
  color: #111827;
  margin-top: 6px;
}

.bvy-cal-popup-desc dd {
  margin: 0;
  color: #4b5563;
}

.bvy-cal-popup-desc a {
  color: #3b82f6;
  text-decoration: underline;
}

.bvy-cal-popup-link {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  background: #f3742d;
  color: #fff !important;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.15s;
}

.bvy-cal-popup-link:hover {
  background: #d95f1f;
}

/* ---- Loading / Error states ---- */
.bvy-cal-loading {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  font-size: 0.95rem;
}

/* ---- Responsive: tablet (601–860px) ---- */
@media (max-width: 860px) and (min-width: 601px) {
  .bvy-cal-chip {
    font-size: 0.65rem;
    padding: 1px 4px;
  }

  .bvy-cal-day {
    min-height: 80px;
  }
}

/* ---- Responsive: mobile (≤600px) ---- */
@media (max-width: 600px) {
  .bvy-cal-wrapper {
    padding: 0 2px;
  }

  /* Tighter header */
  .bvy-cal-title {
    font-size: 1.05rem;
  }

  .bvy-cal-nav {
    padding: 6px 12px;
    font-size: 1rem;
  }

  /* Compact grid */
  .bvy-cal-grid {
    gap: 2px;
  }

  .bvy-cal-day-header {
    font-size: 0.65rem;
    padding: 4px 0;
    letter-spacing: 0;
  }

  /* Day cells: fixed height, just room for the number + dots */
  .bvy-cal-day {
    min-height: 48px;
    padding: 4px 3px 3px;
    border-radius: 6px;
  }

  .bvy-cal-day-num {
    font-size: 0.72rem;
    margin-bottom: 3px;
  }

  /* ── Chips → colored dots on mobile ── */
  .bvy-cal-chip {
    /* Reset text chip styles */
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    padding: 0;
    margin: 1px 1px 0 0;
    font-size: 0;
    /* hide text */
    line-height: 0;
    border-left: none;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    vertical-align: middle;
  }

  .bvy-cal-chip.tournament {
    background: #f3742d;
    border-left: none;
  }

  .bvy-cal-chip.event {
    background: #3b82f6;
    border-left: none;
  }

  /* Dot container: wrap dots horizontally */
  .bvy-cal-day .bvy-cal-chip {
    display: inline-block;
  }

  /* ── Popup → no changes on mobile (desktop-only element) ── */
  .bvy-cal-popup {
    display: none;
    /* hidden on mobile; sheet overlay is used instead */
  }
}

/* =========================================================
   Mobile Day Sheet Overlay
   Rendered directly on <body> — immune to WP theme transforms
   ========================================================= */
.bvy-cal-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99999;
  align-items: flex-end;
  justify-content: center;
}

.bvy-cal-sheet-overlay.visible {
  display: flex;
}

.bvy-cal-sheet-inner {
  background: #fff;
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-height: 75vh;
  overflow-y: auto;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.18);
  -webkit-overflow-scrolling: touch;
}

.bvy-cal-sheet-handle {
  width: 36px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 12px auto 0;
}

.bvy-cal-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid #f3f4f6;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.bvy-cal-sheet-date {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.bvy-cal-sheet-close {
  background: #f3f4f6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.bvy-cal-sheet-close:hover {
  background: #e5e7eb;
  color: #111827;
  transform: scale(1.1);
}

.bvy-cal-sheet-close:active {
  background: #d1d5db;
  transform: scale(0.93);
}

.bvy-cal-sheet-events {
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bvy-cal-sheet-card {
  border-radius: 10px;
  padding: 12px 14px;
}

.bvy-cal-sheet-card.tournament {
  background: #fff8f5;
  border-left: 4px solid #f3742d;
}

.bvy-cal-sheet-card.event {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
}

.bvy-cal-sheet-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.bvy-cal-sheet-card-time {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f3742d;
  margin-bottom: 2px;
}

.bvy-cal-sheet-card.event .bvy-cal-sheet-card-time {
  color: #3b82f6;
}

.bvy-cal-sheet-card-sub {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 8px;
}

.bvy-cal-sheet-card-announcement {
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
  margin: 6px 0;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.7);
  border-left: 3px solid #3b82f6;
  border-radius: 3px;
}

.bvy-cal-sheet-card-link {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: #f3742d;
  color: #fff !important;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none !important;
}

/* Has-events: pointer cursor on mobile day cells */
@media (max-width: 600px) {
  .bvy-cal-day.has-events {
    cursor: pointer;
  }
}