/* Venue (TEC) – Course data panel from EP Venues
   Updated to match Site Uniformity (Games/Scorecard style) */

:root {
    /* Shared Variables (mirrored from Games CSS) */
    --color-text-muted: #6b7280;
    --color-text: #111827;
    --bg-elev: #ffffff;
    --bg-elev-alt: #f3f4f6;
    --color-border: #e5e7eb;

    /* Local overrides */
    --eps-sticky-firstcol-bg: var(--bg-elev, #ffffff);
    --epv-max-width: 1280px;
}

:root[data-theme="dark"] {
    --color-text-muted: #9ca3af;
    --color-text: #f9fafb;
    --bg-elev: #1f2937;
    --bg-elev-alt: #374151;
    --color-border: #4b5563;
}

.epv-venue-panel{
  margin: 24px 0;
  padding: 0;
  width: 100%;
  max-width: var(--epv-max-width, 1280px);
  margin-left: auto;
  margin-right: auto;
  font-family: inherit;
  color: var(--color-text, #111827);
}

/* Ensure visibility when wrapped inside Elementor containers */
.tribe-events-single--venue .elementor-widget-shortcode .elementor-shortcode{ display:block; }
.tribe-events-single--venue .elementor-widget-tribe-event-venue,
.tribe-events-single--venue .elementor-widget-tribe_events_venue,
.tribe-events-single--venue .elementor-widget-tribe-events-venue,
.tribe-events-single--venue [class*="elementor-widget-tribe"][class*="venue"]{
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
}

.epv-events-below{ width:100%; }

.epv-venue-panel h3{ 
  margin: 0 0 12px; 
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text, #111827);
}
.epv-venue-title{ margin-bottom: 6px; }

.epv-accordion{ display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.epv-acc-item{ 
    min-width: 0; /* Prevent flex blowout */
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    background: var(--bg-elev, #ffffff) !important;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.epv-acc-item + .epv-acc-item{ margin-top: 0; } /* Reset margin since we use gap */

.epv-acc-header{ margin: 0; padding: 0; background: transparent !important; border: 0 !important; }

/* Modern Accordion Button */
.epv-acc-button{
  appearance: none;
  background: var(--bg-elev-alt, #f3f4f6) !important; 
  border: 0 !important;
  border-bottom: 1px solid var(--color-border, #e5e7eb) !important;
  padding: 12px 16px;
  margin: 0;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text, #111827) !important;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.epv-acc-button:focus{ outline: 2px solid #3B73B3; outline-offset: -2px; }
.epv-acc-button:hover{ background: #e5e7eb !important; }

/* Expanded State */
.epv-acc-button[aria-expanded="true"]{
    background: var(--bg-elev-alt, #f3f4f6) !important;
    color: var(--color-text, #111827);
}

.epv-acc-indicator{ 
    display:inline-block; 
    transition: transform .2s ease; 
    font-size: 1.2em; 
    opacity: 0.6;
}
.epv-acc-button[aria-expanded="true"] .epv-acc-indicator{ transform: rotate(90deg); }

.epv-acc-panel{ 
    padding: 16px; 
    background: var(--bg-elev, #ffffff);
}
.epv-acc-panel[hidden] { display: none; }

.epv-venue-meta{ 
  font-size:.95rem; opacity:.85; margin-bottom:12px; 
}

/* Tables */
.epv-tee-table{ 
  width: 100%; 
  border-collapse: separate; 
  border-spacing: 0;
  font-size: .9rem; 
  color: var(--color-text, #111827);
}

.epv-tee-table th, .epv-tee-table td{ 
  text-align: left; 
  padding: 10px 12px; 
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.epv-tee-table th{ 
    font-weight: 600; 
    background: var(--bg-elev-alt, #f3f4f6) !important;
    color: var(--color-text, #111827) !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Tee Name Column */
.epv-tee-name{ font-weight: 600; white-space: nowrap; }

.epv-note{ font-size:.85rem; color: var(--color-text-muted, #6b7280); margin-top:8px; font-style: italic; }

/* Per-hole yardages table wrapper */
.epv-tee-holes{ 
    display: block; width: 100%; max-width: 100%; 
    overflow-x: auto !important; position: relative; 
    border: 1px solid var(--color-border, #e5e7eb); border-radius: 6px; 
    overscroll-behavior-x: none; touch-action: pan-x pan-y; 
}
.epv-tee-holes-table{ table-layout: fixed; width: 100%; border-collapse: separate; border-spacing: 0; }
.epv-tee-holes-table th,
.epv-tee-holes-table td{ text-align: center; border-right: 1px solid var(--color-border, #e5e7eb); }
.epv-tee-holes-table td:last-child, .epv-tee-holes-table th:last-child { border-right: none; }

/* Sticky first column (Tee Names) */
.epv-tee-holes-table th:first-child,
.epv-tee-holes-table td:first-child{
  text-align: left;
  white-space: normal;
  position: sticky;
  left: 0;
  z-index: 20; 
  background: var(--bg-elev, #ffffff); /* Ensure opaque */
  border-right: 2px solid var(--color-border, #e5e7eb);
  min-width: 180px;
  width: 180px;
  line-height: 1.3;
}
/* Ensure header corner is above everything */
.epv-tee-holes-table thead th:first-child{
    z-index: 30;
    background: var(--bg-elev-alt, #f3f4f6) !important;
}

/* Row coloring */
.epv-tee-holes-table tr:nth-child(even) td:not(:first-child) {
    background-color: rgba(0,0,0,0.015);
}

/* Details Grid */
.epv-details{ display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin-bottom: 0; }
.epv-detail{ display: contents; }
.epv-dt{ font-weight: 600; color: var(--color-text-muted, #6b7280); font-size: 0.9rem; }
.epv-dd{ color: var(--color-text, #111827); font-size: 0.95rem; }

@media (max-width:700px){
  .epv-details{ grid-template-columns: 1fr; gap: 4px; }
  .epv-dt{ margin-top: 8px; }
  .epv-detail:first-child .epv-dt { margin-top: 0; }
}

/* Par/HC table */
.epv-hole-meta{ 
    display: block; width: 100%; max-width: 100%; 
    overflow-x: auto !important; position: relative; margin-top: 0; 
    border: 1px solid var(--color-border, #e5e7eb); border-radius: 6px; 
    overscroll-behavior-x: none; touch-action: pan-x pan-y; 
}
.epv-hole-meta-table{ table-layout: fixed; width: 100%; border-collapse: separate; border-spacing: 0; }
.epv-hole-meta-table th,
.epv-hole-meta-table td{ text-align: center; border-right: 1px solid var(--color-border, #e5e7eb); }

/* Sticky first column for Par & HCP table */
.epv-hole-meta-table th:first-child,
.epv-hole-meta-table td:first-child{
  text-align: left;
  white-space: normal;
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--bg-elev-alt, #f3f4f6); /* Par row header look */
  border-right: 2px solid var(--color-border, #e5e7eb);
  min-width: 180px;
  width: 180px;
  font-weight: 600;
}
.epv-hole-meta-table thead th:first-child{
    z-index: 30;
}

/* Equal hole column widths */
.epv-tee-holes-table th:not(:first-child),
.epv-tee-holes-table td:not(:first-child),
.epv-hole-meta-table th:not(:first-child),
.epv-hole-meta-table td:not(:first-child){ width: 42px; min-width: 42px; padding: 8px 4px; }


@media (max-width:700px){
  /* Only right-align numeric columns in Tee Summary */
  .epv-tee-table:not(.epv-tee-holes-table):not(.epv-hole-meta-table) th:nth-child(n+2),
  .epv-tee-table:not(.epv-tee-holes-table):not(.epv-hole-meta-table) td:nth-child(n+2){ text-align: right; }
}

/* Buttons (Reload + Return) */
.ep-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #3B73B3; /* Keep site blue for main actions */
  color: #fff !important;
  border: 0;
  border-radius: 6px; /* standard radius */
  padding: 8px 16px;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color 0.2s;
  cursor: pointer;
}
.ep-btn:hover{ background: #2c5c96; color: #fff !important; }
.ep-btn:active{ background: #1e4b80; }
.ep-btn[disabled]{ opacity: .6; cursor: not-allowed; }
.ep-btn:focus{ outline: 2px solid #9ec5fe; outline-offset: 2px; }

#epv-return-to-event.ep-btn{ background:#6b7280; } /* Neutral return button */
#epv-return-to-event.ep-btn:hover{ background:#4b5563; }

/* Note: Do NOT hide TEC header/location globally — Elementor Venue widgets rely on them.
   If you need to hide specific blocks, do so in your theme template or with a more
   specific selector near the EPV panel to avoid suppressing widgets site‑wide. */
