/* Reset et base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* Container principal */
.cash-register {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* En-tête */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
  color: #2c3e50;
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.date-time {
  font-size: 1.2rem;
  color: #7f8c8d;
  font-weight: 500;
}

/* Contenu principal */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  height: calc(100vh - 140px);
}

/* Panneaux */
.left-panel,
.right-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow-y: auto;
}

/* Sections */
section {
  margin-bottom: 25px;
  padding: 15px;
  background: rgba(248, 249, 250, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

section h3 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 1.3rem;
  font-weight: 600;
  border-bottom: 2px solid #3498db;
  padding-bottom: 8px;
}

/* Grille de produits */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.product-btn {
  background: linear-gradient(145deg, #3498db, #2980b9);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 15px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
  text-align: center;
  line-height: 1.3;
}

.product-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
  background: linear-gradient(145deg, #2980b9, #3498db);
}

.product-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(52, 152, 219, 0.3);
}

/* Zone de ticket */
.receipt {
  background: white;
  border: 2px solid #bdc3c7;
  border-radius: 8px;
  padding: 15px;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.store-info {
  text-align: center;
  margin-bottom: 10px;
  color: #2c3e50;
}

.receipt-items {
  min-height: 200px;
  margin: 10px 0;
}

.receipt-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px dotted #bdc3c7;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.receipt-footer {
  border-top: 2px solid #2c3e50;
  padding-top: 10px;
  margin-top: 10px;
}

/* Affichage principal */
.main-display {
  background: linear-gradient(145deg, #2c3e50, #34495e);
  color: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(44, 62, 80, 0.3);
}

.display-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.display-line:last-child {
  border-bottom: none;
}

.total-line {
  font-size: 1.3rem;
  font-weight: 700;
  background: rgba(231, 76, 60, 0.2);
  margin: 10px -10px -10px -10px;
  padding: 15px 20px;
  border-radius: 0 0 12px 12px;
}

.amount {
  font-weight: 600;
  font-size: 1.1rem;
}

.total {
  color: #e74c3c;
  font-size: 1.4rem !important;
}

/* Formulaires */
.entry-form,
.discount-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.input-field {
  padding: 12px;
  border: 2px solid #bdc3c7;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.input-field:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
  transform: translateY(-1px);
}

/* Clavier numérique */
.numpad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 300px;
}

.numpad-btn {
  background: linear-gradient(145deg, #ecf0f1, #bdc3c7);
  border: none;
  border-radius: 8px;
  padding: 15px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  color: #2c3e50;
}

.numpad-btn:hover {
  background: linear-gradient(145deg, #bdc3c7, #95a5a6);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.numpad-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.clear-btn {
  background: linear-gradient(145deg, #e74c3c, #c0392b) !important;
  color: white !important;
}

.enter-btn {
  background: linear-gradient(145deg, #27ae60, #229954) !important;
  color: white !important;
}

.zero-btn {
  grid-column: span 2;
}

/* Boutons */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(145deg, #3498db, #2980b9);
  color: white;
}

.btn-secondary {
  background: linear-gradient(145deg, #95a5a6, #7f8c8d);
  color: white;
}

/* .btn-success {
    background: linear-gradient(145deg, #27ae60, #229954);
    color: white;
} */

/* .btn-warning {
  background: linear-gradient(145deg, #f39c12, #e67e22);
  color: white;
} */
/* 
.btn-danger {
  background: linear-gradient(145deg, #e74c3c, #c0392b);
  color: white;
} */

.btn-info {
  background: linear-gradient(145deg, #17a2b8, #138496);
  color: white;
}

/* Contrôles de paiement */
.payment-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.payment-btn {
  font-size: 0.9rem;
  padding: 15px 10px;
}

.cash-payment {
  margin-top: 15px;
  padding: 15px;
  background: rgba(39, 174, 96, 0.1);
  border-radius: 8px;
  border: 2px solid #27ae60;
}

.change-display {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  color: #27ae60;
  text-align: center;
}

/* Actions principales */
.action-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* Historique */
.history-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.history-summary {
  background: rgba(52, 152, 219, 0.1);
  padding: 15px;
  border-radius: 8px;
  border: 2px solid #3498db;
}

.history-summary div {
  margin-bottom: 5px;
  font-weight: 600;
}

/* Modales */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 80%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover {
  color: #e74c3c;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .header h1 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .cash-register {
    padding: 10px;
  }

  .header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .header h1 {
    font-size: 1.8rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .entry-form,
  .discount-controls {
    grid-template-columns: 1fr;
  }

  .payment-controls {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }

  .history-controls {
    flex-direction: column;
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .numpad {
    max-width: 100%;
  }

  .numpad-btn {
    padding: 12px;
    font-size: 1rem;
  }

  section {
    padding: 10px;
  }

  .left-panel,
  .right-panel {
    padding: 15px;
  }
}

/* Animations supplémentaires */
.btn,
.product-btn,
.numpad-btn {
  position: relative;
  overflow: hidden;
}

.btn::before,
.product-btn::before,
.numpad-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before,
.product-btn:active::before,
.numpad-btn:active::before {
  width: 300px;
  height: 300px;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(145deg, #3498db, #2980b9);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(145deg, #2980b9, #3498db);
}

/* Styles pour la gestion des produits */
.product-management {
  background: rgba(52, 152, 219, 0.1);
  border: 2px solid #3498db;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
}

.product-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.input-field-small {
  width: 95%;
  padding: 8px;
  border: 2px solid #bdc3c7;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  background: white;
}

.input-field-small:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
  transform: translateY(-1px);
}

.btn-small {
  padding: 8px 8px;
  font-size: 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.product-instructions {
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
}

.product-instructions small {
  font-size: 0.8rem;
}

/* Sélection de produit pour suppression */
.product-btn.selected {
  background: linear-gradient(145deg, #e74c3c, #c0392b) !important;
  color: white !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3) !important;
  transform: scale(0.95);
}

.product-btn.selected:hover {
  background: linear-gradient(145deg, #c0392b, #e74c3c) !important;
}

/* Responsive pour la gestion des produits */
@media (max-width: 768px) {
  .product-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-small {
    width: 100%;
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .product-management {
    padding: 10px;
  }

  .input-field-small {
    font-size: 0.85rem;
    padding: 10px;
  }
}
