* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1a202c;
  background: #f6f5f8;
}

.login-split {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
}

.login-image {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 40px;
  position: relative;
}

.login-image img {
  max-width: 80%;
  max-height: 80%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-form-panel {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f5f8;
  padding: 40px 24px;
}

.login-form {
  width: 100%;
  max-width: 420px;
  background: #fff;
  padding: 48px;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(70,30,124,0.08);
  animation: slideUp 0.7s ease-out;
}

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

.login-logo {
  display: block;
  max-width: 260px;
  width: 100%;
  height: auto;
  margin-bottom: 24px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #461D7C;
  color: #F5C242;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  font-size: 0.75rem;
  margin: 0 0 8px;
}

.login-form h1 {
  font-size: 1.75rem;
  margin: 0 0 8px;
  color: #111827;
}

.muted {
  color: #6b7280;
  margin: 0 0 32px;
}

.field {
  position: relative;
  margin-bottom: 24px;
}

.field input {
  width: 100%;
  padding: 16px 14px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: transparent;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: #461D7C;
  box-shadow: 0 0 0 3px rgba(118,82,160,0.12);
}

.field label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  background: #fff;
  padding: 0 4px;
  transition: all 0.2s ease;
  pointer-events: none;
  font-size: 1rem;
}

.field input:not(:placeholder-shown) + label,
.field input:not([value=""]) + label,
.field input:-webkit-autofill + label,
.field input:autofill + label,
.field input:focus + label {
  top: -10px;
  transform: translateY(0);
  font-size: 0.75rem;
  color: #461D7C;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  background: #461D7C;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: #2d1055;
}

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-primary .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.btn-primary.loading .spinner {
  display: block;
}

.btn-primary.loading .btn-text {
  opacity: 0;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.alert.warning {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.alert code {
  background: #fef3c7;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.field.password-field input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #461D7C;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  z-index: 2;
}

.toggle-password:hover {
  color: #2d1055;
  background: rgba(70,30,124,0.08);
}

.alert.error {
  background: #fef2f2;
  border: 1px solid #f87171;
  color: #991b1b;
}

.hidden {
  display: none;
}

@media (max-width: 768px) {
  .login-split {
    flex-direction: column;
  }
  .login-image {
    min-height: 220px;
    padding: 24px;
  }
  .login-image img {
    max-height: 180px;
    max-width: 70%;
  }
  .login-form {
    box-shadow: none;
    border-radius: 0;
    background: transparent;
    padding: 32px 24px;
  }
}
