/**
 * Auth modal (login / register) — отдельный файл, чтобы стили не терялись из-за кэша styles.css
 */

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: authModalFadeIn 0.3s ease;
  opacity: 0;
}

.auth-modal[style*='display: flex'],
.auth-modal[style*='display:flex'] {
  display: flex !important;
  animation: authModalFadeIn 0.3s ease forwards;
  opacity: 1;
}

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

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(150px) saturate(180%);
  -webkit-backdrop-filter: blur(150px) saturate(180%);
  z-index: 1;
}

.auth-modal-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
}

.auth-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.auth-modal .auth-card {
  background: rgba(12, 12, 18, 0.96) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 20px;
  padding: 40px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.auth-modal .auth-card::before,
.auth-modal .auth-card::after {
  display: none !important;
  content: none !important;
}

.auth-modal .auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-modal .auth-header h1 {
  color: #fff;
  margin: 0 0 12px;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth-modal .auth-header p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-modal .form-group {
  margin-bottom: 20px;
}

.auth-modal .form-group label {
  display: block;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.auth-modal .form-group input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 12px;
  color: #fff !important;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

.auth-modal .form-group input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.auth-modal .form-group input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
}

.auth-modal .form-group input.error {
  border-color: rgba(255, 100, 100, 0.5) !important;
}

.auth-modal .form-group input.success {
  border-color: #10b981 !important;
}

.auth-modal .error-message {
  background: rgba(255, 100, 100, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.2);
  color: rgba(255, 150, 150, 0.9);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: none;
}

.auth-modal .success-message {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: none;
}

.auth-modal .rate-limit-message {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: none;
}

.auth-modal .btn-login,
.auth-modal .btn-register {
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 12px;
  color: #fff !important;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
}

.auth-modal .btn-login:hover:not(:disabled),
.auth-modal .btn-register:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

.auth-modal .btn-login:disabled,
.auth-modal .btn-register:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-modal .loading-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: authModalSpin 1s linear infinite;
}

@keyframes authModalSpin {
  to { transform: rotate(360deg); }
}

.auth-modal .forgot-password {
  text-align: right;
  margin-top: -10px;
  margin-bottom: 20px;
}

.auth-modal .forgot-password a {
  color: rgba(255, 255, 255, 0.7) !important;
  text-decoration: none;
  font-size: 0.85rem;
}

.auth-modal .forgot-password a:hover {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
}

.auth-modal .auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-modal .auth-footer p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.auth-modal .auth-footer a {
  color: rgba(255, 255, 255, 0.8) !important;
  text-decoration: none;
  font-weight: 600;
}

.auth-modal .auth-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.auth-modal .password-strength {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.auth-modal .password-strength-bar {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.auth-modal .password-strength.weak .password-strength-bar { width: 25%; background: #ffffff; }
.auth-modal .password-strength.fair .password-strength-bar { width: 50%; background: #f59e0b; }
.auth-modal .password-strength.good .password-strength-bar { width: 75%; background: #3b82f6; }
.auth-modal .password-strength.strong .password-strength-bar { width: 100%; background: #10b981; }

.auth-modal .password-requirements {
  margin-top: 8px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.auth-modal .password-requirements ul {
  margin: 4px 0 0;
  padding-left: 16px;
}

.auth-modal .password-requirements li.valid { color: #10b981; }
.auth-modal .password-requirements li.invalid { color: #ffffff; }

.auth-modal .checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-modal .checkbox-group input[type='checkbox'] {
  width: auto;
  margin: 4px 0 0;
  flex-shrink: 0;
}

.auth-modal .checkbox-group label {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
}

.auth-modal .checkbox-group a {
  color: rgba(255, 255, 255, 0.8) !important;
  text-decoration: none;
}

@media (max-width: 480px) {
  .auth-modal .auth-card {
    padding: 30px 20px;
    border-radius: 16px;
  }

  .auth-modal .auth-header h1 {
    font-size: 1.5rem;
  }
}
