/* ===== MODAL AUTHENTIFICATION BEMA - EXPERT UX/UI ===== */

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.auth-modal.active {
  display: flex;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease;
}

.auth-modal-content {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-3xl);
  max-width: 450px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border: 1px solid rgba(46, 134, 222, 0.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.auth-close {
  position: absolute;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  background: rgba(107, 114, 128, 0.1);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-gray);
  z-index: 10001;
}

.auth-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  transform: scale(1.1);
}

.auth-modal-header {
  text-align: center;
  margin-bottom: var(--spacing-3xl);
}

.auth-logo {
  margin-bottom: var(--spacing-lg);
}

.auth-logo-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  box-shadow: 0 8px 25px rgba(46, 134, 222, 0.2);
}

.auth-modal-header h3 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: var(--spacing-sm);
  font-family: 'Inter', sans-serif;
}

.auth-modal-header p {
  color: var(--text-gray);
  font-size: 1rem;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.auth-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

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

.auth-input-icon {
  position: absolute;
  left: var(--spacing-md);
  color: var(--text-gray);
  font-size: 1.1rem;
  z-index: 2;
  transition: color 0.3s ease;
}

.auth-input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 3rem;
  border: 2px solid rgba(107, 114, 128, 0.2);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  background: rgba(249, 250, 251, 0.5);
  min-height: 56px;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(46, 134, 222, 0.1);
}

.auth-input:focus + .auth-input-icon {
  color: var(--primary-blue);
}

.auth-password-toggle {
  position: absolute;
  right: var(--spacing-md);
  background: none;
  border: none;
  color: var(--text-gray);
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.auth-password-toggle:hover {
  color: var(--primary-blue);
  background: rgba(46, 134, 222, 0.1);
}

.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: var(--spacing-sm) 0;
}

.auth-remember {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-gray);
}

.auth-remember input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(107, 114, 128, 0.3);
  border-radius: var(--radius-sm);
  margin-right: var(--spacing-sm);
  position: relative;
  transition: all 0.3s ease;
}

.auth-remember input:checked + .checkmark {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

.auth-remember input:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--white);
  font-size: 12px;
  font-weight: bold;
}

.auth-forgot {
  color: var(--primary-blue);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.auth-forgot:hover {
  color: #1e40af;
  text-decoration: underline;
}

.auth-submit {
  background: linear-gradient(135deg, var(--primary-blue), #1e40af);
  color: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  min-height: 56px;
  position: relative;
  overflow: hidden;
}

.auth-submit::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.5s ease;
}

.auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(46, 134, 222, 0.3);
}

.auth-submit:hover::before {
  left: 100%;
}

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

.auth-submit.loading .auth-submit-text {
  opacity: 0;
}

.auth-submit.loading .auth-submit-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: var(--spacing-xl) 0;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(107, 114, 128, 0.2);
}

.auth-divider span {
  background: var(--white);
  padding: 0 var(--spacing-md);
  color: var(--text-gray);
  font-size: 0.9rem;
}

.auth-signup-link {
  text-align: center;
}

.auth-signup-link p {
  color: var(--text-gray);
  font-size: 0.9rem;
}

.signup-link {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.signup-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

.auth-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-2xl);
}

.auth-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(46, 134, 222, 0.2);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--spacing-md);
}

.auth-loading p {
  color: var(--primary-blue);
  font-weight: 600;
}

/* ===== RESPONSIVE MOBILE/TABLET ===== */
@media (max-width: 768px) {
  .auth-modal {
    padding: var(--spacing-sm);
  }
  
  .auth-modal-content {
    padding: var(--spacing-2xl);
    max-width: 100%;
    border-radius: var(--radius-xl);
  }
  
  .auth-modal-header h3 {
    font-size: 1.5rem;
  }
  
  .auth-input {
    min-height: 52px;
    font-size: 16px; /* iOS zoom prevention */
  }
  
  .auth-submit {
    min-height: 52px;
    font-size: 1rem;
  }
  
  .auth-options {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .auth-modal-content {
    padding: var(--spacing-xl);
  }
  
  .auth-close {
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 36px;
    height: 36px;
  }
  
  .auth-logo-img {
    width: 50px;
    height: 50px;
  }
}
