:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #8b5cf6;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --danger-color: #ef4444;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 380px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  position: relative;
}

.login-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo h1 {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.025em;
}

.logo p {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
}

.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.2s ease;
  background: var(--surface);
  color: var(--text-primary);
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-muted);
}

.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.submit-btn::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;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.submit-btn:hover::before {
  left: 100%;
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 13px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.error-message::before {
  content: "⚠";
  flex-shrink: 0;
  font-size: 14px;
}

.footer {
  text-align: center;
  margin-top: 28px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Loading state */
.submit-btn.loading {
  pointer-events: none;
}

.submit-btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: button-loading-spinner 1s ease infinite;
}

@keyframes button-loading-spinner {
  from {
    transform: rotate(0turn);
  }
  to {
    transform: rotate(1turn);
  }
}

/* Forgot password link (если понадобится) */
.forgot-password {
  text-align: center;
  margin-top: 16px;
}

.forgot-password a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.forgot-password a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Success message (если понадобится) */
.success-message {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 13px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.success-message::before {
  content: "✓";
  flex-shrink: 0;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .login-container {
    padding: 28px 24px;
    max-width: none;
  }

  .logo h1 {
    font-size: 22px;
  }

  input[type="text"],
  input[type="password"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

@media (max-width: 360px) {
  .login-container {
    padding: 24px 20px;
  }
}

/* Dark mode support (если понадобится) */
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
  }
}

/* Focus states for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .login-container {
    border: 2px solid var(--text-primary);
  }

  input[type="text"],
  input[type="password"] {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .submit-btn::before {
    display: none;
  }
}
