/* =========================================================
   STREAMHUB IPTV
   Modern Dark IPTV UI
========================================================= */

:root {
  --bg: #09090b;
  --bg-soft: #101014;
  --card: #151519;
  --card-hover: #1b1b21;

  --border: rgba(255, 255, 255, 0.08);

  --text: #ffffff;
  --text-soft: #a1a1aa;
  --text-muted: #71717a;

  --accent: #ef4444;
  --accent-dark: #dc2626;

  --success: #22c55e;

  --sidebar-width: 250px;
  --header-height: 72px;

  --radius: 16px;

  font-family: "Inter", sans-serif;
}


/* =========================================================
   RESET
========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
}

button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

img {
  display: block;
  max-width: 100%;
}


/* =========================================================
   HEADER
========================================================= */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: var(--header-height);

  display: flex;
  align-items: center;

  padding: 0 24px;

  background: rgba(9, 9, 11, 0.92);

  backdrop-filter: blur(18px);

  border-bottom: 1px solid var(--border);

  z-index: 1000;
}


.header-left {
  display: flex;
  align-items: center;
  gap: 14px;

  width: var(--sidebar-width);
}


.logo {
  display: flex;
  align-items: center;
  gap: 9px;

  color: white;
  text-decoration: none;

  font-size: 20px;
  font-weight: 800;
}

.logo > span:last-child > span {
  color: var(--accent);
}


.logo-icon {
  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  background: var(--accent);

  font-size: 13px;

  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.3);
}


.menu-btn {
  display: none;

  width: 40px;
  height: 40px;

  border-radius: 10px;

  color: white;
  background: var(--card);

  font-size: 20px;
}


.header-search {
  position: relative;

  width: min(500px, 100%);

  margin: auto;
}


.header-search input {
  width: 100%;
  height: 42px;

  padding: 0 42px;

  outline: none;

  color: white;

  background: #151519;

  border: 1px solid var(--border);
  border-radius: 12px;

  transition: 0.2s;
}


.header-search input:focus {
  border-color: rgba(239, 68, 68, 0.5);
}


.search-icon {
  position: absolute;

  left: 15px;
  top: 50%;

  transform: translateY(-50%);

  color: var(--text-muted);

  font-size: 22px;
}


.clear-search {
  position: absolute;

  right: 12px;
  top: 50%;

  transform: translateY(-50%);

  width: 25px;
  height: 25px;

  border-radius: 50%;

  color: #aaa;
  background: #27272a;
}


.header-right {
  width: var(--sidebar-width);

  display: flex;
  justify-content: flex-end;
  gap: 8px;
}


.header-icon {
  width: 40px;
  height: 40px;

  border-radius: 10px;

  color: #aaa;

  background: transparent;

  font-size: 20px;

  transition: 0.2s;
}


.header-icon:hover {
  color: white;
  background: var(--card);
}


/* =========================================================
   LAYOUT
========================================================= */

.app-layout {
  display: flex;
  padding-top: var(--header-height);
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
  position: fixed;

  top: var(--header-height);
  bottom: 0;
  left: 0;

  width: var(--sidebar-width);

  background: #0d0d10;

  border-right: 1px solid var(--border);

  z-index: 900;
}


.sidebar-inner {
  height: 100%;

  display: flex;
  flex-direction: column;

  padding: 25px 15px;
}


.sidebar-title {
  padding: 0 12px;
  margin-bottom: 10px;

  color: var(--text-muted);

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 1.5px;
}


.category-heading {
  margin-top: 30px;
}


.nav-item {
  width: 100%;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 11px 12px;

  margin-bottom: 4px;

  color: var(--text-soft);

  background: transparent;

  border-radius: 10px;

  text-align: left;

  font-size: 13px;
  font-weight: 600;

  transition: 0.2s;
}


.nav-item:hover {
  color: white;
  background: var(--card);
}


.nav-item.active {
  color: white;
  background: rgba(239, 68, 68, 0.13);
}


.nav-item.active > span:first-child {
  color: var(--accent);
}


.nav-count {
  margin-left: auto;

  min-width: 22px;
  height: 20px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0 6px;

  border-radius: 6px;

  color: var(--text-muted);

  background: rgba(255, 255, 255, 0.05);

  font-size: 10px;
}


#categoryList {
  overflow-y: auto;
}


.sidebar-footer {
  margin-top: auto;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 14px;

  border: 1px solid var(--border);
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.02);
}


.sidebar-footer strong {
  display: block;

  font-size: 11px;
}


.sidebar-footer small {
  display: block;

  margin-top: 3px;

  color: var(--text-muted);

  font-size: 9px;
}


.status-dot {
  width: 8px;
  height: 8px;

  border-radius: 50%;

  background: var(--success);

  box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
}


/* =========================================================
   MAIN
========================================================= */

.main-content {
  width: calc(100% - var(--sidebar-width));

  margin-left: var(--sidebar-width);

  padding: 30px;
}


/* =========================================================
   HERO
========================================================= */

.hero {
  position: relative;

  min-height: 330px;

  display: flex;
  align-items: center;

  overflow: hidden;

  padding: 55px;

  border: 1px solid var(--border);
  border-radius: 24px;

  background:
    radial-gradient(
      circle at 85% 50%,
      rgba(239, 68, 68, 0.16),
      transparent 35%
    ),
    linear-gradient(
      135deg,
      #151519,
      #0e0e11
    );
}


.hero-content {
  position: relative;

  max-width: 650px;

  z-index: 2;
}


.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 7px 11px;

  margin-bottom: 18px;

  color: #fca5a5;

  background: rgba(239, 68, 68, 0.1);

  border: 1px solid rgba(239, 68, 68, 0.2);

  border-radius: 100px;

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 1px;
}


.live-badge span {
  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: var(--accent);

  box-shadow: 0 0 12px var(--accent);
}


.hero h1 {
  font-size: clamp(34px, 4vw, 55px);

  line-height: 1.05;

  letter-spacing: -2px;
}


.hero h1 span {
  color: var(--accent);
}


.hero p {
  max-width: 560px;

  margin-top: 18px;

  color: var(--text-soft);

  font-size: 14px;

  line-height: 1.7;
}


.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  margin-top: 25px;

  padding: 13px 18px;

  color: white;

  background: var(--accent);

  border-radius: 10px;

  font-size: 12px;
  font-weight: 700;

  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.22);

  transition: 0.2s;
}


.primary-btn:hover {
  background: var(--accent-dark);

  transform: translateY(-2px);
}


.hero-decoration {
  position: absolute;

  right: 70px;
  top: 50%;

  transform: translateY(-50%);
}


.screen-decoration {
  position: relative;

  width: 280px;
  height: 180px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 7px solid #27272a;

  border-radius: 15px;

  background:
    linear-gradient(
      135deg,
      #111,
      #1d1d22
    );

  transform: perspective(500px) rotateY(-12deg);

  box-shadow:
    0 40px 80px rgba(0,0,0,.5),
    0 0 80px rgba(239,68,68,.12);
}


.screen-decoration::after {
  content: "";

  position: absolute;

  bottom: -27px;

  left: 50%;

  width: 90px;
  height: 20px;

  transform: translateX(-50%);

  border-radius: 0 0 10px 10px;

  background: #27272a;
}


.screen-glow {
  position: absolute;

  inset: 0;

  background:
    radial-gradient(
      circle,
      rgba(239,68,68,.2),
      transparent 60%
    );
}


.screen-play {
  position: relative;

  width: 55px;
  height: 55px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding-left: 3px;

  border-radius: 50%;

  color: white;

  background: var(--accent);

  box-shadow: 0 0 40px rgba(239,68,68,.4);
}


/* =========================================================
   SECTIONS
========================================================= */

.player-section,
.channels-section {
  margin-top: 45px;
}


.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  margin-bottom: 18px;
}


.section-label {
  display: block;

  margin-bottom: 5px;

  color: var(--accent);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 1.5px;
}


.section-header h2 {
  font-size: 22px;

  letter-spacing: -0.5px;
}


.channel-tools {
  color: var(--text-muted);

  font-size: 11px;
}


/* =========================================================
   VIDEO PLAYER
========================================================= */

.player-wrapper {
  overflow: hidden;

  background: #000;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  box-shadow: 0 25px 70px rgba(0,0,0,.25);
}


.video-container {
  position: relative;

  width: 100%;

  aspect-ratio: 16 / 9;

  background: #030303;
}


.video-container video {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: contain;

  background: #000;
}


.video-placeholder {
  position: absolute;

  inset: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;
}


.placeholder-icon {
  width: 60px;
  height: 60px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 15px;

  border-radius: 50%;

  color: white;

  background: #18181b;

  font-size: 18px;
}


.video-placeholder h3 {
  font-size: 14px;
}


.video-placeholder p {
  margin-top: 7px;

  color: var(--text-muted);

  font-size: 11px;
}


.video-loader,
.video-error {
  position: absolute;

  inset: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,.75);

  z-index: 5;
}


.video-loader span {
  margin-top: 15px;

  color: #ccc;

  font-size: 11px;
}


.spinner {
  width: 35px;
  height: 35px;

  border: 3px solid rgba(255,255,255,.15);

  border-top-color: var(--accent);

  border-radius: 50%;

  animation: spin .8s linear infinite;
}


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


.video-error {
  color: #fca5a5;

  text-align: center;
}


.video-error > div {
  margin-bottom: 12px;

  font-size: 28px;
}


.video-error strong {
  display: block;

  color: white;

  font-size: 13px;
}


.video-error small {
  margin-top: 6px;

  color: var(--text-muted);

  font-size: 10px;
}


/* =========================================================
   PLAYER INFO
========================================================= */

.player-info {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-top: 12px;

  padding: 14px 16px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: var(--card);
}


.current-channel {
  display: flex;
  align-items: center;
  gap: 13px;
}


.current-channel img {
  width: 52px;
  height: 52px;

  padding: 5px;

  object-fit: contain;

  border-radius: 10px;

  background: #0c0c0e;

  border: 1px solid var(--border);
}


.current-live {
  display: flex;
  align-items: center;
  gap: 5px;

  margin-bottom: 3px;

  color: var(--accent);

  font-size: 8px;
  font-weight: 800;
}


.current-live span {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: var(--accent);
}


.current-channel h3 {
  font-size: 14px;
}


.current-channel p {
  margin-top: 3px;

  color: var(--text-muted);

  font-size: 10px;
}


.favorite-large {
  width: 40px;
  height: 40px;

  border-radius: 10px;

  color: #aaa;

  background: #1c1c20;

  font-size: 20px;
}


.favorite-large.active {
  color: #ef4444;
}


/* =========================================================
   CHANNEL GRID
========================================================= */

.channels-grid {
  display: grid;

  grid-template-columns:
    repeat(auto-fill, minmax(190px, 1fr));

  gap: 14px;
}


.channel-card {
  position: relative;

  overflow: hidden;

  padding: 15px;

  border: 1px solid var(--border);
  border-radius: 15px;

  background: var(--card);

  transition: 0.2s;

  cursor: pointer;
}


.channel-card:hover {
  transform: translateY(-3px);

  border-color: rgba(239,68,68,.3);

  background: var(--card-hover);

  box-shadow: 0 15px 35px rgba(0,0,0,.2);
}


.channel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}


.channel-logo {
  width: 60px;
  height: 60px;

  padding: 8px;

  object-fit: contain;

  border-radius: 12px;

  background: #0c0c0f;

  border: 1px solid var(--border);
}


.card-favorite {
  width: 32px;
  height: 32px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 8px;

  color: #666;

  background: rgba(255,255,255,.04);

  font-size: 17px;
}


.card-favorite.active {
  color: var(--accent);
}


.channel-card h3 {
  margin-top: 15px;

  overflow: hidden;

  white-space: nowrap;
  text-overflow: ellipsis;

  font-size: 13px;
}


.channel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-top: 8px;
}


.channel-category {
  color: var(--text-muted);

  font-size: 9px;
}


.live-status {
  display: flex;
  align-items: center;
  gap: 5px;

  color: #86efac;

  font-size: 8px;
  font-weight: 800;
}


.live-status span {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: var(--success);
}


/* =========================================================
   EMPTY
========================================================= */

.empty-state {
  padding: 70px 20px;

  text-align: center;

  border: 1px dashed var(--border);
  border-radius: 15px;
}


.empty-icon {
  margin-bottom: 12px;

  color: var(--text-muted);

  font-size: 35px;
}


.empty-state h3 {
  font-size: 15px;
}


.empty-state p {
  margin-top: 6px;

  color: var(--text-muted);

  font-size: 11px;
}


.empty-state button {
  margin-top: 18px;

  padding: 9px 14px;

  color: white;

  background: #27272a;

  border-radius: 8px;

  font-size: 11px;
}


/* =========================================================
   TOAST
========================================================= */

.toast {
  position: fixed;

  right: 25px;
  bottom: 25px;

  display: flex;
  align-items: center;
  gap: 9px;

  padding: 12px 16px;

  color: white;

  background: #18181b;

  border: 1px solid var(--border);

  border-radius: 10px;

  box-shadow: 0 15px 40px rgba(0,0,0,.35);

  font-size: 11px;

  transform: translateY(100px);

  opacity: 0;

  pointer-events: none;

  transition: .3s;

  z-index: 2000;
}


.toast.show {
  transform: translateY(0);

  opacity: 1;
}


#toastIcon {
  color: var(--success);

  font-weight: 800;
}


/* =========================================================
   UTILITIES
========================================================= */

.hidden {
  display: none !important;
}


.sidebar-overlay {
  display: none;
}


/* =========================================================
   LIGHT THEME
========================================================= */

body.light-theme {
  --bg: #f5f5f7;
  --bg-soft: #ffffff;

  --card: #ffffff;
  --card-hover: #fafafa;

  --text: #111113;
  --text-soft: #52525b;
  --text-muted: #71717a;

  --border: rgba(0,0,0,.09);
}


body.light-theme .header,
body.light-theme .sidebar {
  background: rgba(255,255,255,.92);
}


body.light-theme .header-search input {
  color: #111;
  background: #f4f4f5;
}


body.light-theme .hero {
  background:
    radial-gradient(
      circle at 85% 50%,
      rgba(239,68,68,.12),
      transparent 35%
    ),
    #fff;
}


body.light-theme .logo,
body.light-theme .header-icon,
body.light-theme .menu-btn {
  color: #111;
}


body.light-theme .video-placeholder,
body.light-theme .video-error {
  background: #030303;
  color: white;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1000px) {

  :root {
    --sidebar-width: 220px;
  }

  .hero {
    padding: 40px;
  }

  .hero-decoration {
    right: 30px;
    opacity: .5;
  }

  .channels-grid {
    grid-template-columns:
      repeat(auto-fill, minmax(170px, 1fr));
  }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

  :root {
    --header-height: 64px;
  }


  .header {
    padding: 0 14px;
  }


  .header-left {
    width: auto;
  }


  .menu-btn {
    display: flex;

    align-items: center;
    justify-content: center;
  }


  .logo {
    font-size: 17px;
  }


  .logo-icon {
    width: 30px;
    height: 30px;
  }


  .header-search {
    margin-left: 12px;
  }


  .header-search input {
    height: 38px;

    padding-left: 37px;
  }


  .header-right {
    display: none;
  }


  .sidebar {
    width: 270px;

    transform: translateX(-100%);

    transition: .25s;
  }


  .sidebar.open {
    transform: translateX(0);
  }


  .sidebar-overlay {
    position: fixed;

    inset: 0;

    background: rgba(0,0,0,.6);

    backdrop-filter: blur(3px);

    z-index: 850;
  }


  .sidebar-overlay.show {
    display: block;
  }


  .main-content {
    width: 100%;

    margin-left: 0;

    padding: 18px 14px;
  }


  .hero {
    min-height: 340px;

    padding: 30px 24px;

    border-radius: 18px;
  }


  .hero h1 {
    font-size: 38px;
  }


  .hero-decoration {
    right: -50px;
    bottom: 15px;
    top: auto;

    transform: scale(.75);
  }


  .hero p {
    max-width: 100%;

    font-size: 12px;
  }


  .player-section,
  .channels-section {
    margin-top: 32px;
  }


  .section-header h2 {
    font-size: 18px;
  }


  .channels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 10px;
  }


  .channel-card {
    padding: 11px;
  }


  .channel-logo {
    width: 50px;
    height: 50px;
  }


  .channel-card h3 {
    font-size: 12px;
  }


  .player-info {
    padding: 11px;
  }

}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 450px) {

  .header-search {
    width: 100%;
  }


  .header-search input {
    font-size: 11px;
  }


  .hero {
    min-height: 360px;
  }


  .hero h1 {
    font-size: 32px;

    letter-spacing: -1.5px;
  }


  .hero-decoration {
    right: -70px;

    opacity: .35;
  }


  .channels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }


  .current-channel img {
    width: 45px;
    height: 45px;
  }


  .current-channel h3 {
    font-size: 12px;
  }


  .favorite-large {
    width: 36px;
    height: 36px;
  }

}
