/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
  --primary-color: #3C6153;
  --primary-light: #5a8a76;
  --primary-dark: #2a4a3d;
  --secondary-color: #f8f9fa;
  --accent-color: #ff6b6b;
  --text-dark: #212529;
  --text-muted: #6c757d;
  --border-radius: 12px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: var(--text-dark);
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  background: white !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1rem;
}

.navbar-brand {
  transition: var(--transition);
}

.navbar-brand:hover {
  transform: scale(1.05);
}

.navbar-brand img {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(60, 97, 83, 0.2);
}

.nav-link {
  color: var(--text-dark) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  transition: var(--transition);
  border-radius: 8px;
  margin: 0 0.2rem;
}

.nav-link:hover {
  background-color: rgba(60, 97, 83, 0.1);
  color: var(--primary-color) !important;
}

#cartBtn {
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 2px solid var(--primary-color);
  background: white;
  transition: var(--transition);
}

#cartBtn:hover {
  background: var(--primary-color);
  transform: scale(1.1);
}

#cartCount {
  font-size: 0.7rem;
  border-radius: 50%;
  padding: 0.25rem 0.4rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ============================================
   SEARCH BAR
   ============================================ */
.d-flex[role="search"] input {
  border-radius: 25px 0 0 25px;
  border: 2px solid var(--primary-color);
  padding: 0.6rem 1.2rem;
}

.d-flex[role="search"] button {
  border-radius: 0 25px 25px 0;
  background: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 600;
}

.d-flex[role="search"] button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
  animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

section h2 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--primary-color);
  display: inline-block;
}

/* ============================================
   PRODUCT CARDS
   ============================================ */
.card.product {
  border: 1px linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 50%, #3498db 50%, #3498db 100%) !important;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  background: transparent;
}

.card.product:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}



.card.product:hover .product-image,
.card.product:hover .card-img-top {
  transform: scale(1.05);
}

.carousel-inner {
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.card-body {
  padding: 1.25rem;
}

#sectorname {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
   display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#sectordescription {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#sectorprix {
  font-size: 1.2rem;
  color: var(--accent-color);
  margin-top:-15px;
}

#sectorprix del {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

/* ============================================
   FORM CONTROLS
   ============================================ */







/* ============================================
   BUTTONS
   ============================================ */
.btn {
  border-radius: 8px;
  font-weight: 600;
  transition: var(--transition);
  padding: 0.5rem 1rem;
}

.btn-outline-primary {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-outline-primary:hover,
.btn-hover-primary:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.btn-outline-success:hover,
.btn-hover-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
}
/* ============================================
   supérieurs à 768px (tablette paysage, desktop)
   ============================================ */
@media (min-width: 769px) {
#boutonajouter,
#boutoncommander {
  font-size: 0.9rem;
  margin-top: -275px;
  margin-bottom: 275px;
}

#boutonajouter, #boutoncommander {
    flex: 1 1 48%;
  }
  
#boutonajouter,
#boutoncommander {
  position: relative;
  z-index: 10; /* Plus élevé que les images */
}

.product-image,
.card-img-top {
  height: 300px !important;

  object-fit: cover !important;
  transition: var(--transition);
}



}
/* ============================================
   inférieurs ou égaux à 768px (mobile, petite tablette)
   ============================================ */

@media (max-width: 769px) {
#boutonajouter,
#boutoncommander {
  font-size: 0.9rem;
  margin-top: 275px;
  margin-bottom: -275px;}

#boutonajouter, #boutoncommander {
    flex: 1 1 48%;
  }
  
#boutonajouter,
#boutoncommander {
  position: relative;
  z-index: 10; /* Plus élevé que les images */
}
.product-image,
.card-img-top {
  height: 300px !important;

  object-fit: cover !important;
  transition: var(--transition);
}
}

/* -------------------------------------------------
   PORTRAIT MOBILE  (≤ 575 px)  –  UNIQUE MEDIA-QUERY
-------------------------------------------------- */
@media (max-width: 575.98px) {
    
#boutonajouter,
#boutoncommander {
  font-size: 0.9rem;
  margin-top: 10px !important;
 

  position: relative; /* nécessaire pour que z-index fonctionne */
  z-index: 9999 !important; /* très élevé pour passer devant tout */

  pointer-events: auto; /* au cas où ils seraient désactivés */
}



  /* 3. images : remplissage uniforme dans le nouveau cadre */
  .card.product .carousel-item img,
  .card.product .card-img-top {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center;
  }




  /* ----------  Images : remplissage uniforme ---------- */
  .card.product .carousel-item img,
  .card.product .card-img-top {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;    /* égalise le cadrage */
    
  }


  /* ----------  CARTE : HAUTEUR GLOBALE  ---------- */
  .card.product {
    position: relative;
    height: 510px;
    background: transparent;
    border-radius: 1rem;
    overflow: hidden;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
  }

  /* ----------  CAROUSEL  ---------- */
  .card.product .carousel,
  .card.product .carousel-inner,
  .card.product .carousel-item {
    height: 470px !important;
    background: #f7f3f0;
  }



  /* ----------  FORMULAIRES CÔTE À CÔTE  ---------- */
  .form-short {
    display: flex;
    align-items: center;
    gap: .4rem;
  }
  .form-short label {
    margin: 0;
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex: 0 0 90px;          /* largeur fixe label */
  }
  .form-short .form-control,
  .form-short .form-select {
    flex: 1 1 0%;
    min-width: 0;
    font-size: .8rem;
    padding: .2rem .4rem;
  }

  /* ----------  BOUTONS  ---------- */
  .addCart,
  .buyNow {
    background: rgba(255, 255, 255, .95);
    color: #C19A3A !important;
    border: 1px solid #C19A3A !important;
    font-size: .8rem;
    padding: .3rem .5rem;
    flex: 1 1 48%;
    border-radius: .4rem;
    transition: all .2s ease;
  }
  .addCart:hover,
  .buyNow:hover {
    background: #C19A3A !important;
    color: #fff !important;
  }
  
 
  /* --- 1. On remet le bloc-boutons DANS le flux, en bas de la carte --- */
  .card.product .card-body {
    position: static !important;          /* plus de flex-end absolu */
    height: auto !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: .4rem .6rem .6rem;
    margin: 0 !important;
    display: block;                       /* on repasse en block */
  }

  /* --- 2. Conteneur des boutons : sticky en bas, horizontal --- */
  .card.product .btn-wrap {               /* on cible le DIV qui entoure déjà vos boutons */
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(4px);
    padding: .5rem .6rem .4rem;
    border-radius: 0 0 1rem 1rem;
    display: flex;
    gap: .5rem;
    z-index: 10;                          /* au-dessus de l’image */
  }

  /* --- 3. Largeur des boutons --- */
  .card.product .addCart,
  .card.product .buyNow {
    flex: 1 1 48%;
    font-size: .8rem;
    padding: .35rem .5rem;
    margin: 0;
  }


  /* ----------  TEXTES PRODUIT  ---------- */
  #sectorname {
    text-transform: uppercase;
    color: #3C6153 !important;
    font-weight: 600;
    font-size: .95rem;
    margin: 0 0 .2rem;
  }
  #sectordescription {
    text-transform: lowercase;
    color: #555 !important;
    font-size: .8rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 .2rem;
  }
  #sectorprix {
    color: #e74c3c !important;
    font-weight: 600;
    font-size: .9rem;
    margin: 0 0 .3rem;
  }

  /* ----------  DIVERS  ---------- */
  .container {
    padding-left: .5rem;
    padding-right: .5rem;
  }
  section h2 {
    font-size: 1.3rem;
  }
  .btn {
    font-size: .85rem;
    padding: .4rem .8rem;
  }
  input,
  select,
  textarea {
    font-size: 16px !important;   /* évite le zoom iOS */
  }
  
  /* ----------  CARD-BODY : plus de voile  ---------- */
  .card.product .card-body {
    position: static !important;     /* sort du flux absolu */
    height: auto !important;
    background: transparent !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: .6rem .8rem .8rem;     /* gardez ou retirez selon votre goût */
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: .4rem;
  }
  
  /* 575 px et moins – ajoutez CE SEUL BLOC à la fin de votre feuille */

  /* 1. la carte s’adapte à son contenu */
  .card.product {
  
  }

  /* 2. le carousel n’a plus de hauteur imposée */
  .card.product .carousel,
  .card.product .carousel-inner,
  .card.product .carousel-item {
    
    max-height: none !important;
    background: transparent !important;
  }

  /* 3. on retire le padding-ratio de Bootstrap */
  .carousel-inner::before {
    display: none;                    /* ← enlève le pseudo-élément qui force le ratio */
  }

  /* 4. l’image prend toute la largeur ET sa hauteur naturelle */
  .card.product .carousel-item img,
  .card.product .card-img-top {
    position: static !important;      /* ← supprime absolute */
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: top center;
  }

  /* 5. (facultatif) si vous voulez un petit espace entre image et texte */
  .card.product .card-body {
    padding-top: .5rem;
  }
  
  .card.product .carousel,
  .card.product .carousel-inner,
  .card.product .carousel-item {
    height: 470px !important;
    z-index: 1;                        /* en dessous des boutons */
  }
/* ----------  AFFICHAGE & POSITION BOUTONS – PORTRAIT MOBILE  ---------- */
@media (max-width: 575.98px) {
  /* 1. on remet le corps dans le flux normal */
  .card.product .card-body {
    position: static !important;
    height: auto !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: .4rem .6rem .6rem;
    margin: 0 !important;
    display: block !important;          /* essentiel */
  }

  /* 2. on vise le DIV qui entoure vos boutons */
  .card.product .card-body > .d-flex.gap-2.flex-wrap { /* sélecteur exact de votre HTML */
    position: sticky !important;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(4px);
    padding: .5rem .6rem .4rem;
    border-radius: 0 0 1rem 1rem;
    display: flex !important;
    gap: .5rem;
    z-index: 999;                       /* au-dessus de l’image */
  }

  /* 3. largeur des boutons */
  .card.product .addCart,
  .card.product .buyNow {
    flex: 1 1 48%;
    font-size: .8rem;
    padding: .35rem .5rem;
    margin: 0;
  }

  /* 4. on remonte légèrement le carousel pour ne pas être sous les boutons */
  .card.product .carousel,
  .card.product .carousel-inner,
  .card.product .carousel-item {
    height: 470px !important;
    z-index: 1;                        /* en dessous des boutons */
  }
}

}

/* ============================================
   MODAL
   ============================================ */
.modal-content {
  border-radius: var(--border-radius);
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-title {
  font-weight: 700;
  font-size: 1.5rem;
}

.table {
  margin-bottom: 0;
}

.table thead {
  background-color: var(--secondary-color);
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background-color: rgba(60, 97, 83, 0.05);
}

#cartTotal {
  color: var(--accent-color);
  font-size: 1.3rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  .navbar-brand span {
    font-size: 0.9rem;
  }

  .navbar-brand img {
    height: 35px !important;
  }

  #cartBtn {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
  


  .d-flex[role="search"] {
    margin-top: 1rem;
    width: 100%;
  }

  .nav-link {
    margin: 0.25rem 0;
  }

  section h2 {
    font-size: 1.5rem;
  }

  .card.product {
    margin-bottom: 1rem;
  }

  .product-image,
  .card-img-top {
    height: 180px!important;
  }

.product-image{
    height: 280px!important;
  }


  #espaceMobile1,
  #espaceMobile2 {
    display: none;
  }

  .modal-dialog {
    margin: 0.5rem;
  }

  .table {
    font-size: 0.85rem;
  }

  .table th,
  .table td {
    padding: 0.5rem;
  }

  #cartTotal {
    font-size: 1.1rem;
  }

  .card.product {
    overflow: visible;
    background: transparent;
  }

  .carousel-item {
    position: relative;
    height: 180px;
  }

  .carousel-inner {
    overflow: visible;
  }

  .product-image,
  .card-img-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: top;
  }

  .card-body {
    background: transparent;
  }
}



/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in {
  animation: fadeIn 0.6s ease-in;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card.product {
  animation: slideUp 0.5s ease-out;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary {
  color: var(--primary-color) !important;
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.border-primary {
  border-color: var(--primary-color) !important;
}

/* Scroll smooth */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}



/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in {
  animation: fadeIn 0.6s ease-in;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card.product {
  animation: slideUp 0.5s ease-out;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary {
  color: var(--primary-color) !important;
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.border-primary {
  border-color: var(--primary-color) !important;
}

/* Scroll smooth */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ====== FORMULAIRE COURT (label à côté de l’input) ====== */
.form-short {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.form-short label {
  margin: 0;
  white-space: nowrap;
  font-size: .85rem;
  color: var(--text-muted);
}
.form-short .form-control,
.form-short .form-select {
  flex: 1 1 0%;
  min-width: 0;
  font-size: .85rem;
  padding: .25rem .5rem;
}

/* -------------------------------------------------
   PORTRAIT MOBILE  –  RESET + BOUTONS VISIBLES
-------------------------------------------------- */
@media (max-width: 575.98px) {
  /* 1. on annule TOUT ce qui traîne */
  .card.product,
  .card.product .card-body,
  .card.product .carousel,
  .card.product .carousel-inner,
  .card.product .carousel-item,
  .card.product .card-img-top,
  .card.product .product-image,
  #boutonajouter,
  #boutoncommander,
  .addCart,
  .buyNow {
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    z-index: auto !important;
  }

  /* 2. carte : hauteur fixe, pas de overflow caché */
  .card.product {
    height: 510px;
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    overflow: visible;          /* on veut voir les boutons */
  }

  /* 3. image / carousel : prend toute la largeur, hauteur fixe */
  .card.product .carousel,
  .card.product .carousel-inner,
  .card.product .carousel-item,
  .card.product .card-img-top,
  .card.product .product-image {
    height: 470px !important;
    width: 100%;
    object-fit: cover;
  }

  /* 4. corps : juste assez grand pour le texte + boutons */
  .card.product .card-body {
    flex: 0 0 auto;                 /* ne grandit plus */
    padding: .5rem .6rem .6rem;
    background: transparent;
  }

  /* 5. boutons : on les colle JUSTE après l’image */
  .card.product .card-body > .d-flex.gap-2.flex-wrap {
    order: 99;                      /* on les force en dernier */
    display: flex !important;
    gap: .5rem;
    padding: .4rem 0 0;
  }

  .addCart,
  .buyNow {
    flex: 1 1 48%;
    font-size: .8rem;
    padding: .35rem .5rem;
  }
}

    
