/* ---------------------------------------------------------------------------
   style.css — Thème & Design System ONDE pour MyLector PWA Native
   --------------------------------------------------------------------------- */

:root {
  --ink: #08090F;
  --ink2: #0C0E17;
  --panel: #12141F;
  --panel2: #181B29;
  --panel3: #1F2334;
  --line: rgba(255, 255, 255, 0.075);
  --line2: rgba(255, 255, 255, 0.13);
  --text: #ECEEF5;
  --muted: #8A90A6;
  --faint: #5A6076;

  --signal: #F6A625;            /* Ambre - Accent principal */
  --signal-soft: rgba(246, 166, 37, 0.14);
  --live: #37D9A0;              /* Vert Émeraude - Live / Dispo offline */
  --live-soft: rgba(55, 217, 160, 0.13);
  --warn: #F2645A;              /* Rouge Corail - Erreur / Indisponible */
  --warn-soft: rgba(242, 100, 90, 0.13);

  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --header-height: 60px;
  --sidebar-width: 380px;
  --sh: 0 24px 70px -18px rgba(0, 0, 0, 0.75);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(1100px 700px at 78% -6%, rgba(246, 166, 37, 0.09), transparent 60%),
    radial-gradient(900px 600px at 8% 108%, rgba(55, 217, 160, 0.06), transparent 55%),
    var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  user-select: none;
}

::selection {
  background: var(--signal);
  color: #1a1200;
}

/* App Shell Layout */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

/* Topbar Header */
.ml-header {
  height: var(--header-height);
  background: rgba(12, 14, 23, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
  flex-shrink: 0;
  gap: 12px;
}

.ml-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ml-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--signal), #c77f10);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px -6px rgba(246, 166, 37, 0.6);
  color: #140c00;
  font-weight: 800;
  flex-shrink: 0;
}

.ml-logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.12em;
}

.ml-logo-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--faint);
  letter-spacing: 0.02em;
}

.ml-header-center {
  flex: 1;
  max-width: 300px;
  margin: 0 12px;
}

.ml-playlist-select {
  width: 100%;
}

.ml-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Burger Button */
.ml-burger-btn {
  background: var(--panel2);
  border: 1px solid var(--line2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.ml-burger-btn:hover {
  background: var(--panel3);
  border-color: var(--signal);
  color: var(--signal);
}

/* Backdrops pour les tiroirs Burger & Sidebar */
.ml-burger-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 15, 0.7);
  backdrop-filter: blur(8px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ml-burger-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer Droite (Burger Menu) */
.ml-burger-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: linear-gradient(180deg, var(--panel), var(--ink2));
  border-left: 1px solid var(--line2);
  z-index: 999;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
  padding: 20px;
}

.ml-burger-drawer.open {
  transform: translateX(0);
}

.ml-burger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.ml-burger-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}

.ml-burger-close-btn {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.ml-burger-close-btn:hover {
  color: #fff;
}

.ml-burger-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  overflow-y: auto;
}

.ml-burger-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.ml-burger-item:hover {
  border-color: var(--signal);
  background: var(--panel3);
  color: var(--signal);
  transform: translateX(-2px);
}

.ml-b-icon {
  font-size: 16px;
}

/* Drawer Gauche (Sidebar Chaînes - Rétracté par défaut, comportement identique au menu Burger) */
.ml-sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 380px;
  max-width: 88vw;
  background: linear-gradient(180deg, var(--panel), var(--ink2));
  border-right: 1px solid var(--line2);
  z-index: 999;
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
  padding: 20px 0 0;
}

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

.ml-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 14px;
  border-bottom: 1px solid var(--line);
}

.ml-sidebar-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.ml-sidebar-toolbar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Main Workspace Split (Full Player Stage) */
.ml-main {
  flex: 1;
  display: flex;
  height: calc(100vh - var(--header-height) - 56px);
  height: calc(100dvh - var(--header-height) - 56px);
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* Search Bar & Category Chips */
.ml-search-box {
  position: relative;
  width: 100%;
}

.ml-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ml-search-input:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft);
}

.ml-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.ml-categories-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.ml-categories-scroll::-webkit-scrollbar {
  display: none;
}

.ml-chip {
  padding: 5px 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.ml-chip:hover {
  border-color: var(--line2);
  color: var(--text);
}

.ml-chip.active {
  background: var(--signal-soft);
  border-color: rgba(246, 166, 37, 0.4);
  color: var(--signal);
  font-weight: 600;
}

/* Channel Virtual List Container */
.ml-channel-list-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#pg-channel-list {
  height: 100%;
  width: 100%;
}

/* Virtual List Item Row */
.ml-channel-item {
  height: 64px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
}

.ml-channel-item:hover {
  background: var(--panel2);
}

.ml-channel-item.active {
  background: var(--signal-soft);
  border-left: 3px solid var(--signal);
}

.ml-channel-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--panel3);
  object-fit: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.ml-channel-info {
  flex: 1;
  min-width: 0;
}

.ml-channel-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-channel-group {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.ml-fav-btn {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s, transform 0.2s;
}

.ml-fav-btn:hover {
  color: var(--signal);
  transform: scale(1.2);
}

.ml-fav-btn.is-fav {
  color: var(--signal);
}

/* Player Stage (Full Main Column) */
.ml-player-stage {
  flex: 1;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.ml-video-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  width: 100%;
  height: 100%;
}

video#ml-video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  outline: none;
  background: #000;
  object-fit: contain;
}

/* Gesture Zones Overlay */
.gzones {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
  z-index: 4;
}

.gzone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  gap: 6px;
}

.gzone:hover {
  opacity: 1;
}

.gzone.mid {
  border-left: 1px dashed rgba(255, 255, 255, 0.18);
  border-right: 1px dashed rgba(255, 255, 255, 0.18);
}

/* Empty State / Upload Card */
.ml-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  background: rgba(8, 9, 15, 0.95);
  backdrop-filter: blur(12px);
  z-index: 5;
}

.ml-empty-card {
  background: linear-gradient(180deg, var(--panel), var(--ink2));
  border: 1px solid var(--line2);
  border-radius: 20px;
  padding: 30px 20px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--sh);
}

.ml-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ml-btn-primary {
  background: linear-gradient(150deg, var(--signal), #c77f10);
  color: #140c00;
  box-shadow: 0 6px 20px -6px rgba(246, 166, 37, 0.6);
}

.ml-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.ml-btn-secondary {
  background: var(--panel2);
  border-color: var(--line);
  color: var(--text);
}

.ml-btn-secondary:hover {
  border-color: var(--line2);
  background: var(--panel3);
}

/* Mini Player Persistant (PiP Bottom Dock) */
.mini {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 70px;
  z-index: 25;
  background: rgba(20, 22, 33, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8);
  transform: translateY(140%);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.mini.show {
  transform: translateY(0);
}

.mini .mth {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--panel3);
  flex: none;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.mini .mm {
  flex: 1;
  min-width: 0;
}

.mini .mt {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini .ms {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--faint);
  margin-top: 1px;
}

.mini .mbtn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  cursor: pointer;
}

.mini .mbtn.play {
  background: var(--signal);
  color: #140c00;
}

.mini .mline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--signal);
  width: 35%;
  border-radius: 2px;
}

/* Bottom Tab Navigation Bar (Mobile Reachability) */
.tabs {
  height: 56px;
  display: flex;
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
  background: rgba(8, 9, 15, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 26;
  flex-shrink: 0;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 0;
  color: var(--faint);
  transition: color 0.18s;
  position: relative;
  cursor: pointer;
}

.tab.on {
  color: var(--signal);
}

.tab svg {
  width: 20px;
  height: 20px;
}

.tab span {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Progress Overlay for M3U Parsing & Modals */
.ml-progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 15, 0.92);
  backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  padding: 16px;
}

.ml-progress-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.ml-progress-bar-container {
  width: 300px;
  max-width: 90vw;
  height: 8px;
  background: var(--panel3);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid var(--line);
}

.ml-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--signal), var(--live));
  transition: width 0.2s ease;
}

/* Responsive Breakpoints & Mobile Adaptability */
@media (max-width: 768px) {
  .ml-header {
    height: var(--header-height);
    padding: 0 12px;
  }

  .ml-logo-tag {
    display: none;
  }

  .ml-burger-label {
    display: none;
  }

  .ml-main {
    height: calc(100dvh - var(--header-height) - 56px);
  }
}
