/* =================================================================
   AFFILIATE DASHBOARD CSS - Mobile First Design
   Tableau de Bord Affilié pour iMagin.K
================================================================= */

/* Variables CSS (à définir dans le fichier principal si pas déjà fait) */
:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --accent-color: #17a2b8;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  --light-bg: #f8f9fa;
  --dark-text: #343a40;
  --white: #ffffff;
  --light-gray: #e9ecef;
}

/* =================================================================
   EN-TÊTE DE PAGE
================================================================= */

.display-5 {
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.lead {
  color: var(--secondary-color);
  font-size: 1.1rem;
  font-weight: 400;
}

/* Responsive pour l'en-tête */
@media (max-width: 768px) {
  .display-5 {
    font-size: 2.2rem;
    text-align: center;
  }
  
  .lead {
    text-align: center;
    font-size: 1rem;
  }
}

/* =================================================================
   CARTE PRINCIPALE - LIEN D'AFFILIATION
================================================================= */

.card.border-primary {
  border: 2px solid var(--primary-color) !important;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 123, 255, 0.15);
  margin-bottom: 2rem;
  overflow: hidden;
}

.card.border-primary .card-header {
  background: linear-gradient(135deg, var(--primary-color), #0056b3) !important;
  border-bottom: none;
  padding: 1.2rem 1.5rem;
}

.card.border-primary .card-header .card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--white);
}

.card.border-primary .card-body {
  padding: 1.8rem 1.5rem;
  background: var(--white);
}

/* Input du lien d'affiliation */
#affiliateLink {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 1rem;
  font-weight: 500;
  background-color: var(--light-bg);
  border: 2px solid var(--light-gray);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

#affiliateLink:focus {
  background-color: var(--white);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
  outline: none;
}

/* Bouton Copier */
#copyBtn {
  background: linear-gradient(135deg, var(--primary-color), #0056b3);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
  position: relative;
  overflow: hidden;
}

#copyBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

#copyBtn:hover::before {
  left: 100%;
}

#copyBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

#copyBtn:active {
  transform: translateY(0);
}

/* État succès du bouton */
#copyBtn.btn-success {
  background: linear-gradient(135deg, var(--success-color), #1e7e34) !important;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

/* Message d'info */
.card.border-primary small {
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin-top: 0.8rem;
}

/* Responsive pour la carte principale */
@media (max-width: 768px) {
  .card.border-primary .row {
    flex-direction: column;
    gap: 1rem;
  }
  
  .card.border-primary .col-md-10,
  .card.border-primary .col-md-2 {
    flex: 1;
    max-width: 100%;
  }
  
  #affiliateLink {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
}

/* =================================================================
   CARTES DE KPIs
================================================================= */

.row.g-4 .col-md-3 {
  display: flex;
  margin-bottom: 1.5rem;
}

.row.g-4 .card {
  flex: 1;
  border: none;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
}

.row.g-4 .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.row.g-4 .card:hover::before {
  transform: scaleX(1);
}

.row.g-4 .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.row.g-4 .card-body {
  padding: 2rem 1.5rem;
  text-align: center;
}

/* Icônes des KPIs */
.row.g-4 .card .fa-3x {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.row.g-4 .card:hover .fa-3x {
  transform: scale(1.1) rotate(5deg);
}

/* Couleurs spécifiques pour chaque KPI */
.row.g-4 .card .text-primary {
  color: var(--primary-color) !important;
}

.row.g-4 .card .text-success {
  color: var(--success-color) !important;
}

.row.g-4 .card .text-warning {
  color: var(--warning-color) !important;
}

.row.g-4 .card .text-info {
  color: var(--info-color) !important;
}

/* Titres des KPIs */
.row.g-4 .card .card-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.row.g-4 .card .card-text {
  color: var(--secondary-color);
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
}

/* Responsive pour les KPIs */
@media (max-width: 992px) {
  .row.g-4 .col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (max-width: 576px) {
  .row.g-4 .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .row.g-4 .card .card-title {
    font-size: 1.8rem;
  }
  
  .row.g-4 .card .fa-3x {
    font-size: 2rem;
  }
}

/* =================================================================
   TABLEAU HISTORIQUE DES COMMISSIONS
================================================================= */

.card.shadow-sm {
  border-radius: 12px;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.card.shadow-sm .card-header {
  background-color: var(--light-bg);
  border-bottom: 2px solid var(--light-gray);
  padding: 1.2rem 1.5rem;
}

.card.shadow-sm .card-header .card-title {
  color: var(--dark-text);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

/* En-tête du tableau */
.table thead.table-dark {
  background: linear-gradient(135deg, var(--primary-color), #0056b3) !important;
}

.table thead.table-dark th {
  color: var(--white) !important;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 1rem;
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Corps du tableau */
.table tbody tr {
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--light-gray);
}

.table tbody tr:hover {
  background-color: #f8f9ff;
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.table tbody td {
  padding: 1rem;
  vertical-align: middle;
  font-size: 0.95rem;
}

/* Badges de statut dans le tableau */
.table .badge {
  font-size: 0.8rem;
  padding: 0.5rem 0.8rem;
  font-weight: 500;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.table .badge.bg-success {
  background-color: var(--success-color) !important;
  color: var(--white);
}

.table .badge.bg-warning {
  background-color: var(--warning-color) !important;
  color: #856404;
}

.table .badge.bg-light {
  background-color: var(--light-bg) !important;
  color: var(--dark-text);
  border: 1px solid var(--light-gray);
}

/* Montants en euros */
.table .fw-bold.text-success {
  color: var(--success-color) !important;
  font-size: 1.05rem;
  font-weight: 600;
}

/* Section vide du tableau */
.table tbody td[colspan="4"] {
  padding: 3rem 2rem;
  text-align: center;
}

.table tbody .text-muted .fa-3x {
  color: var(--secondary-color);
  opacity: 0.6;
  margin-bottom: 1rem;
}

.table tbody .text-muted h5 {
  color: var(--dark-text);
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.table tbody .text-muted p {
  color: var(--secondary-color);
  font-size: 0.95rem;
  margin: 0;
}

/* Responsive pour le tableau */
@media (max-width: 768px) {
  .table-responsive {
    border-radius: 12px;
  }
  
  .table thead th,
  .table tbody td {
    padding: 0.8rem 0.5rem;
    font-size: 0.85rem;
  }
  
  .table .badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }
}

/* =================================================================
   SECTION CONSEILS
================================================================= */

.card.border-info {
  border: 2px solid var(--accent-color) !important;
  border-radius: 12px;
  background-color: var(--white);
  box-shadow: 0 3px 15px rgba(23, 162, 184, 0.1);
}

.card.border-info .card-body {
  padding: 2rem;
  background: linear-gradient(135deg, #f8fdff, var(--white));
}

.card.border-info .card-title {
  color: var(--accent-color);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.card.border-info .card-title .fa-lightbulb {
  color: var(--warning-color);
}

/* Colonnes des conseils */
.card.border-info .row .col-md-4 {
  margin-bottom: 1.5rem;
}

.card.border-info h6 {
  color: var(--dark-text);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.card.border-info .small {
  color: var(--secondary-color);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

/* Responsive pour les conseils */
@media (max-width: 768px) {
  .card.border-info .card-body {
    padding: 1.5rem;
  }
  
  .card.border-info .row .col-md-4 {
    margin-bottom: 1rem;
  }
}

/* =================================================================
   ANIMATIONS CSS
================================================================= */

/* Animation fadeInUp */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation pour les compteurs */
@keyframes countUp {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Animation bounce */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Animation pulse */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Classes d'animation */
.fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

.count-up {
  animation: countUp 0.8s ease forwards;
}

.bounce-in {
  animation: bounce 1s ease;
}

.pulse-effect {
  animation: pulse 0.5s ease;
}

/* États initiaux pour les animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* Délais pour l'effet cascade */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* =================================================================
   EFFETS SPÉCIAUX
================================================================= */

/* Gradient animé pour les cartes importantes */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-animated {
  background: linear-gradient(-45deg, var(--primary-color), var(--accent-color), var(--success-color), var(--primary-color));
  background-size: 400% 400%;
  animation: gradientShift 4s ease infinite;
}

/* Effet de surbrillance */
.highlight-on-hover {
  position: relative;
  overflow: hidden;
}

.highlight-on-hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
  z-index: 1;
}

.highlight-on-hover:hover::before {
  left: 100%;
}

/* =================================================================
   UTILITAIRES RESPONSIVE
================================================================= */

@media (max-width: 576px) {
  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .py-4 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  .mb-5 {
    margin-bottom: 2rem !important;
  }
}

/* Amélioration de l'accessibilité */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}