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

html {
  background: #f7f8f9;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: #1c1c24;
  line-height: 1.5;
  background: #f7f8f9;
}

/* ── SPLIT LAYOUT ── */
.login-split {
  display: flex;
  min-height: 100vh;
}

/* ── BRAND SIDE ── */
.login-brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  background-color: #f7f8f9;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 28px,
      rgba(11, 95, 255, 0.04) 28px,
      rgba(11, 95, 255, 0.04) 29px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 28px,
      rgba(11, 95, 255, 0.04) 28px,
      rgba(11, 95, 255, 0.04) 29px
    );
}

.brand-block {
  text-align: center;
  position: relative;
  z-index: 1;
}

.brand-eyebrow {
  display: block;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: #9b9caa;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.login-brand .brand-name {
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  color: #0b5fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  text-align: center;
}

.login-brand .brand-name em {
  color: #1c1c24;
  font-style: italic;
  font-weight: 600;
}

.brand-sep {
  display: block;
  width: 64px;
  height: 2px;
  background: #d4d5dd;
  margin: 1.25rem auto;
  border-radius: 1px;
}

.brand-tagline {
  display: block;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: #9b9caa;
  text-transform: uppercase;
}

/* ── FORM SIDE ── */
.login-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 2rem;
  border-left: 1px solid #e7e7ed;
  position: relative;
}

.form-head {
  width: 100%;
  max-width: 30rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.form-head-line {
  width: 100%;
  height: 3px;
  background: #0b5fff;
  border-radius: 2px;
  margin: 0.75rem 0 0.5rem;
}

.login-card-wrap {
  width: 100%;
  max-width: 30rem;
}

.login-card-glass {
  display: none;
}

.login-card {
  padding: 0;
}

/* ── HEADER ── */
.login-header {
  display: none;
}

.login-title {
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #1c1c24;
  margin-bottom: 0;
}

.login-subtitle {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 0.875rem;
  color: #6b6c7e;
  line-height: 1.4;
}

/* ── FORM ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group {
  margin-bottom: 0.875rem;
  animation: fadeUp 400ms cubic-bezier(0.32, 0.72, 0, 1) both;
  position: relative;
  z-index: 2;
}

.form-group:nth-child(1) { animation-delay: 80ms; }
.form-group:nth-child(2) { animation-delay: 140ms; }

.input-field {
  position: relative;
  display: flex;
  align-items: center;
}

.input-ico {
  position: absolute;
  left: 1rem;
  color: #9b9caa;
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.form-input {
  width: 100%;
  padding: 1rem 3rem 1rem 2.75rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  color: #1c1c24;
  background: #ffffff;
  border: 1px solid #e7e7ed;
  border-radius: 14px;
  outline: none;
  transition: border-color 200ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 200ms cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-appearance: none;
  appearance: none;
  font-variant-numeric: tabular-nums;
}

#password.form-input {
  letter-spacing: 0.02em;
}

.form-input::placeholder {
  color: #9b9caa;
  font-weight: 400;
}

.form-input:focus {
  border-color: #0b5fff;
  box-shadow: 0 0 0 3px rgba(11, 95, 255, 0.10);
}

.form-input[aria-invalid="true"] {
  border-color: rgba(255, 77, 79, 0.4);
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
  -webkit-text-fill-color: #1c1c24 !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
  caret-color: #1c1c24;
  transition: background-color 5000s ease-in-out 0s;
}

/* Password toggle */
.password-toggle {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #9b9caa;
  cursor: pointer;
  transition: color 200ms cubic-bezier(0.16, 1, 0.3, 1), background 200ms cubic-bezier(0.16, 1, 0.3, 1), transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

.password-toggle:hover {
  color: #1c1c24;
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-50%) scale(1.06);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.94);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(11, 95, 255, 0.18);
  outline-offset: 2px;
}

.password-toggle .eye-closed { display: none; }
.password-toggle.showing .eye-open { display: none; }
.password-toggle.showing .eye-closed { display: block; }

/* ── BUTTON ── */
#loginForm {
  display: flex;
  flex-direction: column;
}

.btn-primary {
  position: relative;
  align-self: center;
  width: 100%;
  padding: 0.9375rem 2.5rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: #0b5fff;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: background 200ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.32, 0.72, 0, 1), box-shadow 400ms cubic-bezier(0.32, 0.72, 0, 1);
  min-height: 52px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(11, 95, 255, 0.10);
  animation: fadeUp 400ms cubic-bezier(0.32, 0.72, 0, 1) both;
  animation-delay: 260ms;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

.btn-primary:hover {
  background: #0053f0;
  box-shadow: 0 4px 24px rgba(11, 95, 255, 0.2);
  transform: translateY(-1px);
}

.btn-primary:active {
  background: #0046d0;
  transform: translateY(0) scale(0.98);
}

.btn-primary:focus-visible {
  outline: 2px solid #0b5fff;
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  animation: none;
}

.btn-primary .btn-text {
  position: relative;
  z-index: 1;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary.loading .btn-text { opacity: 0; }
.btn-primary.loading { pointer-events: none; }
.btn-primary.loading .btn-spinner { opacity: 1; }
.btn-primary.success .btn-text { opacity: 0; }
.btn-primary.success .btn-check { opacity: 1; }

.btn-primary.success {
  background: #34c759 !important;
  animation: successPop 400ms cubic-bezier(0.32, 0.72, 0, 1);
}

.btn-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.btn-spinner svg {
  animation: spin 0.6s linear infinite;
  stroke: #ffffff;
}

.btn-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.btn-check svg {
  animation: checkPop 300ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes successPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

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

@keyframes checkPop {
  0% { transform: scale(0) rotate(-15deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ── ERROR BOX ── */
#loginError {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #fff0f0;
  border: 1px solid #ffd4d4;
  color: #e04040;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 16px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(-8px);
  position: relative;
  z-index: 2;
}

#loginError.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

#loginError svg {
  flex-shrink: 0;
  color: inherit;
  width: 18px;
  height: 18px;
}

/* ── SHAKE ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .login-split {
    flex-direction: column;
  }

  .login-brand {
    padding: 3rem 2rem 1.5rem;
    min-height: 30vh;
  }

  .login-brand .brand-name {
    font-size: clamp(3rem, 10vw, 4rem);
  }

  .login-form {
    padding: 1.5rem;
    align-items: flex-start;
  }

  .login-card-wrap::before {
    top: -8px;
  }

  .login-card { padding: 1.25rem; }
  .login-title { font-size: 1.5rem; }
  .form-input { padding: 0.875rem 2.75rem 0.875rem 2.5rem; font-size: 0.9375rem; }
  .btn-primary { padding: 0.875rem 2rem; min-height: 48px; }
}

@media (max-width: 380px) {
  .login-card { padding: 1rem; }
  .brand-name { font-size: 1.85rem; }
  .login-title { font-size: 1.25rem; }
  .form-input { padding: 0.75rem 2.5rem 0.75rem 2.25rem; font-size: 0.875rem; }
}
