/* Styles pour le système d'authentification */

:root {
  /* Palette de couleurs principale */
  --primary-color: #007AFF;
  --secondary-color: #5AC8FA;
  --accent-color: #FF2D55;
  --success-color: #34C759;
  --warning-color: #FF9500;
  --danger-color: #FF3B30;
  --info-color: #5856D6;
  
  /* Couleurs de fond et de texte - Mode clair */
  --bg-color: #F2F2F7;
  --card-bg: #ffffff;
  --text-primary: #000000;
  --text-secondary: #8E8E93;
  --border-color: rgba(0, 0, 0, 0.1);
  
  /* Neumorphisme - Mode clair */
  --nm-shadow-light: rgba(255, 255, 255, 0.8);
  --nm-shadow-dark: rgba(0, 0, 0, 0.05);
  --nm-distance: 10px;
  --nm-blur: 15px;
  --nm-pressed-distance: 5px;
  --nm-pressed-blur: 10px;
}

/* Mode sombre */
[data-theme="dark"] {
  --bg-color: #1C1C1E;
  --card-bg: #2C2C2E;
  --text-primary: #FFFFFF;
  --text-secondary: #8E8E93;
  --border-color: rgba(255, 255, 255, 0.1);
  
  /* Neumorphisme - Mode sombre */
  --nm-shadow-light: rgba(40, 40, 45, 0.8);
  --nm-shadow-dark: rgba(0, 0, 0, 0.5);
}

/* Conteneur d'authentification */
.auth-container {
  margin-left: auto;
  position: relative;
}

.global-auth-slot {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
}

.header-actions[data-auth-slot] {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Bouton d'authentification */
.auth-button {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.auth-button:hover {
  background-color: var(--bg-color);
}

.auth-button i {
  margin-right: 8px;
  font-size: 16px;
}

/* Menu utilisateur */
.user-menu {
  position: relative;
}

.user-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-button:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.user-avatar {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  width: 250px;
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 20px;
  width: 12px;
  height: 12px;
  background-color: var(--card-bg);
  transform: rotate(45deg);
  box-shadow: -2px -2px 5px rgba(0, 0, 0, 0.05);
}

.user-info {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}

.user-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.user-email {
  font-size: 14px;
  color: var(--text-secondary);
}

.dropdown-menu {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.dropdown-item {
  padding: 0;
}

.dropdown-item:last-child {
  border-top: 1px solid var(--border-color);
}

.dropdown-link {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.dropdown-link:hover {
  background-color: var(--bg-color);
}

.dropdown-link.locked {
  color: var(--text-secondary);
  cursor: not-allowed;
}

.dropdown-link.locked:hover {
  background-color: transparent;
}

.logout-lock-note {
  padding: 0 15px 10px 41px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.dropdown-link i {
  margin-right: 10px;
  font-size: 16px;
  color: var(--text-secondary);
}

.dropdown-link.danger {
  color: var(--danger-color);
}

.dropdown-link.danger:hover {
  background-color: rgba(255, 59, 48, 0.1);
}

/* Modal d'authentification */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.auth-modal {
  background-color: var(--card-bg);
  border-radius: 20px;
  width: 100%;
  max-width: 450px;
  padding: 30px;
  position: relative;
  box-shadow: 
    var(--nm-distance) var(--nm-distance) var(--nm-blur) var(--nm-shadow-dark),
    calc(-1 * var(--nm-distance)) calc(-1 * var(--nm-distance)) var(--nm-blur) var(--nm-shadow-light);
  animation: fadeInUp 0.4s ease forwards;
  transform: translateY(20px);
  opacity: 0;
}

.modal-overlay.active .auth-modal {
  transform: translateY(0);
  opacity: 1;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: var(--text-primary);
}

.auth-tabs {
  display: flex;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
}

.auth-tab {
  flex: 1;
  padding: 15px 0;
  text-align: center;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.auth-tab.active {
  color: var(--primary-color);
}

.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 3px 3px 0 0;
}

.auth-form {
  margin-top: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: inset 2px 2px 5px var(--nm-shadow-dark), inset -2px -2px 5px var(--nm-shadow-light);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1), inset 2px 2px 5px var(--nm-shadow-dark), inset -2px -2px 5px var(--nm-shadow-light);
}

.forgot-password {
  text-align: right;
  margin-top: -10px;
  margin-bottom: 20px;
}

.forgot-password a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
}

.forgot-password a:hover {
  text-decoration: underline;
}

.btn {
  display: block;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 5px 15px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0, 122, 255, 0.3);
}

.btn-primary::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.7s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

.divider {
  display: flex;
  align-items: center;
  margin: 25px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-color);
  margin: 0 15px;
}

.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-social:hover {
  background-color: var(--bg-color);
}

.btn-social i {
  font-size: 18px;
}

.btn-google i {
  color: #DB4437;
}

.auth-footer {
  margin-top: 25px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-content {
  display: none;
}

.auth-content.active {
  display: block;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Bandeau invité */
.guest-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--primary-color);
  color: white;
  padding: 12px 20px;
  z-index: 999;
  animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.guest-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  max-width: 1200px;
  margin: 0 auto;
}

.guest-banner-icon {
  font-size: 20px;
}

.guest-banner-text {
  font-size: 14px;
}

.guest-banner-text strong {
  font-weight: 600;
}

.guest-banner-action {
  color: white;
  text-decoration: underline;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.guest-banner-action:hover {
  opacity: 0.8;
}

.close-banner {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.close-banner:hover {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .guest-banner {
    padding: 10px 15px;
  }
  
  .guest-banner-action {
    display: block;
    margin-top: 5px;
  }
  
  .close-banner {
    right: 10px;
  }
  
  .auth-modal {
    margin: 20px;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .guest-banner-text {
    font-size: 12px;
  }
  
  .btn {
    padding: 12px;
  }
  
  .form-control {
    padding: 12px;
  }
}

html.auth-required-active,
html.auth-required-active body {
  overflow: hidden !important;
}

.auth-required-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: none;
  place-items: center;
  padding: 24px;
  background: #111315;
  color: #f7f7f8;
}

.auth-required-gate.active {
  display: grid;
}

.auth-required-panel {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #191c1f;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.auth-required-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #087cff;
  color: #fff;
  font-size: 20px;
}

.auth-required-panel h1 {
  margin: 0 0 10px;
  color: #fff;
  font: 700 24px/1.2 system-ui, sans-serif;
  letter-spacing: 0;
}

.auth-required-panel p {
  margin: 0;
  color: #b8bec7;
  font: 400 15px/1.55 system-ui, sans-serif;
}

.auth-required-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.auth-required-login,
.auth-required-menu {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 6px;
  font: 600 15px/1 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.auth-required-login {
  border: 1px solid #087cff;
  background: #087cff;
  color: #fff;
}

.auth-required-menu {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #dce1e7;
}

.auth-required-login:hover {
  background: #006ee6;
}

.auth-required-menu:hover {
  background: rgba(255, 255, 255, 0.06);
}

.auth-required-active .modal-overlay {
  z-index: 2147483647;
}
