/* Pirinti — theme: dark UI, green (#16a34a) accents */
:root {
  --bg: #0b0f0d;
  --bg-2: #121815;
  --card: #161e1a;
  --accent: #16a34a;
  --accent-soft: rgba(22, 163, 74, 0.18);
  --text: #e7efe9;
  --text-dim: #9db3a6;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Open Sans", system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(11, 15, 13, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--accent-soft);
}
header .logo h1 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
header .logo a { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
header .logo img { width: 28px; height: 28px; border-radius: 6px; }
.logo-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
}

nav { display: flex; gap: 14px; flex-wrap: wrap; }
nav a { color: var(--text-dim); font-size: 14px; font-weight: 600; }
nav a:hover, nav a.active { color: var(--accent); text-decoration: none; }

/* ---------- Search ---------- */
#search-container { flex: 1; max-width: 420px; }
#search-input-container {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  padding: 6px 14px;
}
#search-input-container i { color: var(--text-dim); }
#searchInput {
  flex: 1; border: none; outline: none;
  background: transparent; color: var(--text); font-size: 14px;
}

/* ---------- Layout ---------- */
main { padding: 14px 16px; max-width: 1700px; margin: 0 auto; }
.spacer { height: 6px; }
hr { border: none; border-top: 1px solid var(--accent-soft); margin: 18px 0; }

/* ---------- Grid & cards ---------- */
#videoGrid, #searchResults {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.videoItem {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex; flex-direction: column;
}
.videoItem:hover { transform: translateY(-3px); border-color: var(--accent); }
.videoItem h3 { font-size: 15px; margin: 10px 12px 4px; display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.videoItem p { font-size: 12.5px; color: var(--text-dim); margin: 0 12px 12px; line-height: 1.45; text-align: center; }
.videoItem p.truncate {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  max-height: 54px; /* ~3 lignes */
  transition: max-height 0.25s ease, -webkit-line-clamp 0.25s ease;
}
/* Survol de LA ZONE DESCRIPTION : la description complete apparait */
.videoItem { position: relative; z-index: 1; }
.videoItem p.truncate:hover {
  display: block; -webkit-line-clamp: unset; max-height: 600px; overflow: visible;
  cursor: default;
}
/* Clic en haut de la carte : agrandissement dynamique (sans deplier la description) */
.videoItem.pinned { transform: translateY(-3px) scale(1.04); border-color: var(--accent); z-index: 20; box-shadow: 0 12px 30px rgba(0,0,0,0.55); }

.thumbnail { position: relative; display: block; cursor: pointer; aspect-ratio: 3/4; background: var(--bg-2); }
.thumbnail.landscape { aspect-ratio: 16/9; }
.thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }

.playIcon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: #fff;
  background: rgba(0,0,0,0.35);
  opacity: 0; transition: opacity 0.15s ease;
}
.thumbnail:hover .playIcon { opacity: 1; }

.dateOverlay, .ratingOverlay, .timeOverlay, .networks, .cam {
  position: absolute;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.72); color: #fff;
}
.dateOverlay { top: 8px; left: 8px; }
.ratingOverlay { top: 8px; right: 8px; }
.timeOverlay { bottom: 8px; left: 8px; }
.networks { bottom: 8px; right: 8px; }
.networks a { color: var(--accent); }
.cam { bottom: 8px; left: 8px; background: rgba(163, 88, 22, 0.9); }
.trailerOverlay {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  background: rgba(22, 163, 74, 0.9);
  opacity: 0; transition: opacity 0.15s ease;
}
.thumbnail:hover .trailerOverlay { opacity: 1; }
.trailerOverlay a { color: #fff; }

/* ---------- Modal / player ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  display: flex; flex-direction: column;
  padding: 14px;
  gap: 10px;
}
.horizontal-modal { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.horizontal-modal p { margin: 0; font-weight: 700; flex: 1; }
.vertical-modal { display: flex; flex-direction: column; gap: 10px; }
.modal select, .modal button {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.modal button:hover { background: var(--accent); color: #fff; }
.player-frame { flex: 1; width: 100%; border: none; border-radius: var(--radius); background: #000; }

/* ---------- Forms (settings / live) ---------- */
select, input[type="text"], input[type="password"] {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--accent-soft); border-radius: 8px;
  padding: 8px 12px; font-size: 14px;
}
select:focus, input:focus { outline: none; border-color: var(--accent); }
button.primary {
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
button.primary:hover { filter: brightness(1.1); }
label { color: var(--text-dim); font-size: 14px; }

#seasonGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; margin-bottom: 22px; }
.seasonItem { cursor: pointer; }
.seasonItem h3 { margin: 8px 12px 4px; }
.seasonItem .numOverlay { position: absolute; top: 8px; left: 8px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: #fff; }
.seasonItem .epOverlay { position: absolute; bottom: 8px; right: 8px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,0.72); color: #fff; }
#season-back { margin-bottom: 16px; }
/* Page Saisons : 4 episodes par ligne (desktop), responsive ensuite
   #videoGrid.episodeGrid a priorite sur la regle globale #videoGrid */
#videoGrid.episodeGrid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { #videoGrid.episodeGrid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { #videoGrid.episodeGrid { grid-template-columns: repeat(2, 1fr); } }
video#video { width: 100%; max-height: 70vh; border-radius: var(--radius); background: #000; }

/* ---------- Footer ---------- */
footer { margin-top: 40px; color: var(--text-dim); }
footer h3 { font-weight: 400; }

/* ---------- Settings ---------- */
.settings-row { margin: 18px 0; display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.settings-row p { margin: 0; font-weight: 600; }
.settings-row input { max-width: 480px; }
.hint { font-size: 12.5px; color: var(--text-dim); }

/* ---------- IPTV (Xtream Codes) ---------- */
.iptv-notice {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 18px; font-size: 14px;
}
.iptv-notice a { color: var(--accent); font-weight: 700; }
.iptv-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.iptv-tab {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--accent-soft);
  border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.iptv-tab:hover { border-color: var(--accent); }
.iptv-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.iptv-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.cat-btn {
  background: transparent; color: var(--text-dim); border: 1px solid var(--accent-soft);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.cat-btn:hover { color: var(--text); border-color: var(--accent); }
.cat-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* Pagination IPTV */
.iptv-pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 22px 0 10px; }
.iptv-pager .iptv-tab:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-label { color: var(--text-dim); font-size: 14px; font-weight: 600; min-width: 64px; text-align: center; }

/* Barre de recherche IPTV */
.iptv-search { display: flex; align-items: center; gap: 10px; max-width: 480px; margin-bottom: 18px; background: var(--bg-2); border: 1px solid var(--accent-soft); border-radius: 999px; padding: 4px 16px; }
.iptv-search i { color: var(--text-dim); }
.iptv-search input { flex: 1; background: transparent; border: none; color: var(--text); padding: 9px 0; font-size: 14px; }
.iptv-search input:focus { outline: none; }

@media (max-width: 640px) {
  #videoGrid, #searchResults { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  header { flex-wrap: wrap; }
}
