/* ============================================
   MOBILE BOTTOM NAVIGATION — FLOATING DOCK
   ============================================ */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--mobile-nav-float-gap, 12px) + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  padding: 0;
  isolation: isolate;
  max-width: 420px;
  margin-inline: auto;
  pointer-events: none;
  animation: mobileDockIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mobile-bottom-nav::before {
  content: none;
}

.mobile-nav-wrapper {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.2rem;
  min-height: var(--mobile-nav-height, 56px);
  width: 100%;
  padding: 0.35rem 0.4rem;
  border-radius: 22px;
  background: rgba(14, 14, 24, 0.96);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 215, 0, 0.22);
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.45),
    0 2px 10px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@keyframes mobileDockIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Navigation Items */
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.35rem 0.2rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.2s var(--ease-smooth, ease), background-color 0.2s var(--ease-smooth, ease), transform 0.2s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  flex: 1 1 0;
  min-width: 0;
  max-width: 6.5rem;
  position: relative;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 14px;
}

.mobile-nav-item:active {
  background: rgba(255, 215, 0, 0.08);
}

.nav-item-icon {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.mobile-nav-item i {
  font-size: 1.125rem;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

/* Caret in server label */
.nav-select-caret {
  font-size: 0.55rem !important;
  opacity: 0.7;
  vertical-align: middle;
  margin-left: 1px;
}

.nav-item-label {
  font-size: 0.625rem;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
  letter-spacing: 0.2px;
  opacity: 0.8;
}

/* Ripple Effect */
.nav-ripple {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0);
  transition: all 0.5s ease;
}

/* Hover/Touch State */
.mobile-nav-item:active .nav-ripple {
  opacity: 1;
  transform: scale(1.5);
  transition: all 0.3s ease-out;
}

.mobile-nav-item:active .nav-item-icon {
  transform: scale(0.9);
}

/* Active State */
.mobile-nav-item.active {
  color: var(--accent-color);
}

.mobile-nav-item.active .nav-item-icon {

}

.mobile-nav-item.active i {
  transform: scale(1.1);
  filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.6));
}

.mobile-nav-item.active .nav-item-label {
  opacity: 1;
  font-weight: 700;
  transform: translateY(-2px);
}

/* Logo Above Navigation — hidden */
.mobile-nav-logo-wrapper {
  display: none !important;
}
.mobile-nav-logo-wrapper-UNUSED {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: linear-gradient(180deg,
      rgba(20, 20, 25, 0.98) 0%,
      rgba(15, 15, 20, 1) 100%);
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-bottom: none;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(255, 215, 0, 0.2),
    inset 0 1px 0 rgba(255, 215, 0, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  z-index: 10;
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(-3px);
  }
}

.mobile-nav-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-logo {
  height: 14px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.4));
  transition: all 0.3s ease;
}

.mobile-nav-logo-link:active {
  transform: scale(0.95);
}

.mobile-nav-logo-link:active .mobile-nav-logo {
  filter: drop-shadow(0 3px 16px rgba(255, 215, 0, 0.6));
}

/* Active Indicator Animation */
.nav-active-indicator {
  display: none;
}

/* Floating sheet overlays (server picker + More) */
.server-selector-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 16, 0.55);
  z-index: 2000;
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  animation: fadeIn 0.28s var(--ease-smooth, ease);
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    calc(var(--mobile-nav-clearance, 80px) + 10px)
    max(12px, env(safe-area-inset-left, 0px));
}

.server-selector-overlay.show {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.server-selector-content {
  background: rgba(18, 18, 30, 0.92);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-radius: 22px;
  width: min(100%, 420px);
  max-height: min(62vh, 520px);
  overflow-y: auto;
  animation: floatingSheetIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-overflow-scrolling: touch;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.2);
}

@keyframes floatingSheetIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.server-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
  position: sticky;
  top: 0;
  background: rgba(18, 18, 30, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
  border-radius: 22px 22px 0 0;
}

.server-selector-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.server-selector-close {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.2);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.server-selector-close:active {
  background: var(--accent-color);
  color: var(--primary-dark);
  transform: rotate(90deg) scale(0.9);
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
}

.server-selector-list {
  padding: 1rem;
}

.server-selector-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem;
  text-decoration: none;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 215, 0, 0.08);
  border-radius: 16px;
  margin-bottom: 0.75rem;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.server-selector-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-color), transparent);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.server-selector-item:active {
  transform: scale(0.96);
  background: rgba(255, 215, 0, 0.08);
  border-color: var(--accent-color);
}

.server-selector-item.active {
  background: rgba(255, 215, 0, 0.12);
  border-color: var(--accent-color);
}

.server-selector-item.active::before {
  opacity: 1;
}

.server-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.2);
  flex-shrink: 0;
}

.server-item-icon i {
  font-size: 1.25rem;
  color: var(--accent-color);
}

.server-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.server-item-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.server-item-check {
  color: var(--accent-color);
  font-size: 1.125rem;
  margin-left: auto;
}


@media (max-width: 1261px) {

  /* Hide desktop navbar */
  .navbar {
    display: none !important;
  }

  /* Show mobile bottom nav with logo */
  .mobile-bottom-nav {
    display: flex;
  }

  /* Adjust main layout for floating dock clearance */
  .main-layout {
    padding-top: 0;
    margin-top: 0;
    min-height: 100dvh;
    padding-bottom: calc(var(--mobile-nav-clearance, 80px) + 8px);
  }

  /* Matches / watch shells fill the viewport; dock floats over them */
  .matches-page-wrapper,
  .watch-page-wrapper {
    top: 0;
    bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    min-height: 0;
    height: auto;
  }

  .matches-page-container,
  .watch-page-container {
    padding-top: 0;
  }

  /* Natural order: info → player; allow scroll so controls aren't clipped */
  .watch-page-wrapper {
    flex-direction: column;
  }

  .watch-page-container {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  .watch-info-bar {
    position: relative;
    top: auto;
    z-index: 10;
    border-bottom: 1px solid rgba(255, 215, 0, 0.12);
    padding: 0.75rem 0.875rem;
    gap: 0.75rem;
    flex-shrink: 0;
  }

  /* 16:9 player — don't squash into leftover flex space */
  .watch-player-wrapper {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 200px;
    max-height: none;
  }

  .watch-player-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  /* Desktop-only multi-stream control */
  #addMultiStreamBtn {
    display: none !important;
  }

  .content-container {
    max-width: 100vw;
    width: 100%;
    /* overflow-x: hidden; */
    box-sizing: border-box;
  }

  .matches-content-wrapper {
    max-width: 100%;
    overflow-x: hidden;
    padding: 0.5rem;
    box-sizing: border-box;
  }

  .matches-page-container {
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
  }

  .matches-page-wrapper {
    max-width: 100vw;
    overflow-x: hidden;
    width: 100%;
  }

  /* favorite-btn-large styles moved to watch-info-right grid section below */

  /* Hide desktop chat column; FAB opens .mobile-fullscreen (chat.css) */
  .chat-sidebar:not(.mobile-fullscreen) {
    display: none !important;
  }

  .navbar-container {
    padding: 0 1rem;
  }

  .navbar-left {
    gap: 0.75rem;
  }

  .nav-link span {
    display: none;
  }

  .nav-link {
    padding: 0.5rem 0.75rem;
    min-width: auto;
  }

  .contact-btn span {
    display: none;
  }

  .contact-btn {
    padding: 0.625rem 0.875rem;
  }

  .navbar-right {
    gap: 0.5rem;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .channels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .channel-card {
    gap: 0.5rem;
    padding: 0.625rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 6px;
  }

  .channel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
  }

  .channel-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
    margin: 0 auto;
  }

  .channel-icon img {
    border-radius: 0;
  }

  .channel-info {
    width: 100%;
    min-width: 0;
    text-align: center;
  }

  .channel-name {
    width: 100%;
    font-size: 13px;
    font-weight: 500;
    word-wrap: break-word;
    line-height: 1.3;
    margin-bottom: .25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .channel-meta {
    display: none;
  }

  .channel-id,
  .channel-code {
    display: none;
  }

  .server-badge {
    display: none;
  }

  .channel-actions {
    width: 100%;
    gap: 0.375rem;
    margin-left: 0;
    justify-content: center;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-color);
    box-sizing: border-box;
  }

  .channel-card .watch-btn {
    font-size: 0.75rem;
    /* padding: 0.375rem 0.625rem; */
    flex: 1;
    min-width: 0;
  }

  .watch-btn i {
    display: none;
  }

  .favorite-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 14px;
    flex-shrink: 0;
  }

  .channels-header {
    padding: 1.25rem 0.5rem;
  }

  .channels-title {
    font-size: 1.5rem;
  }

  .match-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem;
    min-height: auto;
  }

  .match-badge {
    min-width: auto;
    width: 100%;
    flex-wrap: wrap;
  }

  .match-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
  }

  .match-title {
    white-space: normal;
    font-size: 0.8125rem;
  }

  .match-meta {
    font-size: 0.625rem;
    gap: 0;
  }

  .category-title {
    font-size: 0.875rem;
    padding: 0.4375rem 0.625rem;
    margin-bottom: 0.375rem;
  }

  .matches-category {
    margin-bottom: 1.25rem;
  }

  .matches-page-wrapper {
    flex-direction: column;
  }

  .matches-search-bar {
    padding: 0.875rem;
    flex-direction: column;
    gap: 0.75rem;
  }

  .category-filter-wrapper {
    width: 100%;
    min-width: unset;
  }

  .iptv-content-wrapper {
    padding: 1rem;
  }

  .iptv-loading,
  .no-results-message {
    padding: 2rem 0;
  }

  .load-more-container {
    padding: 1rem 0;
  }

  .channel-actions {
    gap: 0.375rem;
  }

  .favorite-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .watch-btn {
    padding: 0.5rem 0.75rem;
    font-size: 13px;
  }

  .watch-btn i {
    font-size: 11px;
  }

  .fav-tab {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    flex: 1;
  }

  .fav-tab i {
    font-size: 0.9rem;
  }

  .matches-content-wrapper {
    padding: 1rem;
  }

  .watch-info-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .watch-info-left {
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
    overflow: hidden;
  }

  .watch-info-text {
    width: 100%;
    gap: 0.375rem;
  }

  .watch-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    min-width: 0;
  }

  .watch-meta {
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
  }

  /* Main container - flex column layout */
  .watch-info-right {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem;
    width: 100%;
  }

  /* Selects group - full width, can contain multiple selects */
  .watch-selects-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  /* Select wrapper - full width within selects group */
  .watch-selects-group .watch-select-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
  }

  /* Make select fully responsive */
  .watch-selects-group .watch-select {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 0.875rem;
    padding: 0.625rem 0.75rem;
  }

  /* Hide label icon on very small screens */
  @media (max-width: 360px) {
    .watch-selects-group .watch-select-label {
      display: none;
    }
  }

  /* Actions group - grid layout for buttons */
  .watch-actions-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
  }

  /* Buttons in actions group */
  .watch-actions-group > .favorite-btn-large,
  .watch-actions-group > .watch-embed-toggle-btn,
  .watch-actions-group > .back-btn-small,
  .watch-actions-group > a {
    width: 100%;
    padding: 0.75rem 0.5rem;
    font-size: 0.8125rem;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    border-radius: 8px;
    min-height: 44px;
    white-space: nowrap;
    transition: all 0.2s ease;
  }

  /* Hide text on mobile, show only icons */
  .watch-actions-group > .favorite-btn-large span,
  .watch-actions-group > .watch-embed-toggle-btn span,
  .watch-actions-group > .back-btn-small span {
    display: none;
  }

  /* Make icons larger for better visibility */
  .watch-actions-group > .favorite-btn-large i,
  .watch-actions-group > .watch-embed-toggle-btn i,
  .watch-actions-group > .back-btn-small i,
  .watch-actions-group > a i {
    font-size: 1.125rem;
    flex-shrink: 0;
  }

  /* Hide empty selects group */
  .watch-selects-group:empty {
    display: none;
  }
}

