/* PlaylisTube - mise en page : barre du haut, zone principale, accueil, pied de page. */

/* ---------- Barre de chargement ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 300;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}

.progress::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  background: var(--brand);
  animation: progress-slide 1.1s ease-in-out infinite;
}

@keyframes progress-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(260%); }
}

@media (prefers-reduced-motion: reduce) {
  .progress::before {
    width: 100%;
    animation: none;
    opacity: .6;
  }
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr minmax(0, 640px) 1fr;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 18px 0 20px;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-border);
  box-shadow: var(--shadow-chrome);
}

.brand-wrap {
  justify-self: start;
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-left: -6px;
  padding: 6px;
  border-radius: var(--radius-m);
}

.brand-icon {
  width: 34px;
  height: 34px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.4px;
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Boutons de la barre aux memes dimensions que ceux d'Assemble Images :
   bouton texte de 36 px de haut (marges 14 px, ecart 8 px, texte 13,5 px),
   bouton rond de 36 px, icones de 18 px. */
.topbar-actions .btn {
  gap: 8px;
  padding: 0 14px;
  font-size: 13.5px;
}

.topbar-actions .icon-btn {
  width: 36px;
  height: 36px;
}

.topbar-actions .btn svg,
.topbar-actions .icon-btn > svg {
  width: 18px;
  height: 18px;
}

/* ---------- Zone principale ---------- */
.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
}

.status-area:not(:empty) {
  margin-bottom: 20px;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.results:empty {
  display: none;
}

/* ---------- Accueil ---------- */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 680px;
  margin: 40px auto 0;
  text-align: center;
}

.home-icon {
  width: 72px;
  height: 72px;
}

.home-title {
  font-size: 28px;
  line-height: 36px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.home-text {
  max-width: 540px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 24px;
}

.home-key {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px 14px 20px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-l);
  background: var(--accent-soft);
  text-align: left;
}

.home-key-text {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.home-key-text > .icon {
  color: var(--accent-soft-fg);
}

.home-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  width: 100%;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.home-examples li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-l);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.home-examples code {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-examples span {
  color: var(--text-2);
  font-size: 12px;
}

.home-recents {
  width: 100%;
  margin-top: 16px;
  text-align: left;
}

.home-recents-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.home-recents-title {
  font-size: 16px;
  font-weight: 500;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Pied de page ---------- */
.site-footer {
  margin-top: auto;
  padding: 16px var(--gutter) 24px;
  border-top: 1px solid var(--chrome-border);
  background: var(--chrome);
  color: var(--text-2);
  font-size: 12px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
}

.site-footer a:hover {
  color: var(--accent-soft-fg);
}

/* ---------- Menu Barbatools et menu de l'ecran etroit ----------
   Grand ecran : icone Barbatools tout a droite de la barre (menu des autres outils),
   engrenage pour les parametres. Ecran etroit (seuil ci-dessous, choisi par mesure) :
   l'icone et l'engrenage quittent la barre ; le chevron a cote du logo ouvre le menu
   des parametres, sous lequel s'ajoutent Barbatools et les autres outils. */
.brand-menu {
  display: none;
  place-items: center;
  flex: none;
  width: 22px;
  height: 34px;
  margin-left: -2px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  transition: background-color .15s;
}

.brand-menu:hover,
.brand-menu[aria-expanded="true"] {
  background: var(--surface-1);
  color: var(--text);
}

.brand-menu > svg {
  width: 18px;
  height: 18px;
}

/* Liens alignes sur les entrees du menu (texte a 16 px du bord) */
#settingsMenu barba-nav-links {
  padding: 0 6px;
}

@media (min-width: 521px) {
  .barba-mobile { display: none; }
}

@media (max-width: 520px) {
  .brand-menu { display: inline-grid; }
  #settingsBtn,
  .barba-desktop { display: none; }

  /* Le menu des parametres s'ouvre sous la barre, a gauche (sous le chevron) */
  #settingsMenu {
    position: fixed;
    top: calc(var(--topbar-h) + 4px);
    right: auto;
    left: 8px;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - var(--topbar-h) - 16px);
    overflow: auto;
  }
}

/* ---------- Petits ecrans ---------- */
@media (max-width: 760px) {
  :root {
    --gutter: 16px;
  }

  /* Une seule ligne, comme VCF Contacts : logo (sans le titre), recherche, boutons */
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand search actions";
    gap: 8px;
    padding: 0 10px 0 12px;
  }

  .brand-wrap { grid-area: brand; }
  .brand-name { display: none; }
  .search { grid-area: search; }
  .search-btn { width: 48px; }
  .topbar-actions { grid-area: actions; }

  .btn-label {
    display: none;
  }

  .home {
    margin-top: 16px;
  }

  .home-title {
    font-size: 22px;
    line-height: 30px;
  }
}
