/* ============================================ */
/* VARIABLES - THÈME VIOLET */
/* ============================================ */
:root {
  /* Couleurs principales - VIOLET */
  --primary-color: #9C27B0;
  --secondary-color: #e67e22;
  --primary-light: #BA68C8;
  --primary-dark: #7B1FA2;
  --secondary-light: #f39c12;
  --secondary-dark: #d35400;
  
  /* Backgrounds */
  --background-dark: #121212;
  --background-light: #1E1E1E;
  --card-background: #2A2A2A;
  --dark-surface: #2c2c2e;
  --dark-surface-hover: #3a3a3c;
  
  /* Textes */
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0A0;
  --text-tertiary: rgba(255, 255, 255, 0.5);
  
  /* Bordures et ombres */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-radius: 12px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.3);
  
  /* Status colors */
  --success-color: #4CAF50;
  --error-color: #e74c3c;
  --warning-color: #f39c12;
  --info-color: #3498db;
  
  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================ */
/* RESET ET BASE */
/* ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--background-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================ */
/* CONTAINER PRINCIPAL */
/* ============================================ */
.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* ============================================ */
/* HEADER */
/* ============================================ */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.admin-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.header-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ============================================ */
/* BOUTONS */
/* ============================================ */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

button:active {
  transform: translateY(0);
}

.logout {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.logout:hover {
  background: var(--error-color);
  border-color: var(--error-color);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ============================================ */
/* ONGLETS MODERNES */
/* ============================================ */
.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

.tabs button {
  flex: 1;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  position: relative;
  transition: var(--transition);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.tabs button::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  transform: scaleX(0);
  transition: var(--transition);
  border-radius: 3px 3px 0 0;
}

.tabs button:hover {
  color: var(--primary-color);
  background: rgba(156, 39, 176, 0.05);
  transform: translateY(-2px);
}

.tabs button.active {
  color: var(--primary-color);
  font-weight: 600;
  background: rgba(156, 39, 176, 0.1);
}

.tabs button.active::after {
  transform: scaleX(1);
}

.icon {
  display: inline-block;
  font-size: 1.2em;
}

/* ============================================ */
/* CONTENU DES ONGLETS */
/* ============================================ */
.tab-content {
  display: none;
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.tab-content.active {
  display: block;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-header {
  margin-bottom: 2rem;
}

.tab-content h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tab-content h3 {
  font-size: 1.35rem;
  color: var(--text-primary);
  margin: 2rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.section-header p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* ============================================ */
/* PROFIL */
/* ============================================ */
.profile-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.profile-card {
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.1), rgba(156, 39, 176, 0.05));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.profile-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(156, 39, 176, 0.4);
  flex-shrink: 0;
}

.profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.profile-field:hover {
  padding-left: 0.5rem;
  background: rgba(156, 39, 176, 0.05);
  border-radius: 8px;
}

.profile-field .field-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.profile-field .field-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================ */
/* STATISTIQUES */
/* ============================================ */
.stats-container {
  display: grid;
  gap: 1.5rem;
}

.stat-card {
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(156, 39, 176, 0.05));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.stat-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(156, 39, 176, 0.3));
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================ */
/* HISTORIQUE DES BILLETS */
/* ============================================ */
.ticket-history {
  overflow-x: auto;
  border-radius: var(--border-radius);
  -webkit-overflow-scrolling: touch;
}

.ticket-history table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 1rem;
}

.ticket-history th {
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.2), rgba(156, 39, 176, 0.1));
  padding: 1rem;
  text-align: left;
  color: var(--primary-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--primary-color);
}

.ticket-history td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.ticket-history tr:hover td {
  background: rgba(156, 39, 176, 0.05);
}

/* ============================================ */
/* JEUX CONCOURS */
/* ============================================ */
.contest-code-section {
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(156, 39, 176, 0.05));
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  padding: 2rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.code-input-container {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
  margin: 1.5rem 0;
}

.code-input-container input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--background-dark);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
}

.code-input-container input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.2);
}

.code-input-container button {
  border-radius: var(--border-radius);
  white-space: nowrap;
}

.contests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.contest-card {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.contest-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
}

.contest-header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(156, 39, 176, 0.05));
  border-bottom: 1px solid var(--border-color);
}

.contest-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--primary-color);
  font-weight: 600;
}

.contest-status {
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-active {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success-color);
}

.status-upcoming {
  background: rgba(52, 152, 219, 0.2);
  color: var(--info-color);
}

.status-ended {
  background: rgba(231, 76, 60, 0.2);
  color: var(--error-color);
}

.status-participated {
  background: rgba(156, 39, 176, 0.2);
  color: #9c27b0;
}

.contest-body {
  padding: 1.5rem;
}

.contest-details {
  margin-top: 1rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 600;
}

.contest-footer {
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
}

.btn-participate {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.btn-participate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

.btn-participate:disabled {
  background: var(--card-background);
  cursor: not-allowed;
  transform: none;
  opacity: 0.5;
  box-shadow: none;
}

.btn-participate.already-participated {
  background: linear-gradient(135deg, #9c27b0, #7b1fa2);
  opacity: 0.8;
}

/* Badge "Déjà joué" */
.contest-card.status-participated::before {
  content: "Déjà joué";
  position: absolute;
  top: 15px;
  right: -35px;
  background: linear-gradient(135deg, #9c27b0, #7b1fa2);
  color: white;
  padding: 5px 40px;
  transform: rotate(45deg);
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================ */
/* MES GAINS / RÉCOMPENSES */
/* ============================================ */
.rewards-container {
  margin-top: 2rem;
}

.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.reward-card {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.reward-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.reward-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(156, 39, 176, 0.05));
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.contest-icon {
  font-size: 2rem;
  background: var(--primary-color);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
  flex-shrink: 0;
}

.reward-name {
  margin: 0;
  font-size: 1.25rem;
  color: var(--primary-color);
  font-weight: 600;
  flex: 1;
}

.reward-body {
  padding: 1.5rem;
}

.reward-details .detail-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.reward-details .detail-item:last-child {
  border-bottom: none;
}

/* ============================================ */
/* FORMULAIRES */
/* ============================================ */
form {
  margin-top: 1.5rem;
}

.form-section {
  background: rgba(156, 39, 176, 0.05);
  border: 1px solid var(--border-color);
  padding: 2rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

select, input, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--background-dark);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  transition: var(--transition);
  font-size: 1rem;
}

select:focus, input:focus, textarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.2);
}

.form-hint {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-top: -1rem;
  margin-bottom: 1rem;
  font-style: italic;
}

.form-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
}

/* ============================================ */
/* ÉTATS ET MESSAGES */
/* ============================================ */
.status-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  font-weight: 500;
}

.status-success {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success-color);
  border-left: 4px solid var(--success-color);
}

.status-error {
  background: rgba(231, 76, 60, 0.2);
  color: var(--error-color);
  border-left: 4px solid var(--error-color);
}

.status-pending {
  background: rgba(243, 156, 18, 0.2);
  color: var(--warning-color);
  border-left: 4px solid var(--warning-color);
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  animation: pulse 1.5s infinite;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.05), rgba(156, 39, 176, 0.02));
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  margin: 2rem 0;
}

.empty-state .icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 1.5rem;
  opacity: 0.5;
  filter: grayscale(1);
}

.error-state {
  text-align: center;
  padding: 2rem;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--border-radius);
  color: var(--error-color);
  margin: 2rem 0;
}

.error-state button {
  margin-top: 1.5rem;
  background: var(--error-color);
}

.error-state button:hover {
  background: #c0392b;
}

/* ============================================ */
/* ANIMATIONS */
/* ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* ============================================ */
/* RESPONSIVE DESIGN - MOBILE */
/* ============================================ */

/* Petits mobiles */
@media (max-width: 480px) {
  body {
    padding: 0.5rem;
  }

  .admin-container {
    padding: 1rem;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .admin-header h1 {
    font-size: 1.75rem;
  }

  .header-buttons {
    width: 100%;
    flex-direction: column;
  }

  .header-buttons button {
    width: 100%;
  }

  .tabs {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tabs button {
    width: 100%;
    text-align: left;
  }

  .tabs button::after {
    display: none;
  }

  .tab-content {
    padding: 1rem;
  }

  .profile-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .code-input-container {
    flex-direction: column;
  }

  .code-input-container input,
  .code-input-container button {
    width: 100%;
  }

  .contests-grid,
  .rewards-grid {
    grid-template-columns: 1fr;
  }

  .ticket-history {
    font-size: 0.85rem;
  }

  .ticket-history th,
  .ticket-history td {
    padding: 0.5rem;
  }

  input, select, textarea, button {
    font-size: 16px !important;
  }
}

/* Mobiles standards */
@media (max-width: 768px) {
  .admin-container {
    padding: 1.5rem;
  }

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

  .profile-container {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .contests-grid,
  .rewards-grid {
    grid-template-columns: 1fr;
  }

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

  .form-actions button {
    width: 100%;
  }
}

/* Tablettes */
@media (min-width: 769px) and (max-width: 1024px) {
  .contests-grid,
  .rewards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Anti-débordement global */
* {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body {
  overflow-x: hidden;
}

.admin-container {
  max-width: 100%;
  overflow-x: hidden;
}
