:root {
  --brand-blue: #2979FF;
  --brand-blue-dark: #007bff;
  --brand-blue-hover: #1a6ef5;
  --brand-blue-soft: #e8f2ff;
  --brand-blue-glow: rgba(41, 121, 255, 0.18);
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(160deg, #ffffff 0%, #f5f9ff 40%, #e8f2ff 100%);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 40px 32px;
  margin: 24px 16px;
  opacity: 0;
  animation: fadeUp 0.7s ease-out 0.2s forwards;
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(14px); }
  100% { opacity: 1; transform: translateY(0); }
}

.brand-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-header .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.brand-header .logo span {
  color: var(--brand-blue);
}

.brand-header .logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-header .subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.page-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 28px;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.925rem;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.field input {
  width: 100%;
  padding: 13px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder {
  color: #9ca3af;
}

.field input:hover {
  border-color: #d1d5db;
  background: #fff;
}

.field input:focus {
  border-color: var(--brand-blue);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-blue-glow);
}

.field input.error {
  border-color: #dc2626;
  background: #fffafa;
}

.field input.error:focus {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.field-error {
  display: block;
  font-size: 0.85rem;
  color: #dc2626;
  margin-top: 6px;
  min-height: 1.2em;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.password-wrap input {
  padding-right: 48px;
  flex: 1;
}

.toggle-password {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: calc(100% - 8px);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.toggle-password:hover {
  color: var(--brand-blue);
  background: var(--brand-blue-soft);
}

.icon-eye,
.icon-eye-off {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.icon-eye {
  width: 22px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50% 50% 0 0;
  margin-top: -4px;
}

.icon-eye::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.icon-eye-off {
  width: 22px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50% 50% 0 0;
  margin-top: -4px;
  display: none;
}

.icon-eye-off::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 2px;
  background: currentColor;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 1px;
}

.toggle-password[aria-pressed="true"] .icon-eye {
  display: none;
}

.toggle-password[aria-pressed="true"] .icon-eye-off {
  display: inline-block;
}

.form-message {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 20px;
  display: none;
}

.form-message.visible {
  display: block;
}

.form-message.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.form-message.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  min-height: 48px;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(41, 121, 255, 0.35);
}

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

.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--brand-blue-glow);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.btn-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-primary.loading .btn-text {
  visibility: hidden;
  position: absolute;
}

.btn-primary.loading .btn-loader {
  display: inline-block;
}

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

.footer-link {
  text-align: center;
  margin: 24px 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.footer-link a {
  color: var(--brand-blue);
  font-weight: 600;
  text-decoration: none;
}

.footer-link a:hover {
  color: var(--brand-blue-hover);
  text-decoration: underline;
}
