/* Reel Spinner - ported from boats.co.uk mobile */

/* Flag bar */
.carousel-viewport {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.carousel-viewport::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.carousel-viewport.carousel-drag-enabled {
  cursor: grab;
}

.carousel-viewport.carousel-drag-enabled.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.desktop-reel-search {
  display: none;
}

.mobile-reel-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.reels-loading:not(.reels-ready) .mobile-reel-stack {
  opacity: 0;
  transform: translateY(4px);
}

.flag-bar {
  width: 100%;
  max-width: 301px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    linear-gradient(
      90deg,
      rgba(62,68,83,0.89) 5.77%,
      rgba(179,179,179,0.89) 50%,
      rgba(62,68,83,0.89) 95%
    );
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overflow: hidden;
  perspective: 900px;
}

.flag-bar:active { cursor: grabbing; }

.flag-bar::before,
.flag-bar::after {
  content: "";
  position: absolute;
  top: 0;
  width: 66px;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.flag-bar::before {
  left: 0;
  background: linear-gradient(to right, rgba(4, 6, 12, 0.72), rgba(4, 6, 12, 0));
}

.flag-bar::after {
  right: 0;
  background: linear-gradient(to left, rgba(4, 6, 12, 0.72), rgba(4, 6, 12, 0));
}

.flag-drum {
  height: 52px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.flag-item {
  flex: 0 0 54px;
  width: 54px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transform-origin: center center;
  transform-style: preserve-3d;
  transition: opacity 0.18s ease;
}

/* CSS Flags */
.flag {
  border-radius: 5px;
  display: block;
  transform-style: preserve-3d;
  transition: opacity 0.18s ease;
}

.flag-image {
  border-radius: 5px;
}

.flag-de {
  background: linear-gradient(to bottom, #000 33.33%, #DD0000 33.33%, #DD0000 66.66%, #FFCC00 66.66%);
}

.flag-es {
  background: linear-gradient(to bottom, #c60b1e 25%, #ffc400 25%, #ffc400 75%, #c60b1e 75%);
}

.flag-gb {
  background:
    linear-gradient(to bottom, transparent 40%, #cf142b 40%, #cf142b 60%, transparent 60%),
    linear-gradient(to right, transparent 40%, #cf142b 40%, #cf142b 60%, transparent 60%),
    linear-gradient(to bottom, transparent 34%, white 34%, white 66%, transparent 66%),
    linear-gradient(to right, transparent 34%, white 34%, white 62%, transparent 62%),
    linear-gradient(25deg, transparent 45%, #cf142b 45%, #cf142b 50%, transparent 50%),
    linear-gradient(-25deg, transparent 45%, #cf142b 45%, #cf142b 50%, transparent 50%),
    linear-gradient(155deg, transparent 45%, #cf142b 45%, #cf142b 50%, transparent 50%),
    linear-gradient(-155deg, transparent 45%, #cf142b 45%, #cf142b 50%, transparent 50%),
    linear-gradient(25deg, transparent 42%, white 42%, white 53%, transparent 53%),
    linear-gradient(-25deg, transparent 42%, white 42%, white 53%, transparent 53%),
    linear-gradient(155deg, transparent 42%, white 42%, white 53%, transparent 53%),
    linear-gradient(-155deg, transparent 42%, white 42%, white 53%, transparent 53%),
    #00247d;
}

.flag-fr {
  background: linear-gradient(to right, #002395 33.33%, #fff 33.33%, #fff 66.66%, #ed2939 66.66%);
}

.flag-it {
  background: linear-gradient(to right, #009246 33.33%, #fff 33.33%, #fff 66.66%, #ce2b37 66.66%);
}

/* Reel bar (filter bars) */
.reel-bar {
  width: 100%;
  max-width: 301px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    linear-gradient(
      90deg,
      rgba(62,68,83,0.89) 5.77%,
      rgba(179,179,179,0.89) 50%,
      rgba(62,68,83,0.89) 95%
    );
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

.reel-bar.faded {
  opacity: 0.5;
  cursor: default;
}

.reel-bar:active { cursor: grabbing; }

.reel-bar::before,
.reel-bar::after {
  content: "";
  position: absolute;
  top: 0;
  width: 66px;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.reel-bar::before {
  left: 0;
  background: linear-gradient(to right, rgba(4, 6, 12, 0.72), rgba(4, 6, 12, 0));
}

.reel-bar::after {
  right: 0;
  background: linear-gradient(to left, rgba(4, 6, 12, 0.72), rgba(4, 6, 12, 0));
}

.reel-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  perspective: 680px;
}

.reel-webgl-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.reel-drum {
  position: absolute;
  top: 0;
  left: 0;
  height: 52px;
  display: flex;
  align-items: center;
  will-change: transform;
  white-space: nowrap;
}

.reel-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0;
  font-family: 'Golos Text', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: rgba(255,255,255,0.92);
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  position: relative;
  transform: rotateY(0deg) scale(1);
  transform-origin: center center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition:
    opacity 0.18s ease,
    color 0.18s ease;
  opacity: 0.72;
}

.reel-item.is-webgl-hidden {
  color: transparent !important;
  -webkit-text-fill-color: transparent;
}

.flag-item.is-webgl-hidden .flag {
  opacity: 0 !important;
}

.reel-item-all {
  font-size: 10px;
  letter-spacing: 0;
}

.reel-item.is-active {
  opacity: 1;
  color: #fff;
}

.flag-item.is-active {
  transform: none;
}

/* Results button */
.results-btn {
  display: block;
  margin-top: 20px;
  width: 173px;
  height: 44px;
  border-radius: 27px;
  background: #d99400;
  border: none;
  cursor: pointer;
  font-family: 'Golos Text', sans-serif;
  font-weight: 500;
  font-size: 17px;
  color: white;
  text-align: center;
  line-height: 44px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.results-btn:hover {
  background: #c58600;
  color: white;
  text-decoration: none;
}

.results-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.results-btn .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: reel-spin 0.6s linear infinite;
  vertical-align: middle;
}

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

/* Home reel switches to the desktop layout at 855px (task 5267 #1). */
@media (min-width: 855px) {
  .desktop-reel-search {
    display: block;
    position: relative;
    width: min(1005px, calc(100vw - 96px));
    z-index: 80;
  }

  .desktop-reel-main {
    display: grid;
    position: relative;
    grid-template-columns: 119px repeat(3, minmax(0, 1fr)) 210px;
    align-items: stretch;
    height: 46px;
    overflow: hidden;
    z-index: 80;
    border-radius: 12px;
    background:
      linear-gradient(90deg, rgba(32, 38, 53, 0.9) 5.77%, rgba(120, 120, 120, 0.18) 38.46%, rgba(205, 205, 205, 0.12) 50%, rgba(120, 120, 120, 0.18) 61.81%, rgba(32, 38, 53, 0.98) 95%),
      linear-gradient(90deg, rgba(32, 38, 53, 0.98) 5.77%, rgba(132, 132, 132, 0.92) 50%, rgba(32, 38, 53, 0.98) 95%);
  }

  .desktop-reel-flag,
  .desktop-reel-segment {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    color: #fff;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease;
  }

  .desktop-reel-flag {
    padding: 0 25px 0 31px;
  }

  .desktop-reel-segment {
    padding: 0 24px 0 45px;
    border-left: 2px solid #3E4453;
    font-family: 'Golos Text', sans-serif;
    font-size: 13px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
  }

  .desktop-reel-flag:hover,
  .desktop-reel-segment:hover,
  .desktop-reel-segment.is-open,
  .desktop-reel-flag.is-open {
    background: rgba(255, 255, 255, 0.08);
  }

  .desktop-reel-flag-image {
    width: 27px;
    height: 16.2px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
  }

  .desktop-reel-arrow {
    width: 6.12px;
    height: 6.12px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.96;
    transition: transform 220ms ease;
  }

  .desktop-reel-segment.is-open .desktop-reel-arrow,
  .desktop-reel-flag.is-open .desktop-reel-arrow {
    transform: rotate(135deg);
  }

  .desktop-results-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    height: 100%;
    padding: 0 14px;
    background: #d99400;
    color: #fff;
    font-family: 'Golos Text', sans-serif;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 500;
    text-decoration: none;
    transition: background 180ms ease;
  }

  .desktop-results-btn:hover {
    background: #c58600;
    color: #fff;
    text-decoration: none;
  }

  .desktop-results-btn.loading {
    pointer-events: none;
    opacity: 0.82;
  }

  .desktop-reel-dropdown {
    position: absolute;
    top: 46px;
    left: 119px;
    z-index: 90;
    width: 212px;
    max-height: 0;
    overflow: hidden;
    border-radius: 0 0 16px 16px;
    opacity: 0;
    transform: translateY(0);
    transform-origin: top center;
    clip-path: inset(0 0 100% 0 round 0 0 16px 16px);
    background: linear-gradient(90deg, rgba(26, 32, 47, 0.74) -22.85%, rgba(104, 104, 104, 0.32) 100.2%, rgba(185, 185, 185, 0.16) 143.63%, rgba(104, 104, 104, 0.32) 188.1%, rgba(26, 32, 47, 0.82) 313.01%);
    will-change: max-height, opacity, transform, clip-path;
    transition:
      max-height 620ms cubic-bezier(0.22, 1, 0.36, 1),
      clip-path 620ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 360ms ease;
  }

  .desktop-reel-dropdown[data-state="open"] {
    max-height: min(754px, calc(100vh - 170px));
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0 round 0 0 16px 16px);
  }

  .desktop-reel-dropdown[data-kind="flag"] {
    top: 36px;
    z-index: 79;
  }

  .desktop-reel-dropdown-list {
    max-height: min(754px, calc(100vh - 170px));
    overflow-y: auto;
    padding: 12px 0 18px;
    opacity: 0;
    transform: translateY(-18px);
    transition:
      opacity 360ms ease 80ms,
      transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .desktop-reel-dropdown[data-state="open"] .desktop-reel-dropdown-list {
    opacity: 1;
    transform: translateY(0);
  }

  .desktop-reel-dropdown-list::-webkit-scrollbar {
    display: none;
  }

  #home-page .hero-tagline {
    transition:
      opacity 220ms ease,
      transform 220ms ease;
  }

  #home-page.desktop-reel-dropdown-open .hero-tagline {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
  }

  .desktop-reel-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 15px;
    padding: 0 20px 0 46px;
    text-align: left;
    color: rgba(255, 255, 255, 0.88);
    font-family: 'Golos Text', sans-serif;
    font-size: 8px;
    line-height: 15px;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease;
  }

  .desktop-reel-option:hover,
  .desktop-reel-option.is-selected {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .desktop-reel-option-count {
    margin-left: 18px;
    font-size: 11px;
    opacity: 0.72;
    letter-spacing: 0.08em;
  }

  .desktop-reel-option-language {
    justify-content: flex-start;
    min-height: 24px;
    padding: 0 12px;
    gap: 9px;
    font-size: 8px;
    line-height: 15px;
    letter-spacing: 0.11em;
  }

  .desktop-reel-dropdown[data-kind="flag"] .desktop-reel-dropdown-list {
    padding-top: 18px;
  }

  .desktop-reel-option-loading {
    justify-content: center;
    min-height: 32px;
    padding: 0 16px;
    opacity: 0.74;
  }

  .desktop-reel-option-flag {
    width: 22px;
    height: 14px;
    margin-right: 0;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
  }

  .mobile-reel-stack {
    display: none;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .reel-bar,
  .flag-bar {
    height: 48px;
    border-radius: 12px;
  }

  .reel-bar::before,
  .reel-bar::after,
  .flag-bar::before,
  .flag-bar::after {
    width: 56px;
  }

  .reel-drum,
  .flag-drum {
    height: 48px;
  }

  .flag-item {
    height: 48px;
  }

  .reel-item {
    padding: 0;
    font-size: 10px;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: clip;
  }

  .reel-item-all {
    font-size: 9px;
  }
}
