:root {
  --bg: #121212;
  --panel: #1e1e1e;
  --panel-2: #2a2a2a;
  --text: #e0e0e0;
  --accent: #38bdf8;
  --border: rgba(255, 255, 255, 0.08);
  --speed: 0.2s;
  --sidebar-w: 280px;
  --topbar-h: 60px;
}

html { scroll-behavior: smooth; }

body.day {
  --bg: #ffffff;
  --panel: #fcfcfc;
  --panel-2: #f3f3f3;
  --text: #000000;
  --accent: #0284c7;
  --border: #eeeeee;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background var(--speed), color var(--speed);
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--panel);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* LOGO */
.logo {
  width: var(--sidebar-w);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px 0 45px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, opacity 0.2s ease;
  flex-shrink: 0;
}
.logo:active { transform: scale(0.96); opacity: 0.8; }

/* Orta boşluk */
.topbar-spacer { flex: 1; }

/* TOGGLE */
.fancy-toggle {
  width: 56px;
  height: 26px;
  border-radius: 13px;
  background: var(--panel-2);
  position: relative;
  cursor: pointer;
  transition: background 0.5s;
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-right: 1.5rem;
}
.fancy-toggle.day { background: var(--panel-2); border-color: var(--border); }

.f-star { position: absolute; background: white; border-radius: 50%; transition: opacity 0.4s; }
.fancy-toggle.day .f-star { opacity: 0; }

.f-cloud { position: absolute; opacity: 0; transition: opacity 0.4s; }
.fancy-toggle.day .f-cloud { opacity: 1; }

.fancy-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  transition: transform 0.45s cubic-bezier(.4,0,.2,1);
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
.fancy-toggle.day .fancy-knob { transform: translateX(30px); }

.sun-shape, .moon-shape {
  position: absolute;
  width: 18px; height: 18px;
  transition: opacity 0.3s;
  display: flex; align-items: center; justify-content: center;
}
.fancy-toggle.day .moon-shape { opacity: 0; }
.fancy-toggle:not(.day) .sun-shape { opacity: 0; }

/* Logo dikey ayraç */
.logo-divider { stroke: rgba(255,255,255,0.5); }
body.day .logo-divider { stroke: rgba(0,0,0,0.4); }

/* ANA YERLEŞİM */
.layout {
  display: flex;
  flex: 1;
  padding: 15px;
  gap: 15px;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 12px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  opacity: 0.6;
}

.channel-list {
  overflow-y: auto;
  flex: 1;
  padding: 0 10px 10px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.channel-list::-webkit-scrollbar { width: 6px; }
.channel-list::-webkit-scrollbar-track { background: transparent; }
.channel-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.channel-list::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.group-header {
  padding: 12px 5px 5px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--panel-2);
  margin-top: 5px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.channel-item:active { transform: scale(0.98); }
.channel-item:hover { background: var(--accent); color: #fff; }

.channel-item img {
  width: 32px; height: 32px;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
  padding: 3px;
  mix-blend-mode: screen;
  filter: contrast(1.1) brightness(1.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
body.day .channel-item img {
  background: #eee;
  mix-blend-mode: multiply;
  filter: none;
}

/* PLAYER */
.player-area { flex: 1; display: flex; min-width: 0; }
.player-card {
  width: 100%; height: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
video { width: 100%; height: 100%; display: block; }

/* MOBİL */
@media (max-width: 768px) {

  /* Topbar: logo tam ortada, toggle sağ kenarda */
  .topbar {
    position: relative;
    justify-content: center;
    padding: 0 1rem;
  }

  /* Spacer gizle */
  .topbar-spacer { display: none; }

  /* Logo tam ortada */
  .logo {
    width: auto;
    padding: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Toggle sağ kenara sabit */
  .fancy-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 0;
    /* boyut aynı kalsın */
    width: 56px;
    height: 26px;
    border-radius: 13px;
  }

  /* Layout */
  .layout {
    flex-direction: column;
    padding: 10px;
    overflow-y: hidden;
  }

  .sidebar {
    width: 100%;
    height: 50vh;
    order: 2;
    flex-shrink: 0;
  }

  .player-area {
    height: 35vh;
    flex: none;
    order: 1;
  }
}


/* M3U EKLE BÖLÜMÜ */
.m3u-section {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.m3u-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.6;
  transition: opacity 0.2s;
  user-select: none;
}
.m3u-header:hover { opacity: 1; }
.m3u-header #m3uArrow { position: absolute; right: 14px; }
#m3uArrow { transition: transform 0.2s; }
.m3u-body {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 12px;
}
.m3u-label {
  font-size: 0.68rem;
  opacity: 0.5;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.m3u-row { display: flex; gap: 6px; }
.m3u-input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.72rem;
  color: var(--text);
  outline: none;
  min-width: 0;
  font-family: inherit;
}
.m3u-input:focus { border-color: var(--accent); }
.m3u-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s;
  font-family: inherit;
}
.m3u-btn:hover { opacity: 0.85; }
.m3u-file-label {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.m3u-file-label:hover { border-color: var(--accent); color: var(--accent); }
.m3u-status {
  font-size: 0.7rem;
  min-height: 14px;
  color: var(--accent);
}
.m3u-status.error { color: #f87171; }
