/* ============================================================
   PAGE-HOME.CSS — Page d'accueil
   ============================================================
   Dépend de : layout.css, components.css
   ============================================================ */

/* ============================================================
   LAYOUT GLOBAL
   ============================================================ */
.home-page {
  padding: 20px var(--space-page-xr) 20px var(--space-page-x);
  background: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  max-width: 100vw;
  overflow-x: hidden;
  height: 100%;
}

.home-section {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-top: 48px;
}

.section-header {
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  max-width: 100%;
  margin-bottom: 24px;
}

.section-header h2 {
  height: 25px;
  color: var(--text-main);
  font: normal normal 600 var(--text-2xl)/25px var(--font-body);
  letter-spacing: 0px;
  text-transform: uppercase;
  margin: 0;
}

/* Info icon (override pour la home — taille réduite) */
.home-page .info-icon {
  width: 16px;
  height: 16px;
  opacity: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-round);
  cursor: help;
  flex-shrink: 0;
}

.home-page .info-icon img { width: 100%; height: 100%; display: block; }

/* ============================================================
   GRILLE 2 COLONNES
   ============================================================ */
.grid-2-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  width: 100%;
  max-width: 100%;
}

/* ============================================================
   CARROUSEL DE JEUX
   ============================================================ */
.carousel-section-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  max-width: 100%;
}

.carousel-container {
  flex: 1;
  width: 100%;
  max-width: 100%;
  height: 288px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
  overflow: hidden;
}

.carousel-controls {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
}

.embla {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 20px;
  padding-right: 20px;
}

.embla__container {
  display: flex;
  flex-direction: row;
  user-select: none;
  margin-left: -15px;
}

.embla__slide {
  flex: 0 0 auto;
  padding-left: 15px;
}

/* Carte jeu */
.game-wrapper {
  position: relative;
  width: 171px;
  height: 257px;
  box-shadow: var(--shadow-card-lg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 3px solid transparent;
  transition: border-color 0s, box-shadow var(--t-base);
}

.game-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* État sélectionné */
/* Jeu en cours : tuile active mise en avant, les autres grisées */
.game-item.is-dimmed .game-wrapper {
  opacity: 0.35;
  filter: grayscale(1);
  transition: opacity 0.2s ease, filter 0.2s ease;
}
.game-item.is-running .game-wrapper {
  box-shadow: var(--shadow-game-sel, 0 0 0 3px #007FFF);
  border-color: #007FFF;
}

/* Badge "ACTIVE GAME" (XD) : pilule bleue en bas de la jaquette */
.active-game-badge {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent, #007FFF);
  color: #fff;
  font: 600 10px/1 var(--font-body, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
}

.game-item.is-selected .game-wrapper {
  box-shadow: var(--shadow-game-sel);
  border-color: #007FFF;
}

/* Hover non-sélectionné */
.game-item:not(.is-selected) .game-wrapper:hover {
  border-color: #007FFF;
}

/* Overlay : visible au hover, pour afficher le bouton launch */
.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  transition: opacity 0.2s;
}

.game-wrapper:hover .game-overlay { opacity: 1; }

/* L'overlay de l'élément sélectionné reste visible mais discret */
.game-item.is-selected .game-wrapper .game-overlay {
  opacity: 0;
}
.game-item.is-selected .game-wrapper:hover .game-overlay {
  opacity: 1;
}



/* Flèches navigation */
.embla__prev,
.embla__next {
  position: absolute;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: var(--text-carousel);
  font-family: Arial, sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color var(--t-fast), var(--t-transform);
  opacity: 1;
}

.embla__prev { left: -35px; }
.embla__next { right: -35px; }
.embla__prev:hover,
.embla__next:hover { opacity: 0.5; }

/* ============================================================
   SLIDERS (MOTION)
   ============================================================ */
.slider-card {
  width: 100%;
  max-width: 100%;
  height: 100px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-title {
  height: 20px;
  font: normal normal 600 var(--text-md)/20px var(--font-body);
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.slider-val {
  height: 20px;
  font: normal normal 600 var(--text-md)/20px var(--font-display);
  color: var(--text-main);
  margin: 0 0 0 auto;
  display: flex;
  align-items: center;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

/* Slider home (gradient inversé) */
input[type="range"] {
  flex: 1;
  appearance: none;
  height: 8px;
  background: linear-gradient(270deg, var(--accent) 0%, var(--bg-input) 100%);
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  background: #FFFFFF;
  box-shadow: var(--shadow-glow-thumb);
  border-radius: var(--radius-round);
}

/* ============================================================
   HARDWARE CARDS
   ============================================================ */
.hardware-card {
  width: 100%;
  max-width: 100%;
  height: 173px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: stretch; /* MODIFIÉ : Permet aux blocs enfants de prendre 100% de la hauteur pour un centrage parfait */
}

/* MODIFIÉ / AJOUTÉ : Gère le côté gauche de la carte */
.hw-info-side {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.hw-label {
  font: normal normal 600 var(--text-md)/20px var(--font-body);
  color: var(--text-main);
  margin-bottom: 16px; /* CORRIGÉ : Force l'écart strict de 16px avec l'élément du dessous */
}

/* Dans la ligne compacte "Motion System [READY]", le label n'est plus un
   titre : pas de marge basse, sinon le badge est désaligné verticalement. */
.hw-row .hw-label {
  margin-bottom: 0;
}

.hw-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.hw-name {
  font-size: 15px;
  font-weight: 600;
  font: normal normal normal var(--text-md)/20px var(--font-body); 
  color: var(--text-main);
}

/* Status badge — dimensions identiques dans tous les états */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 3px 8px;
  border-radius: var(--radius-pill, 16px);
  font: 700 10px/1 var(--font-body, sans-serif);
  letter-spacing: 0.08em;
  white-space: nowrap;
  box-sizing: border-box;
  margin-top: 4px;
}

.status-badge.ready {
  background: #57D147;
  color: #0E151D;
}

/* OFF : serial inactif ou device désactivé — fond rouge, même taille */
.status-badge.off {
  background:#FF2C2C;
  color: #0E151D;
}



/* Motion modes (radio sidebar droite) */
.motion-modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center; /* Centre parfaitement les boutons radios à la même hauteur que le hw-row */
  height: 100%;
  min-width: 320px;
  padding-right: 32px;
  padding-top: 12px;
}

/* Boutons de mode motion (OFF / ON ALWAYS / ON IN GAME) */
.motion-modes .radio-row {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(34, 42, 63, 0.92) 0%, rgba(22, 29, 43, 0.92) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.motion-modes .radio-row:hover {
  border-color: #3d5f86;
  transform: translateY(-1px);
}

.motion-modes .radio-row:active {
  transform: translateY(0);
}

.motion-modes .radio-row input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.motion-modes .radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #0F1726;
  border: 1px solid #3a465e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.motion-modes .radio-dot::after {
  width: 10px;
  height: 10px;
}

.motion-modes .radio-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #8fa3c2;
}

.motion-modes .radio-row:has(input[type="radio"]:checked) {
  border-color: #4d7fbe;
  background: linear-gradient(180deg, rgba(0, 127, 255, 0.22) 0%, rgba(24, 36, 62, 0.96) 100%);
  box-shadow: 0 0 0 1px rgba(0, 127, 255, 0.24), 0 8px 24px rgba(0, 127, 255, 0.16);
}

.motion-modes .radio-row:has(input[value="off"]:checked) {
  border-color: rgba(255, 59, 48, 0.6);
  background: linear-gradient(180deg, rgba(255, 59, 48, 0.18) 0%, rgba(43, 21, 25, 0.95) 100%);
  box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.2), 0 8px 24px rgba(255, 59, 48, 0.14);
}

.motion-modes .radio-row input[type="radio"]:checked ~ .radio-text {
  color: #ffffff;
}

.motion-modes .radio-row input[type="radio"]:checked ~ .radio-dot {
  border-color: var(--accent);
}

.motion-modes .radio-row input[type="radio"]:checked ~ .radio-dot.red {
  border-color: #ff6a62;
}


/* REMPLACER / AJOUTER dans page-home.css */

/* Overlay : fond sombre au hover */
.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);   /* ← plus sombre qu'avant (0.25 → 0.55) */
  transition: opacity 0.2s ease;
}

.game-wrapper:hover .game-overlay { opacity: 1; }

/* Bouton LAUNCH */
.launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #007FFF;
  color: #fff;
  font: 600 11px/1 var(--font-body, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transform: translateY(4px);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 127, 255, 0.4);
}

.launch-btn:hover {
  background: #1a8fff;
  transform: translateY(2px);
  box-shadow: 0 6px 20px rgba(0, 127, 255, 0.6);
}

.launch-btn:active {
  transform: translateY(0px);
  background: #0060cc;
}

.launch-icon {
  font-size: 9px;
}

/* ============================================================
   OVERLAY ACTIONS (LAUNCH + PROFILE)
   ============================================================ */
.overlay-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Bouton PROFILE — même style que LAUNCH */
.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #007FFF;
  color: #fff;
  font: 600 11px/1 var(--font-body, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transform: translateY(4px);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 127, 255, 0.4);
}

.profile-btn:hover {
  background: #1a8fff;
  transform: translateY(2px);
  box-shadow: 0 6px 20px rgba(0, 127, 255, 0.6);
}

.profile-btn:active {
  transform: translateY(0px);
  background: #0060cc;
}

.profile-icon {
  font-size: 10px;
}

/* ============================================================
   PROFILE PANEL
   ============================================================ */
#profile-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: transparent;
}

#profile-panel {
  position: fixed;
  z-index: 9001;
  width: 240px;
  background: var(--bg-info, #303C59);
  border: 1px solid var(--border-deep, #3d4659);
  border-radius: var(--radius-2xl, 12px);
  box-shadow: var(--shadow-dropdown, 0 8px 20px rgba(0,0,0,0.6));
  padding: 0;
  overflow: visible; /* laisse le dropdown-list dépasser */

  opacity: 0;
  transform: scale(0.92) translateY(-6px);
  transform-origin: top left;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(.2,1.4,.4,1);
}

#profile-panel.pp-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Header */
.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-deep, #3d4659);
}

.pp-title {
  font: 700 10px/1 var(--font-body, sans-serif);
  letter-spacing: 0.12em;
  color: #fff;
  text-transform: uppercase;
}

.pp-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.pp-close:hover { color: var(--text-main, #fff); }

/* Body */
.pp-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Dropdown — version réduite calquée sur remote_access */
#pp-profile-dropdown {
  width: 100%;
  position: relative;
}

#pp-profile-dropdown .dropdown-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-deep, #3d4659);
  border-radius: 6px;
  cursor: pointer;
  font: 500 12px/1.4 var(--font-body, sans-serif);
  color: var(--text-main, #fff);
  user-select: none;
  transition: border-color 0.15s;
}

#pp-profile-dropdown .dropdown-selected:hover {
  border-color: var(--accent, #007FFF);
}

#pp-profile-dropdown .arrow {
  font-size: 9px;
  color: var(--text-muted, #8b949e);
  flex-shrink: 0;
  margin-left: 6px;
  transition: transform 0.15s;
}

#pp-profile-dropdown.open .arrow {
  transform: rotate(180deg);
}

#pp-profile-dropdown .dropdown-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-info, #303C59);
  border: 1px solid var(--border-deep, #3d4659);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
  z-index: 9100;
  overflow: hidden;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2d3748 transparent;
}

#pp-profile-dropdown.open .dropdown-list {
  display: block;
}

#pp-profile-dropdown .dropdown-item {
  padding: 8px 10px;
  font: normal 12px/1.4 var(--font-body, sans-serif);
  color: var(--text-main, #fff);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s;
}

#pp-profile-dropdown .dropdown-item:hover {
  background: var(--bg-hover, #1e2533);
}



#pp-profile-dropdown .dropdown-item .pp-default-badge {
  font: 600 9px/1 var(--font-body, sans-serif);
  color: var(--accent, #007FFF);
  background: rgba(0, 127, 255, 0.12);
  border: 1px solid rgba(0, 127, 255, 0.3);
  border-radius: 8px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Launch button */
.pp-launch-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 0;
  background-color:  #007FFF;
  border: 1px solid rgba(0, 127, 255, 0.35);
  border-radius: 6px;
  font: 700 11px/1 var(--font-body, sans-serif);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pp-launch-btn:hover {
  background: rgba(0, 127, 255, 0.32);
  border-color: rgba(0, 127, 255, 0.6);
  color: #fff;
}

.pp-launch-btn:active {
  background: rgba(0, 127, 255, 0.45);
}

.pp-launch-btn .launch-icon {
  font-size: 9px;
}

/* Empty state */
.pp-empty {
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-muted, #8b949e);
  text-align: center;
}

/* Footer */
.pp-footer {
  border-top: 1px solid var(--border-deep, #3d4659);
  padding: 10px 14px;
}

.pp-config-link {
  background: none;
  border: none;
  padding: 0;
  color: #007FFF;
  font: normal 11px/1.4 var(--font-body, sans-serif);
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s;
}

.pp-config-link:hover { color: #0060cc; }

/* ============================================================
   CARTE "ACTIVE PROFILE" (XD mobile)
   ============================================================ */
.active-profile-card {
  background: #222A3F 0% 0% no-repeat padding-box;
  box-shadow: 0px 4px 8px #0000000D;
  border-radius: 8px;
  padding: 14px 16px;
}

.ap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.ap-row .card-title {
  margin: 0;
  width: auto;        /* annule le width:100% du .card-title générique */
  flex: 0 1 auto;
}

/* Nom du profil actif : cliquable → onglet Profiles */
.ap-name-btn {
  background: none;
  border: none;
  padding: 0;
  color: #007FFF;
  font: normal normal 600 15px/19px var(--font-body, sans-serif);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  flex: 0 0 auto;
}

.ap-name-btn:active { color: #0060cc; }

/* ============================================================
   RESPONSIVE — TABLET / MOBILE
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  .home-page {
    padding: 16px var(--space-page-x) 20px var(--space-page-x);
  }

  .home-page .home-section:nth-of-type(1) {
    order: 1;
    padding-top: 0;   /* titre MY GAMES à 16px du haut (XD) */
  }

  #motion-parameters-section {
    order: 2;
  }

  #active-profile-section {
    order: 3;
  }

  #hardware-section {
    order: 4;
  }

  .home-section {
    padding-top: 28px;
  }

  .section-header {
    margin-bottom: 14px;
  }

  .section-header h2 {
    /* Spec XD mobile : 600 20px/25px Funnel Sans, blanc, uppercase */
    font: normal normal 600 20px/25px 'Funnel Sans', var(--font-body, sans-serif);
    letter-spacing: 0;
    color: #FFFFFF;
    text-transform: uppercase;
    height: 25px;
  }

  .grid-2-cols {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .carousel-container {
    height: 236px;
  }

  .embla {
    padding-left: 12px;
    padding-right: 12px;
  }

  .embla__container {
    margin-left: -10px;
  }

  .embla__slide {
    padding-left: 10px;
  }

  .embla__prev,
  .embla__next {
    left: auto;
    right: auto;
    z-index: 5;
  }

  .embla__prev { left: 6px; }
  .embla__next { right: 6px; }

  .game-wrapper {
    width: 130px;
    height: 194px;
  }

  .slider-card {
    height: auto;
    min-height: 108px;
    padding: 14px 16px;
  }

  .grid-2-cols .slider-card:nth-child(1) {
    order: 1;
  }

  .grid-2-cols .slider-card:nth-child(2) {
    order: 2;
  }

  .slider-row-v2 {
    padding-right: 0;
  }

  .hardware-card {
    height: auto;
    min-height: 173px;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }

  .motion-modes {
    width: 100%;
    min-width: 0;
    padding-right: 0;
    padding-top: 0;
  }

  .motion-modes .radio-row {
    min-height: 44px;
    padding: 0 12px;
  }

  .motion-modes .radio-text {
    font-size: 12px;
  }
}

@media (hover: none) and (pointer: coarse) and (max-width: 560px) {
  .home-section {
    padding-top: 22px;
  }

  .carousel-container {
    height: 210px;
  }

  .game-wrapper {
    width: 118px;
    height: 176px;
  }

  .embla__prev,
  .embla__next {
    display: none;
  }
}