:root {
  --apple-bg: #fbfbfd;
  --apple-card: #ffffff;
  --apple-border: rgba(0, 0, 0, 0.06);
  --apple-text: #1d1d1f;
  --apple-text-secondary: #6e6e73;
  --apple-blue: #d79d45;
  --apple-blue-hover: #c98e3e;
  --apple-shadow: 0 2px 16px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
  --apple-shadow-hover: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.03);
  --apple-radius: 18px;
  --apple-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body.login {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--apple-bg);
  color: var(--apple-text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 0;
}

.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 20px;
  width: 100%;
  max-width: 440px;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.login-card {
  width: 100%;
  background: var(--apple-card);
  border: 1px solid var(--apple-border);
  border-radius: var(--apple-radius);
  padding: 48px 40px;
  box-shadow: var(--apple-shadow);
  transition: var(--apple-transition);
}

.login-card:hover {
  box-shadow: var(--apple-shadow-hover);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-title {
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--apple-text);
}

.login-heading {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--apple-text);
  text-align: center;
  margin: 0 0 32px 0;
  line-height: 1.2;
}

/* Alert */
.msg {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
  background: #fff3f3;
  color: #d32f2f;
  border: none;
  text-align: center;
  animation: slideDown 0.3s ease;
}

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

.msg.ok {
  background: #f0fdf4;
  color: #16a34a;
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.input {
  height: 52px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--apple-border);
  background: var(--apple-card);
  color: var(--apple-text);
  font-size: 1rem;
  font-weight: 400;
  outline: none;
  transition: var(--apple-transition);
  letter-spacing: -0.01em;
}

.input::placeholder {
  color: var(--apple-text-secondary);
}

.input:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

.input:valid{
  background-color: rgba(0, 0, 0, 0.12);
}

.input:focus {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 4px rgba(215, 157, 69, 0.1);
  background: #ffffff;
}

/* Buttons */
.btn {
  height: 52px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--apple-transition);
  outline: none;
}

.btn-primary {
  background: var(--apple-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(215, 157, 69, 0.25);
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--apple-blue-hover);
  box-shadow: 0 4px 12px rgba(215, 157, 69, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(215, 157, 69, 0.3);
}

.btn-return {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--apple-text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--apple-transition);
  letter-spacing: -0.01em;
}

.btn-return:hover {
  color: var(--apple-text);
  background: rgba(0, 0, 0, 0.03);
}

/* Divider & Links */
.divider {
  text-align: center;
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--apple-border);
}

.link-subtle {
  color: var(--apple-blue);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: opacity 0.2s ease;
}

.link-subtle:hover {
  opacity: 0.7;
}

/* Footer */
.login-footer {
  text-align: center;
  color: var(--apple-text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  padding: 20px;
  letter-spacing: -0.01em;
}

/* Responsive */
@media (max-width: 480px) {
  .login-card {
    padding: 36px 28px;
    border-radius: 16px;
  }

  .login-heading {
    font-size: 1.5rem;
    margin-bottom: 28px;
  }

  .input,
  .btn {
    height: 48px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --apple-bg: #000000;
    --apple-card: #1c1c1e;
    --apple-border: rgba(255, 255, 255, 0.1);
    --apple-text: #f5f5f7;
    --apple-text-secondary: #a1a1a6;
    --apple-blue: #d79d45;
    --apple-blue-hover: #c98e3e;
    --apple-shadow: 0 2px 16px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --apple-shadow-hover: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  .input:focus {
    background: #1c1c1e;
  }

  .btn-return:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
