/* =====================================================
   CSS UNIFIÉ POUR TOUTE LA SECTION UTILISATEUR
   (Connexion, Inscription, Contact, Profil, Panier, Historique)
   ===================================================== */

/* ---- Conteneur de base pour centrer les contenus ---- */
.user-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 85vh;
  padding: 2rem 1rem;
}

/* ---- Carte "Verre Dépoli" (pour formulaires et sections) ---- */
.user-card {
  width: 100%;
  max-width: 800px;
  padding: 2rem 2.5rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* ---- Ajustements pour les formulaires (plus étroits) ---- */
.form-card {
  max-width: 450px;
  align-self: center;
}

.contact-card { 
  max-width: 600px; 
}

/* ---- Titres et sous-titres ---- */
.user-card h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  text-align: center;
}

.user-card .subtitle {
  margin-bottom: 1.5rem;
  color: #f0f0f0;
  font-size: 1rem;
  text-align: center;
}

/* ---- Styles de formulaire (réutilisés) ---- */
.form-group { 
  margin-bottom: 1.25rem; 
  text-align: left; 
}

.form-group label { 
  display: block; 
  margin-bottom: 0.5rem; 
  font-weight: bold; 
  font-size: 0.9rem; 
  color: #f0f0f0; 
}

.form-control { 
  width: 100%; 
  padding: 12px 15px; 
  border: 1px solid rgba(255, 255, 255, 0.3); 
  border-radius: 8px; 
  font-size: 1rem; 
  color: #ffffff; 
  background: rgba(255, 255, 255, 0.15); 
  transition: border-color 0.3s, background-color 0.3s; 
}

.form-control::placeholder { 
  color: rgba(255, 255, 255, 0.6); 
}

.form-control:focus { 
  outline: none; 
  background: rgba(255, 255, 255, 0.2); 
  border-color: #ffd700; 
}

textarea.form-control { 
  resize: vertical; 
  min-height: 120px; 
}

/* Style général pour les champs de texte, email, tel, textarea */
.form-control {
  width: 100%;
  background-color: #333;
  color: #fff;
  border: 1px solid #555;
  padding: 12px;
  border-radius: 5px;
  box-sizing: border-box;
  margin-top: 5px;
}

/* Style spécifique pour les menus déroulants (select) */
.custom-select {
  width: 100%;
  background-color: #333;
  color: #fff;
  border: 1px solid #555;
  padding: 12px;
  border-radius: 5px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  background-size: 16px;
  box-sizing: border-box;
  margin-top: 5px;
}

/* Style quand un champ de formulaire est sélectionné (focus) */
.form-control:focus,
.custom-select:focus {
  outline: none;
  border-color: #ffd700;
  box-shadow: 0 0 0 0.2rem rgba(255, 215, 0, 0.25);
}

/* Style pour les labels (le texte au-dessus des champs) */
.form-group label {
  font-weight: 500;
  font-size: 0.9rem;
  color: #ccc;
}

/* S'assure que les textareas ont aussi le bon style */
textarea.form-control {
  resize: vertical;
}

/* ---- Boutons ---- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
}

.btn-primary { 
  background: #ffd700; 
  color: #111; 
}

.btn-primary:hover { 
  background: #e0c000; 
  transform: scale(1.03); 
}

.btn-secondary { 
  background: rgba(255, 255, 255, 0.2); 
  color: #fff; 
}

.btn-secondary:hover { 
  background: rgba(255, 255, 255, 0.3); 
}

.btn-danger { 
  background: #e74c3c; 
  color: #fff; 
}

.btn-danger:hover { 
  background: #c0392b; 
}

.btn-full { 
  width: 100%; 
  padding: 12px; 
  font-size: 1.1rem; 
  margin-top: 0.5rem; 
}

/* ---- Liens (utilisés dans les formulaires) ---- */
.auth-links { 
  margin-top: 1.5rem; 
  font-size: 0.9rem; 
  text-align: center; 
}

.auth-links p { 
  margin-bottom: 0.5rem; 
}

.auth-links a { 
  color: #110f0f; 
  text-decoration: none; 
  font-weight: bold; 
  transition: color 0.3s; 
}

.auth-links a:hover { 
  color: #ffd700; 
  text-decoration: underline; 
}

/* ---- Messages de formulaire (pour JS) ---- */
.form-message { 
  font-weight: bold; 
  margin-top: 1rem; 
  min-height: 1.2em; 
  text-align: center; 
}

.form-message.error { 
  color: #ff4d4d; 
}

.form-message.success { 
  color: #7eff7e; 
}

/* =================================
   STYLES SPÉCIFIQUES AUX PAGES
   ================================= */

/* ---- Page Profil ---- */
.profile-info { 
  text-align: left; 
  margin-bottom: 2rem; 
}

.profile-info p { 
  margin: 10px 0; 
  font-size: 1.1rem; 
  color: #f0f0f0; 
}

.profile-info strong { 
  color: #fff; 
  font-weight: 600; 
}

.profile-actions { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 1rem; 
  justify-content: center; 
  margin-top: 1.5rem; 
}

.profile-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
}

/* ---- Page Panier & Historique (Tableaux) ---- */
.table-container { 
  width: 100%; 
  overflow-x: auto; 
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  table-layout: fixed;
}

.user-table th, .user-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  color: #f0f0f0;
  word-wrap: break-word;
}

.user-table th {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-weight: bold;
  text-align: center;
}

.user-table td { 
  text-align: center; 
}

.user-table tr:hover td { 
  background: rgba(255, 255, 255, 0.1); 
}

.panier-actions { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  flex-wrap: wrap; 
  gap: 1rem; 
  margin-top: 1.5rem; 
}

/* =================================
   STYLES POUR LES BADGES DE STATUT DANS L'HISTORIQUE
   ================================= */
.status-badge {
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #fff;
  text-align: center;
  white-space: nowrap;
}

/* Statut "En attente" (Jaune) - Utilisé pour les commandes ET les recharges */
.status-badge.status-pending {
  background-color: #ffc107;
  color: #333;
}

/* Statut "Validée" (Bleu) - Spécifique aux commandes */
.status-badge.status-validated {
  background-color: #007bff;
}

/* Statut "Terminée / Approuvée / Livrée" (Vert) - Utilisé pour les commandes ET les recharges */
.status-badge.status-completed {
  background-color: #28a745;
}

/* Statut "Annulée / Rejetée" (Rouge) - Utilisé pour les commandes ET les recharges */
.status-badge.status-cancelled {
  background-color: #dc3545;
}

/* Statut par défaut (Gris) - Pour tout cas non prévu */
.status-badge.status-default {
  background-color: #6c757d;
}

/* =================================
   STYLES POUR LE SÉLECTEUR DE DEVISE
   ================================= */
#currency-display-container {
  position: static;
  display: flex;
  gap: 10px;
}

.switcher-wrapper {
  position: relative;
}

.currency-display-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.currency-display-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #ffd700;
}

.currency-display-btn strong {
  color: #ffd700;
}

.currency-options-list {
  position: absolute;
  top: 110%;
  right: 0;
  background: #3a3a3a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  width: 180px;
  z-index: 10;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease-in-out;
}

.currency-options-list.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.currency-option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.currency-option-item:hover {
  background-color: rgba(255, 215, 0, 0.15);
}

.currency-option-item:first-child {
  border-radius: 12px 12px 0 0;
}

.currency-option-item:last-child {
  border-radius: 0 0 12px 12px;
}

.currency-logo {
  width: 28px;
  height: 28px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #ffd700;
  font-size: 1rem;
}

.currency-option-item span {
  color: #f0f0f0;
  font-weight: 500;
}

/* =================================
   STYLES POUR LES POP-UPS (MODALES)
   ================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: block;
  opacity: 1;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 1001;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 1rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  text-align: center;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.modal .close-button {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2.5rem;
  font-weight: 300;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.modal .close-button:hover {
  color: #fff;
  transform: scale(1.1);
}

/* Options de paiement dans la pop-up */
.payment-options {
  display: grid;
  gap: 1rem;
}

.payment-option {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  color: #f0f0f0;
  font-weight: bold;
}

.payment-option:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-5px);
}

/* Séparateur dans la pop-up */
.payment-divider {
  margin: 1.5rem 0;
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.payment-section h4 {
  color: #f0f0f0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  text-align: left;
}

/* Bouton pour fermer la pop-up */
.close-modal {
  margin-top: 1.5rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* =================================
   RESPONSIVE DESIGN
   ================================= */
@media (max-width: 768px) {
  .user-card { 
    padding: 1.5rem; 
  }
  
  .user-card h2 { 
    font-size: 1.6rem; 
  }
  
  .user-table th, .user-table td { 
    font-size: 0.9rem; 
    padding: 10px 6px; 
  }
  
  .profile-header-container {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  #currency-display-container {
    align-self: flex-start;
  }
}

@media (max-width: 480px) {
  .user-card { 
    padding: 1.5rem 1rem; 
  }
  
  .panier-actions { 
    justify-content: center; 
  }
  
  .profile-actions {
    flex-direction: column;
  }
  
  .modal {
    padding: 1.5rem;
  }
}