@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter/Inter-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter/Inter-Italic-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --green-500: #1f8f58;
  --green-600: #166d43;
  --blue-900: #0e2a47;
  --blue-800: #12395f;
  --white: #ffffff;
  --gray-100: #f4f6f8;
  --gray-300: #d7dde2;
  --gray-500: #6c7883;
  --gray-700: #3e4a55;
  --error: #b42318;
  --ok: #1f8f58;
  --card-bg: rgba(255, 255, 255, 0.70);
  --overlay-bg: linear-gradient(110deg, rgba(12, 39, 66, 0.78) 0%, rgba(16, 74, 62, 0.46) 55%, rgba(255, 255, 255, 0.1) 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--white);
}

.login-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow-x: hidden;
  background-image: url("../assets/backgrounds/agroz-operations-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: grid;
  grid-template-rows: 1fr auto;
}

.login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 37, 28, 0.22), transparent 58%, rgba(7, 27, 19, 0.18));
  pointer-events: none;
}

.login-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-bg);
}

.login-layout {
  position: relative;
  z-index: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(430px, 0.9fr);
  gap: clamp(1.2rem, 2.6vw, 3rem);
  padding: clamp(1.2rem, 2.2vw, 2.4rem) clamp(1.6rem, 3.6vw, 4.5rem);
  align-items: center;
}

.branding-panel {
  max-width: 760px;
  padding: clamp(1.2rem, 2.3vw, 2.4rem);
}

.brand-mark {
  width: 84px;
  height: 84px;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: drop-shadow(0 12px 24px rgba(9, 29, 49, 0.25));
}

.app-title {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.app-subtitle {
  margin: 1rem 0 0;
  font-size: clamp(1rem, 1.22vw, 1.23rem);
  color: #e6ecf2;
  max-width: 62ch;
}

.benefits-list {
  margin: 1.65rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.8rem;
}

.benefits-list li {
  position: relative;
  padding-left: 1.4rem;
  color: #d8e3ed;
  font-size: clamp(0.95rem, 1.06vw, 1.08rem);
}

.benefits-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.53rem;
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  background: #4ec48a;
}

.auth-panel {
  display: flex;
  justify-content: flex-end;
}

.auth-card {
  width: min(100%, 470px);
  background: var(--card-bg);
  border-radius: 20px;
  padding: clamp(1.1rem, 2vw, 1.9rem);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--blue-900);
}

.auth-card__header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.auth-card__header p {
  margin: 0.4rem 0 1.2rem;
  color: var(--gray-700);
  font-size: 0.95rem;
}

.login-form {
  display: grid;
  gap: 0.9rem;
}

.form-group {
  display: grid;
  gap: 0.4rem;
}

label {
  font-size: 0.88rem;
  color: var(--blue-900);
  font-weight: 600;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--gray-300);
  border-radius: 11px;
  padding: 0 0.9rem;
  font-size: 0.95rem;
  color: var(--blue-900);
  background: rgba(255, 255, 255, 0.9);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  outline: 2px solid rgba(31, 143, 88, 0.25);
  border-color: var(--green-500);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #5f7284 50%),
    linear-gradient(135deg, #5f7284 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field-note {
  display: block;
  font-size: 0.76rem;
  color: #516274;
  margin-top: 0.08rem;
}

.password-wrapper {
  position: relative;
  display: block;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  padding-right: 2.9rem;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.toggle-password:hover {
  background: rgba(18, 57, 95, 0.08);
}

.toggle-password:focus-visible {
  outline: 2px solid rgba(31, 143, 88, 0.35);
}

.eye-icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.eye-closed {
  display: none;
}

.toggle-password.is-visible .eye-open {
  display: none;
}

.toggle-password.is-visible .eye-closed {
  display: block;
}

.checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
}

.checkbox-wrapper input {
  accent-color: var(--green-500);
}

.submit-btn {
  border: 0;
  border-radius: 12px;
  height: 46px;
  background: linear-gradient(135deg, var(--green-500), #28aa6a);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.2);
  opacity: 0.78;
}

.login-form.is-loading {
  pointer-events: none;
}

.login-loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.18), transparent 34rem),
    rgba(7, 23, 39, 0.54);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-loading[hidden] {
  display: none;
}

.login-loading__card {
  width: min(92vw, 360px);
  min-height: 210px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--blue-900);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 30px 90px rgba(3, 15, 28, 0.36);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.8rem;
  text-align: center;
  padding: 2rem;
}

.login-loading__spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid rgba(31, 143, 88, 0.16);
  border-top-color: var(--green-500);
  animation: login-spin 0.82s linear infinite;
}

.login-loading__card strong {
  font-size: 1.18rem;
}

.login-loading__card small {
  max-width: 28ch;
  color: var(--gray-500);
  font-size: 0.9rem;
  line-height: 1.35;
}

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

.error-message {
  min-height: 1em;
  font-size: 0.8rem;
  color: var(--error);
}

.form-feedback {
  min-height: 1.2em;
  margin: 0;
  color: var(--error);
  font-size: 0.9rem;
  font-weight: 500;
}

.server-status {
  margin: 0.1rem 0;
  font-size: 0.9rem;
  color: var(--ok);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.server-status--error {
  color: var(--error);
}

.status-dot {
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 16%, transparent);
}

.access-note {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--gray-700);
}

.trace-note {
  margin: -0.45rem 0 0.1rem;
  font-size: 0.79rem;
  color: var(--gray-500);
}

.help-link {
  color: var(--blue-800);
  font-size: 0.87rem;
  text-decoration: none;
}

.help-link:hover {
  text-decoration: underline;
}

.login-footer {
  position: relative;
  z-index: 1;
  padding: 1rem 1.5rem 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: #dbe6ef;
}

@media (max-width: 1200px) {
  .login-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    align-content: center;
    overflow-y: auto;
    padding-bottom: 1rem;
  }

  .auth-panel {
    justify-content: flex-start;
  }

  .auth-card {
    width: min(100%, 580px);
  }
}

@media (max-height: 760px) {
  .login-layout {
    align-items: start;
    overflow-y: auto;
  }

  .branding-panel {
    padding-top: 0;
    padding-bottom: 0.3rem;
  }
}
