/*
 * HMC Auth System Styles
 * Styles for authentication-aware components
 */

:root {
  --primary-color: #fb0000;
}

/* Auth Status Indicator */
.hmc-auth-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hmc-auth-status.logged-in {
  background-color: #10b981;
  color: white;
}

.hmc-auth-status.logged-out {
  background-color: #ef4444;
  color: white;
}

.hmc-auth-status:empty::after {
  content: "Vérification...";
  color: #6b7280;
}

/* Auth Buttons */
.hmc-auth-btn {
  position: relative;
  transition: all 0.3s ease;
}

.hmc-auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hmc-auth-btn[data-auth="postuler"] {
  min-width: 140px;
}

/* Loading state for auth buttons */
.hmc-auth-btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: auth-btn-spin 1s linear infinite;
}

.hmc-auth-btn.loading {
  color: transparent;
}

@keyframes auth-btn-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* User Info Display */
.hmc-user-info {
  font-weight: 500;
}

.hmc-user-info:empty::after {
  content: "Chargement...";
  color: #6b7280;
  font-style: italic;
}

/* Conditional Content */
.hmc-conditional {
  transition: opacity 0.3s ease, height 0.3s ease;
}

.hmc-conditional[style*="display: none"] {
  opacity: 0;
  height: 0;
  overflow: hidden;
}

/* Auth-aware postuler button states */
.postuler-btn.hmc-auth-btn[data-auth="postuler"] {
  background-color: var(--primary-color, #fb0000);
  color: white;
  border: none;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.postuler-btn.hmc-auth-btn[data-auth="postuler"]:hover {
  background-color: var(--primary-hover, #e60000);
  transform: translateY(-1px);
}

/* Different states for postuler button */
.postuler-btn.hmc-auth-btn.login-required {
  background-color: #f59e0b;
}

.postuler-btn.hmc-auth-btn.login-required:hover {
  background-color: #d97706;
}

.postuler-btn.hmc-auth-btn.profile-incomplete {
  background-color: #8b5cf6;
}

.postuler-btn.hmc-auth-btn.profile-incomplete:hover {
  background-color: #7c3aed;
}

/* Auth status banner (optional) */
.hmc-auth-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 8px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.hmc-auth-banner.show {
  transform: translateY(0);
}

.hmc-auth-banner.logged-in {
  background-color: #10b981;
  color: white;
}

.hmc-auth-banner.logged-out {
  background-color: #3b82f6;
  color: white;
}

.hmc-auth-banner.error {
  background-color: #ef4444;
  color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hmc-auth-btn {
    width: 100%;
  }
  
  .hmc-auth-banner {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* Animation for auth state changes */
@keyframes auth-state-change {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.hmc-auth-btn.state-changed {
  animation: auth-state-change 0.3s ease;
}

/* Debug mode styles */
.hmc-debug .hmc-auth-status::before {
  content: "[DEBUG] ";
  font-weight: bold;
}

.hmc-debug .hmc-auth-btn::before {
  content: attr(data-auth);
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 4px;
  border-radius: 2px;
  white-space: nowrap;
  z-index: 10;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .hmc-auth-status:empty::after {
    color: #9ca3af;
  }
  
  .hmc-user-info:empty::after {
    color: #9ca3af;
  }
}