/* =========================================
   1. BOUTONS
   ========================================= */
.btn {
  height: var(--ui-height);
  border-radius: var(--radius-md);
  padding: 0 24px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
}

/* --- Bouton Principal --- */
.btn-primary {
  background: var(--primary-gradient);
  color: var(--white) !important;
  border: 1px solid rgba(255, 255, 255, 0.1); 
  box-shadow: var(--shadow-primary-glow), var(--shadow-md);
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary-glow), var(--shadow-hover);
}

/* --- Bouton Secondaire --- */
.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--gray-50);
  border-color: var(--gray-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* --- Bouton Outline --- */
.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--text-main);
  background: var(--bg-main);
}

.btn-block {
  width: 100%;
  display: flex;
}

/* =========================================
   2. FORMULAIRES
   ========================================= */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  background-color: var(--bg-input);
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"], input[type="email"], select { height: var(--ui-height); }
textarea { min-height: 120px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: var(--ring-focus);
}

.is-invalid { border-color: var(--danger) !important; }

/* Alertes Succès (DYNAMIQUE GRÂCE À VOTRE LOGIQUE) */
.form-success {
  display: none;
  text-align: center;
  padding: 16px;
  
  /* Fond : Utilise --success-rgb pour faire du vert transparent */
  background: rgba(var(--success-rgb), 0.1); 
  border: 1px solid rgba(var(--success-rgb), 0.2);
  color: var(--success); 
  
  border-radius: var(--radius-md);
  margin-top: 20px;
}

/* =========================================
   3. CARTES
   ========================================= */
.card, .tool-card, .contact-card, .audience-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow: hidden;
}

.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 260px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tool-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover), 0 0 20px rgba(var(--primary-rgb), 0.08);
  border-color: var(--primary);
}

.tool-card h3 {
  font-size: 20px;
  margin-bottom: 12px;
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-card p {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 24px;
  flex-grow: 1;
  line-height: 1.6;
}

.contact-card {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 40px);
  box-shadow: var(--shadow-md);
}

/* =========================================
   4. LISTES
   ========================================= */
.value-list { display: grid; gap: 16px; margin-top: 24px; }

.value-list li {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.value-list li::before {
  content: "✓";
  color: var(--primary);
  font-weight: 800;
  font-size: 18px;
}

/* =========================================
   5. COMMUTATEUR DE THÈME (Theme Switcher)
   ========================================= */
.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  z-index: 1001;
}

.theme-toggle-btn:hover {
  transform: scale(1.08) rotate(15deg);
  border-color: var(--primary);
  box-shadow: var(--shadow-md), 0 0 12px rgba(var(--primary-rgb), 0.15);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.desktop-theme-btn {
  margin-right: 4px;
}

.theme-selector-mobile {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-selector-mobile span {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}

/* =========================================
   6. RACCOURCIS CLAVIER (Hotkeys UI)
   ========================================= */

/* Toast Notification (Zéro-Souris Feedback) */
#th-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-hover);
  backdrop-filter: blur(8px);
  transform: translateY(100px) scale(0.9);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
}

#th-toast::before {
  content: "⌨️";
  font-size: 16px;
}

#th-toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Modal Raccourcis (Menu d'Aide) */
.th-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
}

[data-theme="light"] .th-overlay {
  background: rgba(241, 245, 249, 0.6);
}

.th-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.th-overlay-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-hover);
  text-align: center;
  color: var(--text-main);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.th-overlay.active .th-overlay-card {
  transform: scale(1);
}

.th-overlay-card h3 {
  font-size: 22px;
  margin-bottom: 8px;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.th-overlay-card .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.hotkey-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  text-align: left;
}

.hotkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.hotkey-row:last-child {
  border-bottom: none;
}

.hotkey-row span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.hotkey-row kbd {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-weight: 700;
  font-size: 12px;
  min-width: 32px;
  text-align: center;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.hotkey-note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  text-align: left;
  line-height: 1.5;
}

.th-overlay-card .btn {
  width: 100%;
}

/* =========================================
   7. ALERTE DE DIAGNOSTIC SYSTEME (Anti-AdBlock)
   ========================================= */
.th-diagnostic-alert-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(23, 23, 23, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-left: 4px solid #ef4444; /* Bordure rouge signal d'anomalie */
  border-radius: var(--radius-md, 8px);
  padding: 20px 24px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(239, 68, 68, 0.05);
  backdrop-filter: blur(12px);
  margin: 30px auto 10px auto;
  position: relative;
  max-width: 800px;
  width: 100%;
  animation: slideUpIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-main, #f9fafb);
  z-index: 100;
  text-align: left;
}

.th-diagnostic-alert-panel.hidden {
  display: none;
}

.sys-status-badge {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.sys-status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background-color: #ef4444;
  border-radius: 50%;
  animation: pulseRedDot 1.2s infinite alternate;
}

.th-diagnostic-alert-panel .panel-body {
  flex: 1;
}

.th-diagnostic-alert-panel h4 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.th-diagnostic-alert-panel p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.5;
}

.btn-utility-sys-update {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-sm, 6px);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-utility-sys-update:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
  filter: brightness(1.1);
}

.th-diagnostic-alert-panel .panel-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s ease;
}

.th-diagnostic-alert-panel .panel-close:hover {
  color: #cbd5e1;
}

@keyframes pulseRedDot {
  0% { opacity: 0.3; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.15); }
}

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

@media (max-width: 640px) {
  .th-diagnostic-alert-panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
  }
  .btn-utility-sys-update {
    width: 100%;
  }
}