/* ==========================================================================
   COMPONENTS - BUTTONS, BADGES, CARDS & MODALS
   ========================================================================== */

/* --- BOUTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition-normal);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--color-accent-gradient);
  color: #0b0f14;
  box-shadow: 0 4px 14px rgba(0, 188, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 188, 212, 0.45);
  filter: brightness(1.08);
}

.btn-cta {
  background: var(--color-gold-gradient);
  color: #0b0f14;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.5);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-outline-cyan {
  background: transparent;
  color: var(--color-accent-cyan);
  border: 1px solid var(--color-accent-cyan);
}

.btn-outline-cyan:hover {
  background: rgba(0, 188, 212, 0.12);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.95rem 1.85rem;
  font-size: 1.05rem;
}

.btn:active {
  transform: translateY(0);
}

/* --- BADGES --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-cyan {
  background: rgba(0, 188, 212, 0.12);
  color: var(--color-accent-cyan);
  border: 1px solid rgba(0, 188, 212, 0.3);
}

.badge-orange {
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* --- CARTES GÉNÉRIQUES --- */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  padding: 1.5rem;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(0, 188, 212, 0.3);
  box-shadow: var(--shadow-md);
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  border: 1px solid rgba(0, 188, 212, 0.4);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

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

/* ==========================================================================
   AUTH — BOUTON NAVBAR, CHIP UTILISATEUR, MODALE CONNEXION/INSCRIPTION
   ========================================================================== */

/* --- Bouton "Se connecter" dans la navbar --- */
.btn-auth {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}
.btn-auth:hover {
  background: rgba(0, 188, 212, 0.12);
  border-color: rgba(0, 188, 212, 0.4);
  color: var(--color-accent-cyan);
  transform: translateY(-1px);
}

/* --- Chip utilisateur connecté --- */
.auth-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 188, 212, 0.08);
  border: 1px solid rgba(0, 188, 212, 0.2);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.75rem 0.3rem 0.4rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}
.auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-accent-gradient);
  color: #0b0f14;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-username {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-signout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  padding: 0.1rem;
  border-radius: 4px;
  transition: color var(--transition-fast);
}
.auth-signout-btn:hover {
  color: #f87171;
}

/* --- Modale d'authentification --- */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}
.auth-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.auth-modal {
  background: var(--color-bg-surface);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition-slow);
  position: relative;
  overflow: hidden;
}
.auth-modal-overlay.is-open .auth-modal {
  transform: translateY(0) scale(1);
}
.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.auth-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.auth-modal-title svg {
  color: var(--color-accent-cyan);
}
.auth-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.auth-modal-close:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.06);
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  padding: 1rem 1.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-top: 1rem;
}
.auth-tab {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 0.5rem 1rem;
  position: relative;
  transition: color var(--transition-fast);
}
.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent-cyan);
  transition: width var(--transition-fast);
}
.auth-tab.active {
  color: var(--color-accent-cyan);
}
.auth-tab.active::after {
  width: 100%;
}

/* Formulaires */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
}
.auth-form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.35rem;
  display: block;
}
.auth-form-input {
  width: 100%;
  background: var(--color-bg-input);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  color: var(--color-text-primary);
  transition: border-color var(--transition-fast);
}
.auth-form-input:focus {
  outline: none;
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,188,212,0.12);
}
.auth-form-input::placeholder {
  color: var(--color-text-dimmed);
}
.auth-error {
  display: none;
  font-size: 0.8125rem;
  color: #f87171;
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}
.auth-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--color-accent-gradient);
  color: #0b0f14;
  border: none;
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast);
}
.auth-submit-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-switch-text {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}
.auth-switch-text a {
  color: var(--color-accent-cyan);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(11,15,20,0.3);
  border-top-color: #0b0f14;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* --- Gate formulaire upload (non connecté) --- */
.upload-auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 2.5rem 1.75rem;
  background: linear-gradient(160deg, #1a2230 0%, #0f161f 100%);
  border: 1px solid rgba(0, 188, 212, 0.2);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--color-text-muted);
}
.upload-auth-gate svg {
  color: var(--color-accent-cyan);
  opacity: 0.75;
  margin-bottom: 0.25rem;
}
.upload-auth-gate .gate-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}
.upload-auth-gate .gate-hint {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0;
  max-width: 340px;
}
.upload-auth-gate .gate-hint strong {
  color: var(--color-accent-cyan);
}
.upload-auth-gate .gate-hint code {
  font-family: monospace;
  font-size: 0.8rem;
  background: rgba(0, 188, 212, 0.1);
  border: 1px solid rgba(0, 188, 212, 0.2);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--color-accent-cyan);
}

/* ==========================================================================
   RESPONSIVE MOBILE — composants (boutons, formulaires, auth, toasts)
   ========================================================================== */
@media (max-width: 768px) {
  /* Zones tactiles confortables (>= 44px) */
  .btn,
  .btn-sm,
  .btn-lg {
    min-height: 44px;
  }

  .btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
  }

  .auth-tab {
    min-height: 44px;
  }

  .auth-modal-close {
    width: 44px;
    height: 44px;
  }

  .auth-form-input {
    min-height: 48px;
    font-size: 1rem; /* évite le zoom automatique d'iOS au focus */
  }

  .auth-submit-btn {
    min-height: 48px;
  }

  .auth-signout-btn {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }

  /* Toasts : pleine largeur, sans déborder de l'écran */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .auth-modal-overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .auth-modal {
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }

  .auth-modal-header {
    padding: 1rem 1rem 0;
  }

  .auth-tabs {
    padding: 0.75rem 1rem 0;
  }

  .auth-form {
    padding: 1.15rem 1rem;
  }

  .upload-auth-gate {
    padding: 1.75rem 1rem;
  }
}
