/* ============================================
   MOBILE BOTTOM NAVIGATION — MODERN TAB BAR
   ============================================ */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  padding:
    0
    max(10px, env(safe-area-inset-left, 0px))
    env(safe-area-inset-bottom, 0px)
    max(10px, env(safe-area-inset-right, 0px));
  isolation: isolate;
  max-width: none;
  margin-inline: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.45) 55%, rgba(0, 0, 0, 0.72) 100%);
}

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

.mobile-nav-wrapper {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.25rem;
  min-height: 64px;
  width: 100%;
  max-width: 480px;
  margin: 8px auto 10px;
  padding: 0.35rem;
  border-radius: 18px;
  background: #12121c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  padding: 0.45rem 0.35rem;
  text-decoration: none;
  color: #9ca3af;
  transition: color 0.15s ease, background 0.15s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  position: relative;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 14px;
}

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

.nav-item-icon {
  position: relative;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-nav-item i {
  font-size: 1.2rem;
  line-height: 1;
  position: relative;
  z-index: 2;
}

.nav-select-caret {
  font-size: 0.62rem !important;
  opacity: 0.75;
  flex-shrink: 0;
}

.nav-item-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  max-width: 100%;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1;
  opacity: 1;
}

.nav-item-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 4.6rem;
}

.nav-ripple,
.nav-active-indicator,
.mobile-nav-logo-wrapper,
.mobile-nav-logo-wrapper-UNUSED,
.mobile-nav-logo-link,
.mobile-nav-logo {
  display: none !important;
}

.mobile-nav-item.active {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.mobile-nav-item.active .nav-item-icon {
  background: rgba(255, 215, 0, 0.14);
  color: #ffd700;
}

.mobile-nav-item.active i {
  transform: none;
  filter: none;
}

.mobile-nav-item.active .nav-item-label {
  opacity: 1;
  font-weight: 750;
  transform: none;
  color: #ffd700;
}

/* Floating sheet overlays (server picker + More) */
.server-selector-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 2000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s 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: #12121c;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 20px 20px 16px 16px;
  width: min(100%, 420px);
  max-height: min(68vh, 560px);
  overflow-y: auto;
  animation: floatingSheetIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.server-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  background: #12121c;
  z-index: 10;
  border-radius: 20px 20px 0 0;
}

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

.server-selector-close {
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.server-selector-close:active {
  background: rgba(255, 215, 0, 0.18);
  color: var(--accent-color);
  transform: none;
  box-shadow: none;
}

.server-selector-list {
  padding: 0.65rem 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.server-selector-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  text-decoration: none;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.server-selector-item::before {
  display: none;
}

.server-selector-item:active {
  transform: none;
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.28);
}

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

.server-selector-item.active::before {
  display: none;
}

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

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

.server-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

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

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

/* ===== Modern More menu (action grid) ===== */
.mobile-more-sheet {
  width: min(100%, 420px);
  background: #12121c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px 22px 18px 18px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  padding: 0.45rem 0.85rem 0.95rem;
  animation: floatingSheetIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-more-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0.2rem auto 0.65rem;
}

.mobile-more-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0 0.15rem;
}

.mobile-more-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 215, 0, 0.85);
}

.mobile-more-head h3 {
  margin: 0.1rem 0 0;
  font-size: 1.15rem;
  font-weight: 750;
  color: #f4f4f5;
  letter-spacing: -0.02em;
}

.mobile-more-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #a1a1aa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
}

.mobile-more-close:active {
  background: rgba(255, 215, 0, 0.16);
  color: #ffd700;
}

.mobile-more-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.mobile-more-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 5.4rem;
  padding: 0.75rem 0.4rem;
  border-radius: 14px;
  text-decoration: none;
  color: #e4e4e7;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-more-tile:active {
  transform: scale(0.97);
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.3);
}

.mobile-more-tile.is-active {
  background: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.35);
}

.mobile-more-tile__icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 215, 0, 0.12);
  color: #ffd700;
  font-size: 1.2rem;
}

.mobile-more-tile--discord .mobile-more-tile__icon {
  background: rgba(88, 101, 242, 0.18);
  color: #8b95f7;
}

.mobile-more-tile__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.2;
}

@media (max-width: 360px) {
  .mobile-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}



@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;
  }
}

