.brand-search {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.topbar-search-row {
  justify-self: center;
  width: 100%;
  max-width: 900px;
}

.topbar .controls {
  justify-self: start;
}

.topbar-right {
  justify-self: end;
  display: flex;
  gap: 8px;
}

/* Dark pill buttons */
.btn-dark {
  background: #f8c4bf;
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.btn-dark:hover {
  filter: brightness(0.95);
}

/* Icon sizing/alignment for header buttons */
.btn-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  object-fit: contain;
}

.btn-dark .btn-icon {
  margin-right: 6px;
  filter: none;
}

.btn-dark .btn-icon+.toggle-text {
  margin-left: 0;
}

/* ShowAdvisor Calendar - Web styles */
:root {
  --white: #ffffff;
  --header-bg: #333333;
  --day-chip: #647A99;
  --text-on-dark: #ffffff;
  --jumping-weekend: #cdf1ea;
  /* Colors.JUMPINGCOLOR */
  --dressage-weekend: #f8c4bf;
  /* Colors.DRESSAGECOLOR */
  --line-bg: #ffffff;
  --border: rgba(150, 150, 150, 1);
  --week-width: 300px;
  /* controls each week's width, old value: 16vw */
}

@font-face {
  font-family: 'Okomito';
  src: url('fonts/Okomito-Medium.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Okomito';
  src: url('fonts/Okomito-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Okomito';
  src: url('fonts/Okomito-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: #f7f7f7;
  color: #111;
}

.topbar,
.topbar *,
.search-panel,
.search-panel *,
.calendar-container,
.calendar-container *,
.bottom-scroller,
.bottom-scroller * {
  font-family: 'Okomito', 'Proxima Nova Alt', 'Muli', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  /* left controls, centered search, right legend */
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #e7e7e7;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Generic controls default */
/* Apply generic look to controls except dark buttons */
.controls select,
.controls button:not(.btn-dark) {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
}

/* Force dark style for dark buttons (Home, Today, Toggle) overriding generic button rule above */
.controls .btn-dark,
.topbar-right .btn-dark {
  background: #f8c4bf;
  color: #000;
  border: none;
}

.controls .btn-dark:hover,
.topbar-right .btn-dark:hover {
  filter: brightness(0.95);
}

.controls button {
  cursor: pointer;
}

/* Do not override dark buttons on hover */
.controls button:hover:not(.btn-dark) {
  background: #f0f0f0;
}

/* Hard override to ensure Today button is dark regardless of earlier rules */
#todayBtn.btn-dark {
  background: #f8c4bf !important;
  color: #000 !important;
  border: none !important;
}

.legend {
  display: flex;
  gap: 16px;
  align-items: center;
  color: #555;
  font-size: 14px;
}

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

.legend-chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #ccc;
}

.chip-jumping {
  background: var(--jumping-weekend);
}

.chip-dressage {
  background: var(--dressage-weekend);
}

.chip-today {
  background: #2f4f4f;
}

.calendar-container {
  width: 100%;
  height: auto;
  overflow: visible !important;
}

.calendar-scroll {
  width: 100%;
  height: auto;
  overflow-y: hidden !important;
  /* ensure only page/body provides vertical scroll */
  overflow-x: auto;
  /* enable horizontal scroll for touch/mouse */
  background: transparent;
  /* avoid large gray area below */
  padding: 0;
  /* remove side padding to eliminate extra space */
  display: flex;
  /* use flex to avoid inline-block gaps */
  gap: 0;
  /* no gaps between weeks */
  align-items: flex-start;
  position: relative;
  /* anchor for events overlay */
  /* Default lines height, will be updated by JS based on events */
  --lines-height: 60px;
  /* Enable smooth touch scrolling on iOS/mobile */
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar but keep functionality */
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

/* Hide any potential scrollbars inside calendarScroll (body should be the only vertical scroller) */
.calendar-scroll::-webkit-scrollbar {
  display: none;
}

.calendar-scroll {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Each week block width (adjust via --week-width) */
.week {
  flex: 0 0 var(--week-width);
  width: var(--week-width);
  margin: 0;
  border-right: 1px solid var(--white);
  /* thin separator at end of each week */
}

.week:first-child {
  border-left: 1px solid var(--white);
}

.week-header {
  background: var(--header-bg);
  color: var(--text-on-dark);
  height: 65px;
  border-left: 0;
  border-right: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 3;
}

.months-view {
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.months-text {
  color: #fff;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.5px;
}

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

.week-cell {
  background: var(--day-chip);
  border: 1px solid var(--white);
  display: grid;
  grid-template-rows: 1fr 1fr;
  align-items: stretch;
}

.week-cell.today {
  background: #2f4f4f;
}

.week-cell .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--text-on-dark);
  font-size: 13px;
}

/* Lines row beneath header (dynamic height based on events) */
.lines-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: var(--lines-height, 60px);
}

.lines {
  background: var(--line-bg);
  transition: background-color 200ms ease;
}

.sat {
  background: var(--jumping-weekend);
  transition: background-color 200ms ease;
}

/* Dressage mode toggles Saturday/Sunday color */
.calendar-scroll.dressage .sat {
  background: var(--dressage-weekend);
}

/* Events overlay */
.events-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: 72px;
  /* add a small gap below the header */
  min-height: 60px;
  /* minimum height, will expand with content */
  pointer-events: none;
  /* allow scroll through */
  z-index: 2;
}

/* Ensure spacer does not create extra empty space */
.events-spacer {
  height: 0 !important;
}

.event-bar {
  position: absolute;
  height: 40px;
  /* roomier bar */
  margin-top: 6px;
  /* more spacing between stacked rows */
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  color: #111;
  font-size: 12px;
  font-weight: 600;
  background: #ffd166;
  /* default fallback */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  /* clickable if needed */
}

.event-bar .label {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Category tag top-left of event */
.event-tag {
  position: absolute;
  top: -8px;
  left: -6px;
  height: 16px;
  line-height: 16px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #2f4f4f;
  /* dark slate to mimic RN tone */
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  text-transform: uppercase;
  pointer-events: none;
  /* let clicks go to bar */
}

/* Bottom horizontal scroller */
.bottom-scroller {
  width: 100%;
  height: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  /* blend with page */
  border-top: 1px solid #e0e0e0;
  position: sticky;
  /* stick to bottom of viewport when page taller than screen */
  bottom: 0;
  left: 0;
  z-index: 6;
  /* Enable smooth touch scrolling */
  -webkit-overflow-scrolling: touch;
}

.bottom-scroller-content {
  height: 1px;
  /* minimal height, just to make scrollbar */
}

/* Utility */
.hidden {
  display: none;
}

/* ----------------- Search / Filter Panel ----------------- */
/* Hide lower filter blocks panel; we only keep the first-row controls in the top bar */
.search-panel {
  display: none;
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 320px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.search-apply {
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.search-clear {
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

/* When dark theme is applied to Search/Clear, make sure they match */
.search-apply.btn-dark,
.search-clear.btn-dark {
  background: #f8c4bf;
  color: #000;
}

.search-apply.btn-dark:hover,
.search-clear.btn-dark:hover {
  filter: brightness(0.95);
}

.search-select {
  min-width: 170px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.search-or {
  color: #999;
  font-size: 14px;
  padding: 0 6px;
}

.filters-block {
  margin-top: 10px;
}

.filters-title {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 6px;
}

.chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.emoji-row {
  display: flex;
  gap: 6px;
}

.emoji-chip {
  font-size: 18px;
  line-height: 24px;
}

.countries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}

.chip {
  padding: 6px 10px;
  border: 1px solid #ccc;
  background: #f7f7f7;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.chip:hover {
  background: #efefef;
}

.chip.selected {
  background: #c2c2c2;
}

/* ----------------- Takeover Ad Overlay ----------------- */
.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.ad-overlay.hidden {
  display: none;
}

.ad-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.ad-modal {
  position: relative;
  z-index: 1;
  max-width: 100vw;
  max-height: 90vh;
  min-width: 300px;
  min-height: 300px;
}

.ad-modal img {
  max-width: 96vw;
  max-height: 86vh;
  display: block;
  border-radius: 8px;
}

.ad-close {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0.9;
  font-size: 24px;
  padding: 16px 32px;
}

/* Ad loading state */
.ad-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 40, 40, 0.95);
  border-radius: 8px;
}

.ad-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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