/**
 * 🎨 STYLES COMMANDES AVANCÉES
 * =============================
 */

/* Conteneur principal */
#commandesContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

/* Card commande */
.commande-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  border: 2px solid transparent;
}

.commande-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Header */
.commande-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.commande-info h3 {
  margin: 0 0 8px 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.commande-date {
  display: inline-block;
  font-size: 0.9rem;
  opacity: 0.95;
}

.commande-date i {
  margin-right: 6px;
}

.status-badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.status-badge.en_attente { background: var(--warning); }
.status-badge.acceptee,
.status-badge.terminee { background: var(--success); }
.status-badge.en_preparation { background: var(--info); }
.status-badge.prete { background: var(--secondary); }
.status-badge.annulee { background: var(--error); }

.badge-reorder {
  display: inline-block;
  background: var(--warning);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 10px;
}

/* Body */
.commande-body {
  padding: 20px;
}

.commande-plat-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 16px;
}

.commande-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plat-nom {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
}

.commande-details p {
  margin: 0;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
}

.commande-details p i {
  color: var(--primary);
  width: 20px;
}

.commande-details strong {
  color: #333;
  font-weight: 600;
}

.quantite strong, .prix strong {
  color: var(--primary);
}

.commentaire-client {
  background: #f0f4ff;
  border-left: 4px solid var(--primary);
  padding: 12px;
  border-radius: 8px;
  font-style: italic;
  color: #555;
  margin-top: 8px;
}

.commentaire-client i {
  color: var(--primary);
  margin-right: 8px;
}

.client-info {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 8px;
  font-weight: 500;
}

/* Actions */
.commande-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
}

.btn-action {
  flex: 1;
  min-width: 120px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-action i {
  font-size: 0.95rem;
}

.btn-timeline {
  background: #E3F2FD;
  color: var(--info);
  border: 2px solid var(--info);
}

.btn-timeline:hover {
  background: var(--info);
  color: white;
}

.btn-confirm {
  background: linear-gradient(135deg, var(--success), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(6, 193, 103, 0.24);
}

.btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(6, 193, 103, 0.28);
}

.btn-cancel {
  background: #FFEBEE;
  color: var(--error);
  border: 2px solid var(--error);
}

.btn-cancel:hover {
  background: var(--error);
  color: white;
}

.btn-modify {
  background: var(--warning-soft, #FEF3C7);
  color: var(--warning);
  border: 2px solid var(--warning);
}

.btn-modify:hover {
  background: var(--warning);
  color: white;
}

.btn-comment {
  background: var(--secondary-light);
  color: var(--secondary-dark);
  border: 2px solid var(--secondary-dark);
}

.btn-comment:hover {
  background: var(--secondary-dark);
  color: white;
}

.btn-reorder {
  background: linear-gradient(135deg, var(--warning), #B45309);
  color: white;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.24);
}

.btn-reorder:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

/* Info boxes */
.confirmation-info,
.cancellation-info {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  border-top: 1px solid #e0e0e0;
}

.confirmation-info {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.confirmation-info i {
  font-size: 1.2rem;
  color: var(--success);
}

.cancellation-info {
  background: #FFEBEE;
  color: var(--error);
}

.cancellation-info i {
  font-size: 1.2rem;
  color: var(--error);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s;
}

.modal-content h2 {
  margin: 0 0 24px 0;
  color: #333;
  font-size: 1.6rem;
}

.modal-content h2 i {
  color: var(--primary);
  margin-right: 10px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(6, 193, 103, 0.4);
}

.btn-secondary {
  background: #f0f0f0;
  color: #555;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-danger {
  background: linear-gradient(135deg, var(--error), #B91C1C);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

/* Timeline */
.modal-timeline {
  max-width: 800px;
}

.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
}

.timeline-item {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  position: relative;
}

.timeline-marker {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(6, 193, 103, 0.4);
  z-index: 1;
}

.timeline-content {
  flex: 1;
  background: #f8f9fa;
  padding: 16px 20px;
  border-radius: 12px;
  border-left: 4px solid var(--primary);
}

.timeline-status {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: #333;
}

.timeline-status strong {
  color: var(--primary);
  font-weight: 700;
}

.timeline-date {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 4px;
}

.timeline-user {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
}

/* Filtres */
.filters-bar {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.filters-bar label {
  font-weight: 600;
  color: #555;
}

#filterStatus {
  padding: 10px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  background: white;
}

#filterStatus:focus {
  outline: none;
  border-color: var(--primary);
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  color: #ddd;
}

.empty-state p {
  font-size: 1.2rem;
  margin: 0;
}

/* Notifications */
.notification {
  position: fixed;
  bottom: -100px;
  right: 24px;
  background: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 10001;
  transition: bottom 0.3s;
  min-width: 300px;
  font-weight: 500;
}

.notification.show {
  bottom: 24px;
}

.notification-success {
  border-left: 4px solid var(--success);
  color: var(--primary-dark);
}

.notification-error {
  border-left: 4px solid var(--error);
  color: var(--error);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  #commandesContainer {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .commande-actions {
    flex-direction: column;
  }

  .btn-action {
    width: 100%;
  }

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

  .timeline::before {
    left: 20px;
  }

  .timeline-marker {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}
