/* ============================================
   MOXIE DEVICES MODULE — moxiedevices.css
   Bouton "Sélectionnez votre appareil" + dropdown marques
   + style de la page listing par modèle (/module/moxiedevices/list)
   ============================================ */

/* ── Wrapper ── */
.moxie-devices {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1001;
}

/* ── Bouton principal ── */
.moxie-devices__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0a0a0a;
  color: #fff;
  border: 1px solid #0a0a0a;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
  outline: none;
}
.moxie-devices__btn:hover,
.moxie-devices__btn:focus {
  border-color: #c1d101;
  color: #c1d101;
  outline: none;
}
.moxie-devices--open .moxie-devices__btn {
  border-color: #c1d101;
  color: #c1d101;
}

.moxie-devices__icon { flex-shrink: 0; }
.moxie-devices__label {
  font-size: 12.5px;
  letter-spacing: .01em;
}

.moxie-devices__caret {
  flex-shrink: 0;
  opacity: .7;
  transition: transform .2s;
}
.moxie-devices--open .moxie-devices__caret {
  transform: rotate(180deg);
  opacity: 1;
}

/* ── État "appareil sélectionné" (après choix persisté) ── */
.moxie-devices--has-selection .moxie-devices__btn {
  background: #c1d101;
  border-color: #c1d101;
  color: #0a0a0a;
}
.moxie-devices--has-selection .moxie-devices__btn:hover {
  background: #0a0a0a;
  color: #c1d101;
}

/* ============================================
   DROPDOWN
   ============================================ */

.moxie-devices__dropdown {
  position: fixed;
  top: auto;
  right: 10px;
  left: auto;
  width: min(780px, calc(100vw - 20px));
  max-height: min(560px, calc(100vh - 120px));
  background: #fff;
  border: .5px solid #e5e5e5;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 2000;
}
.moxie-devices__dropdown--visible {
  display: flex;
}

/* ── Header ── */
.moxie-devices__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: .5px solid #f0f0f0;
  background: #fafafa;
  flex-shrink: 0;
}

.moxie-devices__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #0a0a0a;
  flex-shrink: 0;
}

.moxie-devices__search-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.moxie-devices__search-icon {
  position: absolute;
  left: 12px;
  color: #aaa;
  pointer-events: none;
}
.moxie-devices__search {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: .5px solid #e5e5e5;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: #0a0a0a;
  outline: none;
  transition: border-color .15s;
}
.moxie-devices__search:focus {
  border-color: #c1d101;
}
.moxie-devices__search::placeholder {
  color: #bbb;
}

.moxie-devices__reset {
  background: transparent;
  border: .5px solid #e5e5e5;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-family: inherit;
  color: #666;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
}
.moxie-devices__reset:hover {
  border-color: #c1d101;
  color: #0a0a0a;
}

/* ── Body ── */
.moxie-devices__body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

/* ── Grille des marques ── */
.moxie-devices__groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
}

.moxie-devices__group {
  padding: 14px 0;
  border-right: .5px solid #f0f0f0;
}
.moxie-devices__group:last-child {
  border-right: none;
}

.moxie-devices__group-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #0a0a0a;
  padding: 0 18px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.moxie-devices__group-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e5e5;
}
.moxie-devices__group-count {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  color: #999;
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 10px;
  letter-spacing: 0;
}

.moxie-devices__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  font-size: 13px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  transition: background .1s, color .1s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  line-height: 1.3;
}
.moxie-devices__item:hover,
.moxie-devices__item:focus {
  background: #f9f9f9;
  color: #0a0a0a;
  text-decoration: none;
  outline: none;
}
.moxie-devices__item-icon {
  width: 20px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  transition: color .15s;
}
.moxie-devices__item-icon svg {
  width: 16px;
  height: auto;
}
.moxie-devices__item:hover .moxie-devices__item-icon {
  color: #0a0a0a;
}
.moxie-devices__item-name {
  flex: 1;
  min-width: 0;
}
.moxie-devices__item mark {
  background: transparent;
  color: #c1d101;
  font-weight: 700;
  padding: 0;
}

/* ── États ── */
.moxie-devices__loading,
.moxie-devices__empty,
.moxie-devices__error {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: #999;
}
.moxie-devices__loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e5e5e5;
  border-top-color: #c1d101;
  border-radius: 50%;
  animation: moxie-devices-spin .7s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
@keyframes moxie-devices-spin { to { transform: rotate(360deg); } }

.moxie-devices__empty strong {
  color: #0a0a0a;
  font-weight: 600;
}

/* ============================================================
   PAGE LISTING PAR MODÈLE
   (/module/moxiedevices/list?model=NOM)
   
   Duplication des règles #category (moxie.css) avec scope
   body.moxie-device-list pour hériter du MÊME look que les pages
   catégorie : grille 5 cols, séparateurs 1px, miniatures flush,
   overlay hover, bande modèles, etc.
   ============================================================ */

/* ── Bannière : variante du banner catégorie, fond dégradé ── */
.moxie-cat-banner--device {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}
.moxie-cat-banner--device .moxie-cat-banner__eyebrow {
  color: #c1d101;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.moxie-cat-banner--device .moxie-cat-banner__title::before {
  content: '📱 ';
  opacity: .6;
  margin-right: .2em;
}

/* ── Pas de bouton filtres (pas d'applicabilité) ── */
body.moxie-device-list #moxie-filter-toggle {
  display: none !important;
}

/* ── Full-width layout (supprime sidebar + container) ── */
body.moxie-device-list #left-column,
body.moxie-device-list #right-column {
  display: none !important;
}

body.moxie-device-list #content-wrapper,
body.moxie-device-list #center-column {
  flex: 0 0 100% !important;
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.moxie-device-list #wrapper > .container,
body.moxie-device-list #wrapper > .container-fluid,
body.moxie-device-list .columns-container,
body.moxie-device-list #wrapper .container,
body.moxie-device-list #wrapper .container-fluid {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* ── Grille 5 colonnes avec séparateurs 1px ── */
body.moxie-device-list #js-product-list .products {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 1px !important;
  background: #e5e5e5 !important;
  padding: 0 !important;
  margin: 0 !important;
  list-style: none !important;
}

body.moxie-device-list #js-product-list {
  background: #e5e5e5;
}

/* ── Card miniature flush dans la grille ── */
body.moxie-device-list .product-miniature {
  border-radius: 0 !important;
  border: none !important;
  background: #ffffff !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  transition: none !important;
}

body.moxie-device-list .product-miniature:hover {
  border-color: #0a0a0a !important;
  transform: none;
}

/* ── Lien englobant la carte ── */
body.moxie-device-list .product-miniature__link {
  display: flex;
  flex-direction: column;
  text-decoration: none !important;
  color: inherit;
  height: 100%;
}

/* ── Image container : fond gris + contain ── */
body.moxie-device-list .product-miniature__top {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 0 !important;
}

body.moxie-device-list .product-miniature__image-container,
body.moxie-device-list .thumbnail-container {
  background: #f5f5f5;
  overflow: hidden;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 12px;
  border-radius: 0 !important;
}

body.moxie-device-list .product-miniature__image-link {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
}

body.moxie-device-list .product-miniature__image-link picture {
  display: block;
  width: 100%;
  height: 100%;
}

body.moxie-device-list .product-miniature__image {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
  transition: transform .3s;
  mix-blend-mode: multiply;
  border-radius: 0 !important;
}

body.moxie-device-list .product-miniature:hover .product-miniature__image {
  transform: scale(1.04);
}

/* ── Overlay sombre au hover (CTA "Voir le produit") ── */
body.moxie-device-list .product-miniature:hover .moxie-card-overlay {
  opacity: .82;
}

body.moxie-device-list .product-miniature:hover .moxie-card-overlay__cta {
  transform: translateY(0);
}

/* ── Bande modèles (Option C) : fade out au hover ── */
body.moxie-device-list .product-miniature:hover .moxie-model-strip {
  opacity: 0;
}

/* ── Corps carte : padding + gap sans bouton split ── */
body.moxie-device-list .product-miniature__bottom {
  padding: 10px 14px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

body.moxie-device-list .product-miniature__infos {
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  flex: 1;
}

body.moxie-device-list .product-miniature__actions {
  display: none !important;
}

/* ── Titre strict 2 lignes, hauteur fixe ── */
body.moxie-device-list .moxie-product-title {
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  min-height: 34px;
  max-height: 34px;
  margin-bottom: 4px;
  color: #0a0a0a !important;
  text-decoration: none !important;
}

/* ── Prix ── */
body.moxie-device-list .moxie-product-prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 8px;
  margin-top: auto;
}

body.moxie-device-list .moxie-product-price {
  font-size: 15px;
  font-weight: 700;
  color: #0a0a0a;
}

body.moxie-device-list .moxie-product-old-price {
  font-size: 12px;
  color: #ccc;
  text-decoration: line-through;
  font-weight: 400;
}

/* ── Responsive (mirror des règles catégorie) ── */
@media (max-width: 992px) {
  body.moxie-device-list #js-product-list .products {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 768px) {
  body.moxie-device-list #js-product-list .products {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  body.moxie-device-list #js-product-list .products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1px !important;
  }
}

/* ============================================
   RESPONSIVE DU WIDGET (bouton sélecteur)
   ============================================ */

/* Tablette : on masque le label, seulement l'icône */
@media (max-width: 1199px) {
  .moxie-devices__btn {
    padding: 9px 10px;
  }
  .moxie-devices__label {
    display: none;
  }
}

/* Mobile : bouton compact, dropdown plein écran */
@media (max-width: 767px) {
  .moxie-devices__btn {
    padding: 8px 10px;
  }
  .moxie-devices__dropdown {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .moxie-devices__head {
    padding: 16px;
  }
  .moxie-devices__title {
    display: none;
  }
  .moxie-devices__groups {
    grid-template-columns: 1fr;
  }
  .moxie-devices__group {
    border-right: none;
    border-bottom: .5px solid #f0f0f0;
  }
  .moxie-devices__group:last-child {
    border-bottom: none;
  }
}
