/* 🌈 RCgestion POS 2025 - Style global */
body {
  font-family: 'Cairo', sans-serif;
  margin: 0;
  background: linear-gradient(135deg, #f3f4f6, #e0e7ff);
  color: #1e293b;
}

/* 🔹 Header moderne */
.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  color: white;
  padding: 10px 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.brand h2 { margin: 0; font-weight: 700; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-center input {
  width: 60%; min-width: 220px; padding: 10px 14px;
  border: none; border-radius: 10px; font-size: 1rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.header-right { display: flex; align-items: center; gap: 20px; }
.header-total {
  background: rgba(255,255,255,0.15);
  padding: 8px 14px; border-radius: 12px; backdrop-filter: blur(5px);
  font-size: 0.95rem;
}
.header-total strong { color: #fff; font-size: 1.1rem; }

/* === Mise en page principale === */
.pos-container {
  display: grid;
  grid-template-columns: 180px 1fr 450px;
  gap: 14px;
  padding: 12px;
  align-items: start;
  height: calc(100vh - 80px);
  overflow: hidden;
}

/* 📁 Catégories */
.categories { display: flex; flex-direction: column; gap: 8px; }
.categories button {
  background: #e2e8f0; border: none; padding: 10px; border-radius: 8px;
  cursor: pointer; font-weight: 600; transition: 0.2s;
}
.categories button:hover { background: #cbd5e1; }
.categories button.active { background: #2563eb; color: white; }

/* 🛍️ Produits — ✅ zone scrollable */
.produits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px,1fr));
  gap: 14px;
  padding: 10px;
  overflow-y: auto;           /* ✅ défilement vertical indépendant */
  max-height: calc(100vh - 120px); /* ajuste à la hauteur visible */
  scroll-behavior: smooth;
}
.produit {
  background: white; border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  text-align: center; cursor: pointer; padding: 12px;
  transition: all 0.3s ease;
}
.produit:hover { transform: scale(1.05); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
.produit img { width: 100%; height: 100px; object-fit: contain; }
.produit h4 { margin: 6px 0; color: #1e3a8a; }
.produit .info { font-size: 0.85rem; color: #475569; }

/* === Bouton modifier produit === */
.produit .actions { margin-top: 8px; }
.edit-btn {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
}
.edit-btn:hover { background: #1e40af; }

/* 🧾 Panier — ✅ partie fixe */
.panier {
  background: white; border-radius: 14px;
  padding: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  display: flex; flex-direction: column;
  position: sticky; top: 0; /* ✅ fixée pendant le scroll */
  height: calc(100vh - 100px);
  overflow: hidden;
}
.panier-header {
  display: flex; justify-content: space-between; align-items: center;
}
.panier-header button {
  background: #ef4444; color: white; border: none;
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
}
.panier-header button:hover { background: #dc2626; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 10px; }
th,td { border-bottom: 1px solid #e5e7eb; padding: 6px; text-align: center; }

/* 🧮 Calculatrice */
.calc { margin-top: 10px; }
.calc input {
  width: 100%; padding: 8px; border-radius: 8px; border: 1px solid #ccc; margin-bottom: 5px;
}
.calc-keys {
  display: grid; grid-template-columns: repeat(5,1fr); gap: 5px;
}
.calc-keys button {
  padding: 10px; border-radius: 8px; border: none; background: #e2e8f0;
  cursor: pointer; font-weight: bold; transition: 0.2s;
}
.calc-keys button:hover { background: #93c5fd; }

.total-section { text-align: center; margin-top: 1px; font-weight: bold; font-size: 1.1rem; }

/* === Actions grid === */
.actions-grid {
  display: grid; grid-template-columns: repeat(5,1fr);
  gap: 8px; margin-top: 12px;
}
.actions-grid button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 600; border: none; color: #fff; border-radius: 12px;
  padding: 12px 0; cursor: pointer; transition: all 0.25s ease;
  font-size: 0.85rem; min-height: 80px; box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}
.actions-grid button i { font-size: 1.5rem; margin-bottom: 5px; }

#btnPrint { background: linear-gradient(135deg, #3b82f6, #2563eb); }
#btnRapport { background: linear-gradient(135deg, #8b5cf6, #6d28d9); position: relative; }
#btnReprendre { background: linear-gradient(135deg, #f59e0b, #d97706); }
#btnCredit { background: linear-gradient(135deg, #22c55e, #15803d); }
#btnValider { background: linear-gradient(135deg, #22c55e, #15803d); }
#btnVersement { background: linear-gradient(135deg, #ec4899, #db2777); }

.actions-grid button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

/* === Popup & Modals (inchangé) === */
.popup,
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  justify-content: center;
  align-items: center;
  z-index: 5000;
}
.popup.active,
.modal.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}
.popup-content,
.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 95%;
  max-width: 500px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  overflow-y: auto;
  max-height: 90vh;
}
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 15px;
}
.btn-x {
  background: none; border: none; font-size: 1.3rem;
  cursor: pointer; color: #475569;
}
.btn-x:hover { color: #dc2626; }

/* === Attente cards, badges, tickets (inchangé) === */
.attente-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 15px; }
.attente-card {
  background: linear-gradient(145deg,#f8fafc,#e0f2fe);
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  padding: 15px;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.attente-card:hover { transform: translateY(-4px); box-shadow: 0 6px 14px rgba(0,0,0,0.2); }
.attente-card.selected-card {
  background: linear-gradient(145deg,#dbeafe,#bfdbfe);
  border: 3px solid #1e3a8a; color: #1e3a8a;
  box-shadow: 0 0 12px rgba(30,58,138,0.5);
  transform: scale(1.05);
}
.badge-attente {
  background:#ef4444; color:white; font-size:0.8rem;
  font-weight:700; border-radius:50%; padding:3px 7px; min-width:22px;
  text-align:center; margin-left:4px; transition:all 0.3s ease;
  box-shadow:0 0 4px rgba(0,0,0,0.25);
}
.badge-attente.updated { transform:scale(1.2); background:#22c55e; }

/* === Boutons généraux === */
.btn-save { background:#16a34a; color:#fff; border:none; padding:10px; border-radius:6px; cursor:pointer; }
.btn-cancel { background:#dc2626; color:#fff; border:none; padding:8px; border-radius:6px; cursor:pointer; }
/* === Restauration des styles dédiés === */
/* Prend en charge les deux variantes d’ID (#btnTickets et #btnTicket) */
#btnTickets,
#btnTicket {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}
#btnTickets:hover,
#btnTicket:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
  transform: translateY(-2px);
}

/* Prend en charge les deux variantes d’ID (#searchTicket et #Sercheticket) */
#searchTicket,
#Sercheticket {
  width: 250px;
  padding: 8px 12px;
  border: 2px solid #2563eb;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: 0.3s;
  margin-left: 10px;
  background: #fff;
}
#searchTicket:focus,
#Sercheticket:focus {
  border-color: #1e40af;
  box-shadow: 0 0 4px rgba(37, 99, 235, 0.5);
}

/* Bouton de fermeture des popups */
.btn-close {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}
.btn-close:hover {
  background: #dc2626;
  transform: rotate(90deg) scale(1.1);
}
/* === 🧾 Cartes des Tickets du Jour === */
.ticket-card {
  background: #ffffff;
  border: 2px solid #d1d5db;        /* ✅ Encadrement gris clair */
  border-radius: 12px;              /* ✅ Coins arrondis */
  padding: 14px 12px;
  margin: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* ✅ Ombre douce */
  cursor: pointer;
  transition: all 0.25s ease;
}

.ticket-card:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 15px rgba(0,0,0,0.18);
  border-color: #2563eb;           /* 🔵 Bord bleu au survol */
}

/* === Titre du ticket === */
.ticket-card h4 {
  margin: 0;
  font-weight: 700;
  color: #1e3a8a;
  font-size: 1rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
}

/* === Texte informatif === */
.ticket-card p {
  margin: 6px 0;
  font-size: 0.9rem;
  color: #374151;
}

/* === ✅ Zone verte pour le total du ticket === */
/* ✅ Zone encadrée et colorée pour le total du ticket */
.ticket-total {
  display: block;
  background: linear-gradient(135deg, #22c55e, #16a34a); /* dégradé vert vif */
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  border-radius: 10px;
  padding: 8px 0;
  margin-top: 10px;
  font-size: 1.05rem;
  box-shadow: 0 3px 8px rgba(34, 197, 94, 0.45);
  border: 3px solid #14532d; /* ✅ encadrement vert foncé */
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
}

/* effet au survol */
.ticket-card:hover .ticket-total {
  transform: scale(1.03);
  box-shadow: 0 5px 12px rgba(21, 128, 61, 0.55);
  border-color: #0d9488; /* petit effet turquoise au hover */
}


/* === 🟦 Carte sélectionnée (clavier / souris) === */
.selected-card {
  border: 3px solid #2563eb !important;
  background: #f0f9ff !important;
  box-shadow: 0 0 12px rgba(37,99,235,0.5);
  transform: scale(1.05);
}

/* === ✅ Responsive propre === */
@media (max-width: 600px) {
  .ticket-card {
    font-size: 0.85rem;
    padding: 10px;
  }
  .ticket-total {
    font-size: 0.9rem;
    padding: 4px 0;
  }
}
/* === Popup Crédit / Règlement === */
#popupCredit .form-group,
#popupCredit .input-group {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  background: #f9fafb;
}

#popupCredit i { margin-right: 8px; color: #2563eb; }
#popupCredit input, 
#popupCredit select {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
}

#popupCredit h3 {
  text-align: center;
  color: #1e3a8a;
  margin-bottom: 15px;
}

/* === Modal client === */
#clientModalCredit .card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

#clientModalCredit .card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: 0.25s;
}

#clientModalCredit .card:hover {
  background: #dbeafe;
  border-color: #2563eb;
}
/* 🧾 Popup Versement - Style amélioré */
#popupVersement .modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 25px 20px;
  width: 95%;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-family: "Cairo", sans-serif;
}

#popupVersement h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e3a8a;
  text-align: center;
  margin-bottom: 20px;
}

#popupVersement .form-group,
#popupVersement .input-group {
  display: flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  background: #f9fafb;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

#popupVersement .form-group:focus-within,
#popupVersement .input-group:focus-within {
  border-color: #2563eb;
  background: #eef2ff;
}

#popupVersement i {
  color: #2563eb;
  margin-right: 10px;
  font-size: 1.1rem;
}

#popupVersement input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 500;
  color: #111827;
}

#popupVersement input::placeholder {
  color: #9ca3af;
}

/* === Boutons === */
#popupVersement .actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

#popupVersement .btn {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#popupVersement .btn-reset {
  background: #fee2e2;
  color: #b91c1c;
}

#popupVersement .btn-reset:hover {
  background: #ef4444;
  color: white;
}

#popupVersement .btn-submit {
  background: #2563eb;
  color: white;
}

#popupVersement .btn-submit:hover {
  background: #1d4ed8;
}

/* 📋 Sélecteur client modal */
#clientModalVersement .modal-content {
  max-width: 500px;
}

#clientModalVersement .card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 10px;
}

#clientModalVersement .card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

#clientModalVersement .card:hover {
  background: #dbeafe;
  border-color: #2563eb;
}
.panier-container {
  max-height: 260px;            /* 🔹 hauteur fixe selon ton design */
  overflow-y: auto;             /* 🔹 défilement vertical seulement */
  border: 2px solid #ddd;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fff;
}

/* garde l’en-tête visible quand on défile */
.panier-container thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  z-index: 2;
}

#panierTable {
  width: 100%;
  border-collapse: collapse;
}

#panierTable th, #panierTable td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

#panierTable tbody tr:hover {
  background: #f9fafb;
}

.calculatrice {
  position: sticky;             /* reste visible en bas */
  bottom: 0;
  background: #fafafa;
  padding: 10px;
  border-top: 2px solid #ddd;
  text-align: right;
}
/* ✅ Zone scrollable du tableau du panier */
.panier-table-wrapper {
  flex: 1;                        /* prend tout l’espace disponible */
  overflow-y: auto;               /* active le défilement vertical */
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  margin-top: 8px;
  background: #ffffff;
  scroll-behavior: smooth;
  max-height: 270px;              /* hauteur fixe du tableau */
}

.panier-table-wrapper thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  z-index: 5;
}

/* facultatif : améliore la lisibilité du scroll */
.panier-table-wrapper::-webkit-scrollbar {
  width: 8px;
}
.panier-table-wrapper::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}
.panier-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* === Responsive === */
@media(max-width:900px){ .pos-container{grid-template-columns:1fr; height:auto; overflow:auto;} .produits{max-height:none;} .panier{position:relative; height:auto;} }
@media(max-width:600px){
  .actions-grid{grid-template-columns:repeat(2,1fr);}
  .actions-grid button{font-size:0.8rem;min-height:70px;}
}


