/* ==========================================
   AUTH MODAL - Модальное окно входа/регистрации
   Split-screen дизайн с изображением
   ========================================== */

/* ==========================================
   MODAL OVERLAY & CONTAINER
   ========================================== */

/* Используем ID-селектор для увеличения специфичности без !important */
#authModal.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#authModal .auth-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

#authModal .auth-modal__container {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background: linear-gradient(135deg, rgba(15,23,42,.95) 0%, rgba(11,18,32,.98) 100%);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(139,92,246,.25);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 
    0 20px 60px rgba(0,0,0,.5),
    0 0 0 1px rgba(139,92,246,.08) inset,
    inset 0 1px 0 rgba(255,255,255,.02);
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================
   CLOSE BUTTON
   ========================================== */

#authModal .auth-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  z-index: 10;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

#authModal .auth-modal__close:hover {
  opacity: 1;
}

/* ==========================================
   CONTENT - Split Screen Layout
   ========================================== */

#authModal .auth-modal__content {
  display: flex;
  height: 700px;
  max-height: calc(90vh - 40px);
}

/* ==========================================
   LEFT SIDE - IMAGE (Desktop only)
   ========================================== */

#authModal .auth-modal__image {
  flex: 0 0 50%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(139,92,246,.2), rgba(99,102,241,.2));
}

#authModal .auth-modal__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

#authModal .auth-modal__image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(139,92,246,.15) 0%, 
    rgba(99,102,241,.1) 50%,
    transparent 100%
  );
  pointer-events: none;
}

/* ==========================================
   RIGHT SIDE - FORM
   ========================================== */

#authModal .auth-modal__form {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Scrollbar styling */
.auth-modal__form::-webkit-scrollbar {
  width: 6px;
}

.auth-modal__form::-webkit-scrollbar-track {
  background: rgba(15,23,42,.4);
}

.auth-modal__form::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,.3);
  border-radius: 3px;
}

.auth-modal__form::-webkit-scrollbar-thumb:hover {
  background: rgba(139,92,246,.5);
}

/* ==========================================
   FORM MODE SWITCH
   ========================================== */

.auth-modal__switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: #94a3b8;
}

.auth-modal__switch-link {
  color: #8b5cf6;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-modal__switch-link:hover {
  color: #7c3aed;
  text-decoration: underline;
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */

@media (max-width: 1024px) {
  .auth-modal__container {
    max-width: 800px;
  }
  
  .auth-modal__content {
    height: 560px;
  }
  
  .auth-modal__image {
    flex: 0 0 35%;
  }
  
  .auth-modal__form {
    padding: 40px;
  }
}

@media (max-width: 900px) {
  .auth-modal__image {
    flex: 0 0 30%;
  }
  
  .auth-modal__form {
    padding: 32px;
  }
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */

@media (max-width: 768px) {
  .auth-modal {
    padding: 0;
    align-items: flex-end;
  }
  
  .auth-modal__container {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 24px 24px 0 0;
    animation: slideUpMobile 0.3s ease-out;
  }
  
  @keyframes slideUpMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  
  .auth-modal__content {
    flex-direction: column;
    height: auto;
    max-height: 95vh;
  }
  
  /* Hide image on mobile */
  .auth-modal__image {
    display: none;
  }
  
  .auth-modal__form {
    padding: 14px 12px 40px 12px;
    overflow-y: auto;
    max-height: 94vh;
  }
  
  /* Тонкий элегантный скроллбар для мобильных */
  .auth-modal__form::-webkit-scrollbar {
    width: 3px;
  }
  
  .auth-modal__form::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .auth-modal__form::-webkit-scrollbar-thumb {
    background: rgba(139,92,246,.5);
    border-radius: 2px;
  }
  
  /* Уменьшить размеры элементов на мобильных */
  .auth-header {
    margin-bottom: 8px;
  }
  
  .auth-logo {
    margin-bottom: 10px;
  }
  
  .auth-logo img {
    width: 40px;
    height: 40px;
  }
  
  .auth-logo-text {
    font-size: 24px;
  }
  
  .auth-title {
    font-size: 22px;
    margin-bottom: 4px;
  }
  
  .auth-subtitle {
    font-size: 13px;
  }
  
  .form-group {
    margin-bottom: 8px;
  }
  
  .form-label {
    margin-bottom: 5px;
    font-size: 13px;
  }
  
  .form-input {
    padding: 9px 12px;
    font-size: 14px;
  }
  
  .btn-google,
  .btn-primary {
    padding: 10px 18px;
    font-size: 14px;
    margin-bottom: 0;
  }
  
  .btn-google {
    margin-bottom: 12px;
  }
  
  .auth-divider {
    margin: 12px 0;
    font-size: 12px;
  }
  
  .auth-footer {
    margin-top: 12px;
    font-size: 12px;
  }
  
  .auth-footer-link {
    margin-top: 6px;
  }
  
  /* Уменьшить padding у message */
  .message {
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 12px;
  }
  
  .auth-modal__close {
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .auth-modal__form {
    padding: 12px 10px 40px 10px;
  }
}

/* ==========================================
   UTILITIES
   ========================================== */

.auth-modal--hidden {
  display: none !important;
}

/* Prevent body scroll when modal is open */
body.auth-modal-open {
  overflow: hidden;
}

/* Accessibility - focus trap */
.auth-modal:focus {
  outline: none;
}
