/*
 * Apps-shop — Back-office shop (dashboard Eshop / Produits / Commandes).
 * Design : fond clair, cartes blanches, border-radius 10px, ombre légère.
 */
@import url("css/eshop.css");
@import url("css/products.css");
@import url("css/orders.css");

/* Boutique : pas de scroll horizontal sur la fenêtre */
html,
body {
  overflow-x: hidden;
}

/* ----- Conteneur principal Shop (boutique + cohérence largeur) ----- */
#app-content .shop-page,
#app-content .products-page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
  min-width: 0;
}

/* Boutique seule : moins d’air en tête, carte recherche sous le bandeau Wenergy Shop */
#app-content .shop-page {
  padding-top: 10px;
}

#app-content .shop-page,
#app-content .shop-page *,
#app-content .shop-page *::before,
#app-content .shop-page *::after {
  box-sizing: border-box;
}

#app-content .shop-page .shop-header {
  margin-bottom: 8px;
}

/* Champs & barres de filtre : pas de débordement du conteneur */
#app-content .shop-page input,
#app-content .shop-page select,
#app-content .shop-page textarea,
#app-content .products-page input,
#app-content .products-page select,
#app-content .products-page textarea,
#app-content .shop-page .shop-filters-wrapper,
#app-content .shop-page .search-wrapper,
#app-content .shop-page .shop-filters,
#app-content .shop-page .shop-filters-bottom,
#app-content .shop-page .search-filters-buttons,
#app-content .shop-page .search-bar-row {
  max-width: 100%;
  box-sizing: border-box;
}

/* ----- Dashboard (page principale) ----- */
.shop-app {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: #111827;
  background: #f8fafc;
  min-height: 100%;
  padding: 40px;
}
.shop-app .shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 24px 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.shop-app .shop-header__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}
.shop-cart {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #374151;
}
.shop-cart-icon {
  font-size: 20px;
}
.shop-cart-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.shop-app .shop-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 32px 0;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
.shop-app .shop-tab-btn {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.shop-app .shop-tab-btn:hover {
  color: #111827;
}
.shop-app .shop-tab-btn.active {
  color: #111827;
  border-bottom-color: #111827;
}
.shop-app .shop-tab-container {
  padding: 0 32px 24px;
  background: #f8fafc;
}
.shop-app .shop-tab {
  display: none;
  padding: 0;
}
.shop-app .shop-tab.active {
  display: block;
}
.shop-app .shop-tab[hidden] {
  display: none !important;
}

/* ----- Ancienne vue liste (conservée pour shop-product / compat) ----- */
.shop-container {
  padding: 40px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  color: #111827;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.shop-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #141821;
}

.shop-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.shop-btn--primary {
  background: #2f80ed;
  color: #fff;
}

.shop-btn--primary:hover {
  background: #2563eb;
}

.shop-btn--secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.shop-btn--secondary:hover {
  background: #e5e7eb;
}

.shop-btn--small {
  padding: 6px 12px;
  font-size: 12px;
}

.shop-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.shop-table th,
.shop-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.shop-table thead th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.shop-table tbody tr:hover {
  background: #f9fafb;
}

.shop-table tbody tr.shop-row {
  cursor: pointer;
}

.shop-table tbody tr.shop-row:hover {
  background: #eff6ff;
}

.shop-table tbody tr:last-child td {
  border-bottom: none;
}

.shop-empty td {
  text-align: center;
  color: #9ca3af;
  font-style: italic;
  padding: 20px;
}

.shop-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.shop-badge--draft {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.shop-badge--published {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
}

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

.shop-actions .shop-btn {
  flex-shrink: 0;
}

/* =========================
   MOBILE / PWA (≤1024px) — desktop inchangé
   ========================= */
@media (max-width: 1024px) {
  #app-content .shop-app.shop-page,
  #app-content .products-page.products-admin {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .shop-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .shop-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .shop-title {
    font-size: 1.2rem;
  }
  .shop-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
  }
  .shop-btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  .shop-actions {
    flex-wrap: wrap;
  }
}

/* ----- Boutique (#app-content .shop-page) : filtres sans scroll horizontal, grille dense -----
   (classes réelles : .shop-filters-bottom / .shop-search-bar — pas products.css admin) */
#app-content .shop-page .shop-filters-wrapper {
  overflow-x: hidden;
  overflow-y: visible;
  padding: 20px;
  margin-top: 0;
  max-width: 100%;
}

/* Rangée filtres : pas de scroll horizontal, retour à la ligne si besoin */
#app-content .shop-page .shop-filters-bottom.search-bar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

#app-content .shop-page .shop-filters-bottom.search-bar-row > * {
  max-width: 100%;
}

#app-content .shop-page .shop-filters-bottom.search-bar-row > .shop-filter-pill {
  flex: 1 1 auto;
  min-width: 0;
}

#app-content .shop-page .shop-filters-bottom.search-bar-row > .shop-filter-pill.shop-filter-pill--price {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
}

#app-content .shop-page .shop-filters-bottom.search-bar-row input.shop-price-input[type="number"],
#app-content .shop-page .shop-filters-bottom.search-bar-row input.shop-price-input {
  width: 70px;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 70px;
  font-size: 12px;
  padding: 6px;
}

#app-content .shop-page .shop-filters-bottom.search-bar-row .shop-filter-pill select,
#app-content .shop-page .shop-filters-bottom.search-bar-row .shop-filter-pill.shop-filter-pill--sort select {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  padding: 6px 10px;
}

#app-content .shop-page .shop-filters-bottom.search-bar-row > .shop-filter-reset {
  flex: 0 0 auto;
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 13px;
  padding: 6px 10px;
  min-width: auto;
}

/* Catégories : s’assurer du wrap (déjà en place, renforcé) */
#app-content .shop-page .shop-filters {
  flex-wrap: wrap;
  overflow: visible;
}

#app-content .shop-page .eshop-wrapper {
  padding: 0 0 12px;
}

#app-content .shop-page .shop-search-header {
  margin-top: 0;
}

#app-content .shop-page .products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
  margin-top: 16px;
  padding-top: 6px;
  box-sizing: border-box;
  align-items: start;
}

#app-content .shop-page .eshop-wrapper {
  max-width: 100%;
  overflow-x: hidden;
}

#app-content .shop-page .eshop-wrapper .product-card {
  width: 100%;
  max-width: none;
  min-width: 0;
}

@media (max-width: 1200px) {
  #app-content .shop-page .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #app-content .shop-page .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  #app-content .shop-page .products-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
