/* ==========================================================================
   TabFlix Live TV & Live Sports Premium Design System
   Target Audience: India (Default) & Global
   Zero-Ad, Standalone Player with Anti-Redirection Protection
   ========================================================================== */

:root {
  --tf-bg-black: #09090b;
  --tf-card-bg: #121217;
  --tf-card-hover: #181820;
  --tf-border: rgba(255, 255, 255, 0.08);
  --tf-border-active: rgba(239, 68, 68, 0.5);
  --tf-red: #ef4444;
  --tf-red-glow: rgba(239, 68, 68, 0.35);
  --tf-blue: #38bdf8;
  --tf-green: #22c55e;
  --tf-text: #f4f4f5;
  --tf-muted: #a1a1aa;
}

.tabflix-live-page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  color: var(--tf-text);
  font-family: inherit;
  box-sizing: border-box;
}

/* Header & Controls */
.tabflix-live-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--tf-border);
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .tabflix-live-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.tabflix-live-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tabflix-live-badge-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.tabflix-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--tf-red);
  border-radius: 50%;
  animation: tf-pulse 1.5s infinite;
}

@keyframes tf-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.tabflix-live-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabflix-live-subtitle {
  font-size: 13px;
  color: var(--tf-muted);
  margin: 4px 0 0;
}

/* Country Switcher Button & Dropdown */
.tabflix-country-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 14px;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.tabflix-country-btn:hover {
  background: #27272a;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.tabflix-country-flag {
  font-size: 18px;
  line-height: 1;
}

/* Providers Switcher Tabs */
.tabflix-provider-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  margin-bottom: 20px;
  scrollbar-width: none;
}

.tabflix-provider-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: #18181b;
  color: var(--tf-muted);
  border: 1px solid var(--tf-border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tabflix-provider-tab:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.tabflix-provider-tab.active {
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

/* Category Filter Bar */
.tabflix-category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 24px;
  scrollbar-width: thin;
}

.tabflix-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: #141418;
  color: #d4d4d8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tabflix-category-pill:hover {
  background: #202028;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.tabflix-category-pill.active {
  background: var(--tf-red);
  color: #fff;
  border-color: var(--tf-red);
  box-shadow: 0 2px 10px var(--tf-red-glow);
}

.tabflix-category-count {
  font-size: 10px;
  font-family: monospace;
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 6px;
  border-radius: 9999px;
}

/* Channel & Match Search Bar */
.tabflix-search-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
}

.tabflix-search-input {
  width: 100%;
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 16px 10px 40px;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.tabflix-search-input:focus {
  border-color: var(--tf-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.tabflix-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #71717a;
  font-size: 14px;
  pointer-events: none;
}

/* Channels Grid */
.tabflix-channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .tabflix-channel-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .tabflix-channel-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (min-width: 1280px) {
  .tabflix-channel-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
  }
}

/* Channel Card */
.tabflix-channel-card {
  background: var(--tf-card-bg);
  border: 1px solid var(--tf-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  user-select: none;
  min-height: 140px;
}

.tabflix-channel-card:hover {
  background: var(--tf-card-hover);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}

.tabflix-channel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.tabflix-channel-logo-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #1c1c24;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.tabflix-channel-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.tabflix-channel-live-chip {
  font-size: 10px;
  font-weight: 800;
  font-family: monospace;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.tabflix-channel-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tabflix-channel-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--tf-muted);
}

.tabflix-channel-lang {
  background: #272730;
  color: #e4e4e7;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Sports Matches Grid */
.tabflix-sports-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .tabflix-sports-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (min-width: 1200px) {
  .tabflix-sports-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

.tabflix-match-card {
  background: var(--tf-card-bg);
  border: 1px solid var(--tf-border);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
}

.tabflix-match-card:hover {
  background: var(--tf-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.6);
}

.tabflix-match-banner {
  position: relative;
  width: 100%;
  height: 130px;
  overflow: hidden;
  background: #181820;
}

.tabflix-match-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  transition: transform 0.3s ease;
}

.tabflix-match-card:hover .tabflix-match-img {
  transform: scale(1.05);
  opacity: 0.85;
}

.tabflix-match-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(18, 18, 23, 0.95) 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
}

.tabflix-match-tournament {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
}

.tabflix-match-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.tabflix-match-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.35;
}

.tabflix-match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a24;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.tabflix-match-team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #f4f4f5;
}

.tabflix-match-vs {
  font-size: 11px;
  font-family: monospace;
  font-weight: 800;
  color: #71717a;
}

.tabflix-match-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tabflix-watch-btn {
  background: #fff;
  color: #000;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.tabflix-watch-btn:hover {
  background: #f4f4f5;
  transform: scale(1.03);
}

/* Modal Player (Direct HLS & Sandboxed Embed) */
.tabflix-player-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.tabflix-player-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.tabflix-player-box {
  background: #09090d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 100%;
  max-width: 1100px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
}

.tabflix-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #111116;
  border-bottom: 1px solid var(--tf-border);
}

.tabflix-player-channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tabflix-player-channel-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.tabflix-player-close-btn {
  background: #272730;
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s ease;
}

.tabflix-player-close-btn:hover {
  background: var(--tf-red);
}

.tabflix-player-screen-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.tabflix-native-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.tabflix-sandboxed-frame {
  width: 100%;
  height: 100%;
  border: none;
}

/* Mirror / Server Bar */
.tabflix-player-servers-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: #111116;
  border-top: 1px solid var(--tf-border);
  overflow-x: auto;
}

.tabflix-server-pill {
  background: #1c1c24;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e4e4e7;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tabflix-server-pill:hover {
  background: #272733;
  color: #fff;
}

.tabflix-server-pill.active {
  background: var(--tf-red);
  color: #fff;
  border-color: var(--tf-red);
  box-shadow: 0 0 10px var(--tf-red-glow);
}

/* Country Switcher Modal */
.tabflix-country-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tabflix-country-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.tabflix-country-modal-card {
  background: #121217;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
}

.tabflix-country-modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--tf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tabflix-country-list {
  overflow-y: auto;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 480px) {
  .tabflix-country-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tabflix-country-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #181820;
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-size: 13px;
  color: #e4e4e7;
  transition: all 0.15s ease;
}

.tabflix-country-item:hover {
  background: #242430;
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.tabflix-country-item.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--tf-red);
  color: #fff;
  font-weight: 700;
}

/* Unmute Audio Overlay */
.tabflix-unmute-overlay {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 15, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  animation: tf-unmute-pulse 2s infinite ease-in-out;
}

.tabflix-unmute-overlay:hover {
  background: var(--tf-red);
  border-color: var(--tf-red);
  transform: scale(1.05);
}

@keyframes tf-unmute-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   Mobile Responsive Enhancements (< 768px and < 480px)
   ========================================================================== */

@media (max-width: 768px) {
  .tabflix-live-page {
    padding: 16px 12px 90px;
  }

  .tabflix-live-header {
    gap: 12px;
    margin-bottom: 16px;
  }

  .tabflix-live-title {
    font-size: 22px;
  }

  .tabflix-channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .tabflix-sports-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tabflix-provider-nav,
  .tabflix-category-bar,
  .tabflix-player-servers-bar {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
}

@media (max-width: 480px) {
  .tabflix-live-page {
    padding: 12px 8px 100px;
  }

  .tabflix-live-title {
    font-size: 18px;
  }

  .tabflix-live-subtitle {
    font-size: 11px;
  }

  .tabflix-channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .tabflix-channel-card {
    padding: 10px 8px;
    min-height: 115px;
    border-radius: 12px;
  }

  .tabflix-channel-logo-wrap {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .tabflix-channel-name {
    font-size: 12px;
    line-height: 1.2;
    margin-bottom: 4px;
  }

  .tabflix-channel-live-chip {
    font-size: 8px;
    padding: 2px 5px;
  }

  .tabflix-match-card {
    border-radius: 14px;
  }

  .tabflix-match-banner {
    height: 115px;
  }

  .tabflix-match-body {
    padding: 12px;
  }

  .tabflix-match-title {
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.3;
  }

  .tabflix-match-teams {
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 10px;
  }

  .tabflix-match-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 10px;
  }

  .tabflix-watch-btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
  }

  .tabflix-player-servers-bar {
    padding: 8px 12px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .tabflix-server-pill {
    min-height: 36px;
    padding: 7px 13px;
    font-size: 11.5px;
  }

  .tabflix-player-modal {
    padding: 12px 10px !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
  }

  .tabflix-player-box {
    border-radius: 18px !important;
    max-height: 92vh;
    width: 100% !important;
    max-width: 100% !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.95) !important;
  }

  .tabflix-player-header {
    padding: 10px 14px;
  }

  .tabflix-player-channel-name {
    font-size: 13px;
    max-width: 65vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tabflix-player-close-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .tabflix-country-modal {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  .tabflix-country-modal-card {
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
  }

  .tabflix-country-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px;
  }
}

