:root {
  --bg: #0f1115;
  --card: #171923;
  --text: #e7e9ee;
  --muted: #9aa3b8;
  --accent: #3b6df6;
}

* { box-sizing: border-box; margin:0; padding:0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  line-height:1.5;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15,17,21,.7);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(180deg, #3b6df6, #274adf);
  display: grid; place-items: center;
  font-weight: 800; box-shadow: 0 8px 22px rgba(59,109,246,.35);
}
.brand-name { font-weight: 700; }

.nav {
  display:flex; gap:14px; align-items:center; flex-wrap:wrap;
}
.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
}
.nav a:hover {
  border-color: rgba(255,255,255,.08);
  background: var(--card);
}
.user-name { font-size:14px; color:var(--muted); }

/* ===== MAIN ===== */
.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}
h1 { font-size: 20px; margin: 0 0 12px; }

/* Search form */
.search-form {
  display:flex; gap:8px; align-items:center; margin-bottom:12px;
}
.search-form input {
  flex:1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: var(--card);
  color: var(--text);
  outline: none;
}
.search-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,109,246,.2);
}
.search-form button {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.search-form button:hover { background:#274adf; }

.status { margin:10px 2px; color: var(--muted); }

/* Autoplay switch */
label.switch {
  display:flex; align-items:center; gap:10px;
  font-size:13px; color: var(--muted);
  cursor:pointer; user-select:none;
}
label.switch input { display:none; }
label.switch .slider {
  width:40px; height:20px; border-radius:20px;
  background:rgba(255,255,255,0.2);
  position:relative; flex-shrink:0;
  transition:background 0.2s;
}
label.switch .slider::before {
  content:""; position:absolute; top:2px; left:2px;
  width:16px; height:16px; border-radius:50%;
  background:#fff; transition:transform 0.2s;
}
label.switch input:checked + .slider { background: var(--accent); }
label.switch input:checked + .slider::before { transform: translateX(20px); }

/* ===== PLAYER ===== */
.player {
  margin-top:18px;
  background: #000;
  border-radius:14px;
  overflow:hidden;
  padding:12px;
}
#yt { width:100%; height:420px; }
.btn-small {
  margin-top:10px;
  padding:10px 16px;
  border:none;
  border-radius:10px;
  background: var(--accent);
  color:#fff;
  cursor:pointer;
  font-weight:600;
}
.btn-small:hover { background:#274adf; }

/* ===== GRID RESULTS ===== */
.grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(220px,1fr));
  gap:12px;
  margin-top:16px;
}
.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .1s, border-color .2s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(59,109,246,.5);
}
.thumb { width:100%; aspect-ratio:16/9; object-fit:cover; display:block; }
.meta { padding:10px 12px; }
.ttl { font-size:14px; font-weight:600; margin-bottom:4px; }
.ch { font-size:12px; color: var(--muted); }

/* ===== FLOATING BUTTON ===== */
.btn-fab {
  position:fixed;
  bottom:60px; right:20px;
  width:56px; height:56px;
  border-radius:50%;
  background: var(--accent);
  color:#fff; border:none;
  font-size:28px; 
  cursor:pointer;
  display:flex;
  justify-content:center;
  align-items:center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index:100;
}
.btn-fab:hover { background:#274adf; }

/* ===== MODALS ===== */
.panel {
  position:fixed; inset:0;
  background:rgba(0,0,0,0.7);
  display:none; justify-content:center; align-items:center;
  z-index:1000;
}
.panel-content {
  background: var(--card);
  padding:20px;
  border-radius:12px;
  min-width:300px; max-width:400px;
  color: var(--text);
}
.panel-content h2 { margin-bottom:15px; font-size:18px; }
.panel-content input, .panel-content select {
  width:100%; padding:10px;
  margin-bottom:15px;
  border:1px solid rgba(255,255,255,.1);
  border-radius:8px;
  background: #0f1115;
  color: var(--text);
}
.panel-actions { display:flex; justify-content:flex-end; gap:10px; }
.panel-actions button {
  padding:10px 16px; border:none; border-radius:8px;
  font-weight:600; cursor:pointer;
}
.panel-actions button:first-child {
  background: var(--accent); color:#fff;
}
.panel-actions button:first-child:hover { background:#274adf; }
.panel-actions .btn-secondary {
  background: rgba(255,255,255,.15); color: var(--text);
}
.panel-actions .btn-secondary:hover {
  background: rgba(255,255,255,.25);
}


/* ============================= */
/* ===== RESPONSIVE DESIGN ===== */
/* ============================= */

/* --- TABLETTE (max-width: 992px) --- */
@media (max-width: 992px) {
  .header-wrap {
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  .brand {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Bouton hamburger */
  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    z-index: 11;
  }

  .nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    margin: 3px 0;
    border-radius: 1px;
    transition: all 0.3s ease;
  }

  /* Animation du burger en "X" */
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
  }
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
  }

  /* Menu caché par défaut */
  .nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-top: 10px;
  }

  /* Menu ouvert */
  .nav.open {
    display: flex;
    animation: fadeIn 0.25s ease;
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .nav a {
    display: block;
    padding: 10px 16px;
    text-align: center;
    border-radius: 8px;
    font-size: 15px;
  }

  .wrap {
    padding: 20px;
  }

  #yt {
    height: 360px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
  }
}

/* --- MOBILE (max-width: 600px) --- */
@media (max-width: 600px) {
  /* ===== HEADER ===== */
  .header-wrap {
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
  }

  .brand {
    justify-content: center;
    gap: 6px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  /* Bouton hamburger */
  .nav-toggle {
    width: 40px;
    height: 40px;
  }

  .nav-toggle span {
    width: 20px;
  }

  /* Menu en colonne et centré */
  .nav {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 6px;
    padding-top: 8px;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    display: block;
    width: auto;
    padding: 10px 16px;
    text-align: center;
    border-radius: 8px;
    font-size: 15px;
  }

  .user-name {
    font-size: 13px;
    text-align: center;
  }

  /* ===== MAIN ===== */
  .wrap {
    padding: 16px;
  }

  .search-form {
    flex-direction: column;
    gap: 8px;
  }

  .search-form input,
  .search-form button {
    width: 100%;
  }

  #yt {
    height: 220px;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .ttl {
    font-size: 13px;
  }

  .ch {
    font-size: 11px;
  }

  /* ===== FLOATING BUTTON ===== */
  .btn-fab {
    width: 48px;
    height: 48px;
    bottom: 16px;
    right: 16px;
    font-size: 24px;
  }

  /* ===== MODAL ===== */
  .panel-content {
    width: 90%;
    max-width: 320px;
  }
}
