/* ====================================================================
   PROPRETÉ MTP — PINTEREST-GRADE AUTHENTICATION & SESSION STYLING
   Glassmorphic aesthetic, floating ambient orbs, modern typography
   ==================================================================== */

/* Fullscreen Login Container */
#login-portal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 20%, #151b2e 0%, #0a0c13 60%, #06070a 100%);
  overflow: hidden;
  font-family: var(--font-main, 'Plus Jakarta Sans', sans-serif);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s ease;
}

#login-portal.portal-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none !important;
}

/* Ambient Floating Glowing Orbs (Pinterest Aesthetic Depth) */
.login-ambient-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.38;
  animation: orbFloat 18s ease-in-out infinite alternate;
}

.ambient-orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #22c55e 0%, rgba(34, 197, 94, 0) 70%);
  top: -100px;
  left: -80px;
  animation-duration: 16s;
}

.ambient-orb-2 {
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, #3b82f6 0%, rgba(59, 130, 246, 0) 70%);
  bottom: -150px;
  right: -100px;
  animation-duration: 22s;
}

.ambient-orb-3 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #a855f7 0%, rgba(168, 85, 247, 0) 70%);
  top: 45%;
  left: 55%;
  opacity: 0.25;
  animation-duration: 20s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 40px) scale(0.95); }
}

/* Pinterest-style Frosted Glass Card */
.login-card {
  position: relative;
  z-index: 10;
  width: 92%;
  max-width: 480px;
  padding: 38px 40px;
  background: rgba(18, 22, 34, 0.72);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  box-shadow: 
    0 24px 60px -12px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-height: 94vh;
  overflow-y: auto;
}

.login-card::-webkit-scrollbar {
  width: 4px;
}
.login-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Card Header & Brand */
.login-brand-box {
  text-align: center;
  margin-bottom: 26px;
}

.login-brand-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  border-radius: 18px;
  background: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(34, 197, 94, 0.25);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  padding: 4px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.login-brand-icon-wrapper:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5), 0 0 28px rgba(34, 197, 94, 0.4);
}

.login-brand-icon-wrapper img,
.login-brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
  display: block;
}

.login-brand-icon-wrapper i {
  font-size: 26px;
  background: linear-gradient(135deg, #4ade80 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-title {
  font-size: 23px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

/* Account Selection Cards (HashOs vs Mathou) */
.account-selector-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accounts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.account-card {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.account-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.account-card.active {
  background: rgba(34, 197, 94, 0.08);
  border-color: #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2), inset 0 0 12px rgba(34, 197, 94, 0.06);
}

.account-card[data-user="Mathou"].active {
  background: rgba(236, 72, 153, 0.08);
  border-color: #ec4899;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.2), inset 0 0 12px rgba(236, 72, 153, 0.06);
}

.account-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.account-card[data-user="HashOs"] .account-avatar {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
}

.account-card[data-user="Mathou"] .account-avatar {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
}

.account-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.account-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.account-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.badge-admin {
  color: #4ade80;
}

.badge-guest {
  color: #f472b6;
}

.account-status-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-weight: 600;
}

.account-status-dot.needs-pwd {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Pinterest-style Segmented Switcher (Tabs) */
.auth-mode-switch {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
  position: relative;
}

.mode-tab-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.mode-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Input Fields & Groups */
.auth-form-group {
  margin-bottom: 18px;
  position: relative;
}

.auth-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.auth-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  font-size: 14px;
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 40px;
  background: rgba(10, 14, 22, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  color: #ffffff;
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.25s ease;
}

.auth-input:focus {
  outline: none;
  border-color: #22c55e;
  background: rgba(10, 14, 22, 0.85);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.auth-input:focus + .auth-input-icon,
.auth-input:focus ~ .auth-input-icon {
  color: #22c55e;
}

.auth-password-toggle {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  font-size: 14px;
  transition: color 0.2s ease;
}

.auth-password-toggle:hover {
  color: #e2e8f0;
}

/* Password Strength Indicator */
.password-strength-container {
  margin-top: 8px;
  display: none;
}

.strength-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  gap: 3px;
  margin-bottom: 6px;
}

.strength-bar-step {
  flex: 1;
  height: 100%;
  background: transparent;
  border-radius: 2px;
  transition: background 0.3s ease;
}

.strength-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
}

.strength-text {
  font-weight: 700;
}

/* Extras row (Remember me, hints) */
.auth-extras-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 22px;
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.auth-checkbox {
  accent-color: #22c55e;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Submit Action Button */
.auth-submit-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #052e16;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.auth-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.5);
  filter: brightness(1.08);
}

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

.auth-submit-btn.btn-init-mode {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.auth-submit-btn.btn-init-mode:hover {
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.5);
}

/* Alert / Notification Feedback */
.auth-alert-box {
  display: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  margin-bottom: 18px;
  align-items: flex-start;
  gap: 10px;
  animation: alertSlideDown 0.3s ease;
}

@keyframes alertSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.auth-alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.auth-alert-info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

/* Shake Animation on Failure */
.shake-animation {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* Card Footer Security Badge */
.login-security-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

.login-security-footer i {
  color: #22c55e;
}

/* ====================================================================
   TOP HUD BAR USER PROFILE MENU (SESSION BADGE & LOGOUT)
   ==================================================================== */
.hud-user-profile-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.hud-panel.hud-user-profile-wrapper {
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-panel.hud-user-profile-wrapper:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.hud-user-profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  color: #ffffff;
  font-family: inherit;
  transition: all 0.2s ease;
  height: 100%;
}

.hud-user-profile-btn:hover {
  background: transparent;
  border-color: transparent;
}

.hud-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
}

.hud-user-avatar.avatar-hashos {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
}

.hud-user-avatar.avatar-mathou {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
}

.hud-user-name {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.hud-user-role-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hud-user-role-badge.badge-role-admin {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.hud-user-role-badge.badge-role-guest {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

/* User Profile Dropdown Popover */
.hud-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: #151924;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  display: none;
  z-index: 1000;
  animation: dropdownFade 0.2s ease forwards;
}

.hud-user-dropdown.active {
  display: block;
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hud-dropdown-header {
  padding: 6px 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}

.hud-dropdown-user-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.hud-dropdown-user-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.hud-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.hud-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.hud-dropdown-item.item-logout {
  color: #f87171;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

.hud-dropdown-item.item-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

/* ====================================================================
   GUEST MODE RESTRICTIONS (MATHOU)
   ==================================================================== */
.guest-restriction-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fbbf24;
  font-size: 12.5px;
  line-height: 1.4;
}

.guest-restriction-banner i {
  font-size: 18px;
  flex-shrink: 0;
}

.btn-guest-disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  position: relative;
}

.btn-guest-disabled::after {
  content: ' 🔒';
}

/* ====================================================================
   MOBILE RESPONSIVE LOGIN PORTAL & USER PROFILE (<= 768px)
   ==================================================================== */
@media (max-width: 768px) {
  .login-portal-overlay {
    height: 100dvh;
    padding: 16px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .login-card {
    width: 100%;
    max-width: 400px;
    padding: 24px 18px 20px;
    border-radius: 16px;
    margin: auto;
  }

  .login-brand-logo {
    width: 48px;
    height: 48px;
    font-size: 20px;
    margin-bottom: 10px;
  }

  .login-brand-title {
    font-size: 18px;
  }

  .profile-selector-grid {
    gap: 8px;
    margin-bottom: 16px;
  }

  .profile-card-btn {
    padding: 12px 10px;
  }

  /* font-size 16px évite le zoom forcé automatique sur iOS Safari lors du focus */
  .auth-input {
    font-size: 16px;
    height: 44px;
  }

  .hud-user-role-badge {
    display: none;
  }
}

