:root {
  --ink: #0f1117;
  --paper: #f8f6f1;
  --cream: #eee9df;
  --accent: #d35233;
  --accent-light: #f0a68e;
  --accent-glow: rgba(211, 82, 51, 0.12);
  --teal: #1a7a6d;
  --teal-light: #a3d9cf;
  --slate: #4a4e5a;
  --muted: #8a8d96;
  --card-bg: #ffffff;
  --border: #e2ddd4;
  --radius: 14px;
  --shadow-sm:
    0 1px 3px rgba(15, 17, 23, 0.04), 0 1px 2px rgba(15, 17, 23, 0.06);
  --shadow-md:
    0 4px 16px rgba(15, 17, 23, 0.06), 0 2px 4px rgba(15, 17, 23, 0.04);
  --shadow-lg:
    0 12px 40px rgba(15, 17, 23, 0.08), 0 4px 12px rgba(15, 17, 23, 0.04);
  --danger: #dc2626;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: "Outfit", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* === GRAIN === */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* === SPLIT LAYOUT === */
.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* === LEFT PANEL (brand) === */
.brand-panel {
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  position: relative;
  overflow: hidden;
}

.brand-panel::before {
  content: "";
  position: absolute;
  top: -150px;
  right: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(
    ellipse at 40% 40%,
    rgba(211, 82, 51, 0.12) 0%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  animation: floatSlow 10s ease-in-out infinite;
}

.brand-panel::after {
  content: "";
  position: absolute;
  bottom: -100px;
  left: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    ellipse at 60% 60%,
    rgba(26, 122, 109, 0.08) 0%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  animation: floatSlow 12s ease-in-out infinite reverse;
}

@keyframes floatSlow {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-20px) scale(1.04);
  }
}

/* Decorative grid pattern */
.grid-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image:
    linear-gradient(rgba(248, 246, 241, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 246, 241, 0.5) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--paper);
  margin-bottom: 3rem;
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  font-family: "JetBrains Mono", monospace;
}

.brand-logo-text {
  font-family: "DM Serif Display", serif;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

.brand-tagline {
  font-family: "DM Serif Display", serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -1px;
  margin-bottom: 1rem;
  animation: fadeInUp 0.6s ease both;
}

.brand-tagline .hl {
  color: var(--accent-light);
}

.brand-desc {
  font-size: 0.95rem;
  color: rgba(248, 246, 241, 0.55);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 3rem;
  animation: fadeInUp 0.6s ease 0.1s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Feature pills */
.brand-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeInUp 0.6s ease 0.2s both;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.brand-feature:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.bf-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.bf-icon-orange {
  background: rgba(211, 82, 51, 0.15);
}
.bf-icon-teal {
  background: rgba(26, 122, 109, 0.15);
}
.bf-icon-blue {
  background: rgba(59, 130, 246, 0.15);
}
.bf-icon-green {
  background: rgba(34, 197, 94, 0.15);
}

.bf-text h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1px;
}

.bf-text p {
  font-size: 0.75rem;
  color: rgba(248, 246, 241, 0.4);
  font-weight: 300;
}

/* === RIGHT PANEL (form) === */
.form-panel {
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 2rem;
  position: relative;
}

.form-wrapper {
  width: 100%;
  max-width: 400px;
}

.form-header {
  margin-bottom: 2.5rem;
  animation: fadeInUp 0.5s ease 0.15s both;
}

.form-header h1 {
  font-family: "DM Serif Display", serif;
  font-size: 2rem;
  letter-spacing: -0.5px;
  margin-bottom: 0.4rem;
}

.form-header p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 300;
}

/* Form elements */
.login-form {
  animation: fadeInUp 0.5s ease 0.25s both;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
  transition: color 0.2s;
}

.input-wrap input {
  width: 100%;
  padding: 13px 14px 13px 44px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: "Outfit", sans-serif;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--card-bg);
  outline: none;
  transition: all 0.25s ease;
}

.input-wrap input::placeholder {
  color: var(--muted);
  font-weight: 300;
}

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrap input:focus ~ .input-icon,
.input-wrap input:focus + .input-icon {
  color: var(--accent);
}

.toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-pw:hover {
  color: var(--ink);
  background: var(--cream);
}

/* Meta row */
.form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--slate);
  font-weight: 400;
  user-select: none;
}

.remember input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  background: var(--card-bg);
}

.checkmark svg {
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s;
}

.remember input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.remember input:checked + .checkmark svg {
  opacity: 1;
  transform: scale(1);
}

.forgot-link {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--ink);
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-family: "Outfit", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.btn-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), #b83a1f);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-submit:hover::before {
  opacity: 1;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(15, 17, 23, 0.15);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit span {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Loading state */
.btn-submit.loading span {
  opacity: 0;
}

.btn-submit.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(248, 246, 241, 0.3);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  z-index: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error state */
.field.error .input-wrap input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.field-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 5px;
  display: none;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.field.error .field-error {
  display: flex;
}

/* Divider */
.form-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 1.75rem 0;
  animation: fadeInUp 0.5s ease 0.3s both;
}

.form-divider::before,
.form-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.form-divider span {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

/* Back link */
.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 1.5rem;
  text-decoration: none;
  color: var(--slate);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
  animation: fadeInUp 0.5s ease 0.35s both;
}

.back-link:hover {
  color: var(--accent);
}

.back-link svg {
  transition: transform 0.2s;
}

.back-link:hover svg {
  transform: translateX(-3px);
}

/* Footer */
.form-footer {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 300;
  white-space: nowrap;
}

.form-footer strong {
  font-weight: 600;
  color: var(--slate);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    display: none;
  }

  .form-panel {
    min-height: 100vh;
    padding: 2rem 1.5rem;
  }

  .mobile-logo {
    display: flex !important;
  }
}

@media (min-width: 901px) {
  .mobile-logo {
    display: none !important;
  }
}

.mobile-logo {
  display: none;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 2rem;
}

.mobile-logo .brand-logo-icon {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.mobile-logo .brand-logo-text {
  font-size: 1.3rem;
}

/* === PASSWORD STRENGTH (optional UX touch) === */
.pw-strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.pw-strength.active {
  opacity: 1;
}

.pw-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--cream);
  transition: background 0.3s;
}

.pw-strength.weak .pw-bar:nth-child(1) {
  background: var(--danger);
}
.pw-strength.medium .pw-bar:nth-child(1),
.pw-strength.medium .pw-bar:nth-child(2) {
  background: #f59e0b;
}
.pw-strength.strong .pw-bar:nth-child(1),
.pw-strength.strong .pw-bar:nth-child(2),
.pw-strength.strong .pw-bar:nth-child(3) {
  background: #22c55e;
}
.pw-strength.very-strong .pw-bar {
  background: var(--teal);
}
