/*
  BRANDING RULE: the background artwork (static/images/LOGINPAGE.png) is the source of truth
  for all branding text and the logo. Never recreate it in HTML/CSS and never alter the image pixels.
  This stylesheet only positions the functional login card.
*/

:root {
  --espresso: #30160c;
  --brown-700: #482313;
  --gold: #d99a2b;
  --gold-bright: #f4bd4a;
  --text: #fff8ec;
  --muted: #e7d4bc;
  --input-bg: #3b2116;
  --input-border: #c58a36;
  --input-focus: #ffd166;
}

* { box-sizing: border-box; }

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-weight: 500; /* slightly bold, same as the rest of the ERP */
  color: var(--text);
  background-color: #6b3d1c;
  background-image: url("../images/LOGINPAGE.423463691f17.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}

/* Desktop: artwork fills the screen, the login card sits on the right */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(6vw, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(6vw, env(safe-area-inset-left));
}

/* Opaque espresso-brown card: color comes from RGBA on the background only, so
   card content (text, inputs) stays fully opaque and readable -- never apply
   opacity: <1 to .login-card itself, that would fade the content too. */
.login-card {
  width: 100%;
  max-width: 400px;
  margin-right: clamp(0px, 4vw, 64px);
  background: rgba(48, 22, 12, 0.96);
  border: 2px solid var(--gold);
  border-radius: 22px;
  padding: 32px 30px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 18px 45px rgba(35, 14, 5, 0.38),
    0 0 0 1px rgba(255, 202, 112, 0.12);
}

/* Browser autofill must not turn the fields blue/white */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  background-color: var(--input-bg) !important;
  box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  transition: background-color 9999s ease-out 0s;
  caret-color: var(--text);
}
.field input:focus, .field select:focus { background: var(--input-bg); }
.login-card h2 {
  margin: 0; text-align: center; font-family: Georgia, "Times New Roman", serif;
  font-size: 32px; color: var(--text); text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.login-sub { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 15px; }
.login-card::after {
  content: ""; display: block; width: 90px; height: 2px; margin: 14px auto 22px; background: var(--gold);
}

.field {
  position: relative; display: flex; align-items: center;
  min-height: 48px; margin-bottom: 14px; padding: 0 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
}
.field:focus-within { border-color: var(--input-focus); box-shadow: 0 0 0 3px rgba(244,189,74,.18); }
.field-icon { width: 28px; text-align: center; color: var(--muted); font-size: 18px; }
.field input, .field select {
  flex: 1; min-width: 0; height: 46px; border: 0; outline: 0;
  background: var(--input-bg); color: var(--text); font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  padding: 0 8px;
}
.field input::placeholder { color: var(--muted); opacity: .85; }
.field select option { color: var(--text); background: var(--input-bg); }
.field select:invalid, .field select option[value=""] { color: var(--muted); }

.toggle-pass {
  min-width: 44px; min-height: 44px; border: 0; background: transparent;
  color: var(--muted); font-size: 18px; cursor: pointer;
}

.btn-login {
  width: 100%; min-height: 50px; margin-top: 8px; border-radius: 12px;
  background: linear-gradient(135deg, #6a3519, #35180d);
  border: 1px solid #e6a52e;
  color: var(--text); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 8px 18px rgba(0,0,0,.3);
}
.btn-login:hover {
  background: linear-gradient(135deg, #81451f, var(--brown-700));
  border-color: var(--input-focus);
}
.btn-login:active { transform: translateY(1px); }

.row-links {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; font-size: 14px; flex-wrap: wrap; gap: 8px;
}
.remember { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.remember input { width: 18px; height: 18px; accent-color: var(--gold); }
.forgot { color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

/* Phones and tablets: the whole artwork cannot fit, so the card sits in the lower
   part of the screen over the artwork. The card scrolls with the page if needed. */
@media (max-width: 860px) {
  body {
    background-attachment: scroll;
    background-position: 30% center;
  }
  .login-page {
    justify-content: center;
    align-items: flex-end;
    padding-top: 55vh;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .login-card { max-width: 440px; padding: 26px 20px; }
  .login-card h2 { font-size: 28px; }
  .field, .btn-login { min-height: 48px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .login-page { padding-left: 12px; padding-right: 12px; }
  .login-card { padding: 22px 16px; }
}

/* Landscape phones: the card stays on the right, with the artwork behind it */
@media (max-height: 520px) and (min-width: 600px) {
  .login-page { padding-top: 12px; padding-bottom: 12px; }
  .login-card { padding: 18px 22px; }
  .login-card::after { margin: 8px auto 14px; }
}
