/* Animated Login Modal with Gradient Glow */

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.login-modal.open {
  display: flex;
}

.login-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.login-modal-content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
  animation: slideUpScale 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Animated gradient border glow */
.login-modal-content::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(
    90deg,
    var(--accent-board) 0%,
    var(--accent-deck) 25%,
    var(--accent-game) 50%,
    var(--accent-deck) 75%,
    var(--accent-board) 100%
  );
  background-size: 200% 100%;
  border-radius: 16px;
  opacity: 0.4;
  animation: gradient-flow 4s linear infinite;
  z-index: -1;
}

/* Subtle inner glow */
.login-modal-content::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(74, 158, 255, 0.08) 0%,
    rgba(124, 58, 237, 0.04) 50%,
    transparent 100%
  );
  pointer-events: none;
  border-radius: 16px;
}

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

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

@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-modal-header {
  text-align: center;
  margin-bottom: 36px;
  position: relative;
  z-index: 1;
}

.login-modal-logo {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  background: linear-gradient(
    135deg,
    var(--accent-board),
    var(--accent-deck),
    var(--accent-game)
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: subtle-pulse 3s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.02); }
}

.login-modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.login-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.2s ease;
  z-index: 2;
}

.login-modal-close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  transform: scale(1.1);
}

.login-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 4px;
  position: relative;
  z-index: 1;
}

.login-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.login-tab.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.login-tab:not(.active):hover {
  color: var(--text-primary);
}

.login-error,
.login-success {
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  display: none;
  position: relative;
  z-index: 1;
  animation: slideDown 0.3s ease;
}

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

.login-error {
  background: rgba(241, 91, 62, 0.12);
  border: 1px solid rgba(241, 91, 62, 0.3);
  color: #ff8270;
}

.login-success {
  background: rgba(77, 155, 95, 0.12);
  border: 1px solid rgba(77, 155, 95, 0.3);
  color: #6fbd7f;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.login-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-form-group input {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  transition: all 0.2s ease;
}

.login-form-group input:focus {
  outline: none;
  background: var(--bg-card);
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--accent);
}

.login-form-group input::placeholder {
  color: var(--text-tertiary);
  opacity: 0.6;
}

.login-submit-btn {
  width: 100%;
  padding: 16px;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(
    135deg,
    var(--accent-board),
    var(--accent-deck)
  );
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-primary);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.login-submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    var(--accent-deck),
    var(--accent-game)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.login-submit-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.login-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(74, 158, 255, 0.4);
}

.login-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-submit-btn span {
  position: relative;
  z-index: 1;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

.login-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.login-footer a:hover {
  text-decoration: underline;
  color: var(--accent-deck);
}

/* Mobile adjustments */
@media (max-width: 500px) {
  .login-modal-content {
    padding: 40px 28px;
  }

  .login-modal-logo {
    font-size: 28px;
  }

  .login-form-group input {
    padding: 12px 14px;
  }

  .login-submit-btn {
    padding: 14px;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .login-modal,
  .login-modal-content,
  .login-error,
  .login-success {
    animation: none !important;
  }

  .login-modal-content::before {
    animation: none !important;
  }

  .login-modal-logo {
    animation: none !important;
  }

  .login-submit-btn:hover:not(:disabled) {
    transform: none;
  }
}
