/* ============================================================
   POSitive ERP — Login Page
   Professional redesign, brand-aligned, RTL-ready.
   Works inside the Frappe web template (templates/web.html).
   ============================================================ */

/* =========================
   0) Design tokens (brand identity)
   ========================= */
:root {
  /* Brand greens */
  --pos-primary:        #00c853;
  --pos-primary-strong: #00b84b;
  --pos-primary-deep:   #0a8a49;
  --pos-primary-soft:   #12c864;
  --pos-accent:         #fdcb01;

  /* Ink & text */
  --pos-ink:      #02150c;
  --pos-heading:  #0e2119;
  --pos-text:     #3a4a44;
  --pos-muted:    #7b8f81;

  /* Surfaces & borders */
  --pos-surface:      #ffffff;
  --pos-surface-2:    #f6faf7;
  --pos-border:       #e4ece7;
  --pos-field-border: #d7e2db;

  /* Radii */
  --pos-radius-sm: 10px;
  --pos-radius:    14px;
  --pos-radius-lg: 22px;

  /* Shadows */
  --pos-shadow-sm:  0 1px 2px rgba(2, 21, 12, 0.06);
  --pos-shadow-md:  0 12px 32px -14px rgba(2, 21, 12, 0.22);
  --pos-shadow-lg:  0 30px 70px -30px rgba(2, 21, 12, 0.35);
  --pos-shadow-btn: 0 12px 22px -10px rgba(0, 184, 75, 0.7);
  --pos-ring:       0 0 0 4px rgba(0, 200, 83, 0.16);

  /* Motion */
  --pos-ease:   cubic-bezier(0.22, 1, 0.36, 1);
  --pos-fast:   0.16s ease;
  --pos-smooth: 0.28s var(--pos-ease);

  /* Typography */
  --pos-font: "Inter", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", "Noto Sans Arabic", "Cairo",
    sans-serif;
}

/* =========================
   1) Hide ERPNext chrome / reset template padding
   ========================= */
.navbar,
.web-footer {
  display: none !important;
}

/* Empty Frappe chrome above the form */
#page-login .page-breadcrumbs,
#page-login .page-header-wrapper {
  display: none !important;
}

/* Neutralize every Frappe wrapper so the login fills the whole viewport.
   The web template nests: #page-login > .page-content-wrapper >
   main.container.my-4 > .page_content > .auth-wrapper — each layer adds
   margin / padding / max-width that otherwise leaves a white gap on top. */
#page-login,
#page-login .page-content-wrapper,
#page-login main,
#page-login main.container,
#page-login .page_content,
.page-content,
.layout-main-section,
#body {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* =========================
   2) Page base
   ========================= */
html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--pos-font);
  color: var(--pos-text);
  background-color: var(--pos-surface-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* =========================
   3) Layout shell
   ========================= */
.auth-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--pos-surface);
  overflow: hidden;
}

/* =========================
   4) Left panel — brand & illustration
   ========================= */
.left-panel {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 4vw, 4rem);
  overflow: hidden;
  isolation: isolate;

  background-color: #eef8f1;
  background-image:
    radial-gradient(120% 90% at 82% 8%, rgba(0, 200, 83, 0.16) 0%, rgba(0, 200, 83, 0) 55%),
    radial-gradient(90% 80% at 10% 100%, rgba(10, 138, 73, 0.14) 0%, rgba(10, 138, 73, 0) 60%),
    linear-gradient(160deg, #f2fbf5 0%, #e6f6ec 100%);
}

/* soft dotted texture */
.left-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(10, 138, 73, 0.08) 1.1px, transparent 1.2px);
  background-size: 26px 26px;
  mask-image: radial-gradient(75% 75% at 50% 45%, #000 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(75% 75% at 50% 45%, #000 0%, transparent 100%);
  opacity: 0.7;
}

/* glowing halo behind the hero */
.left-panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 46%;
  left: 50%;
  width: min(60vw, 620px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0, 200, 83, 0.28) 0%, rgba(0, 200, 83, 0) 68%);
  filter: blur(10px);
  pointer-events: none;
}

/* Logo */
.left-panel .logo {
  position: absolute;
  top: clamp(1.5rem, 3vw, 2.25rem);
  inset-inline-start: clamp(1.5rem, 3vw, 2.5rem);
  z-index: 3;
  display: inline-flex;
  align-items: center;
}

.left-panel .logo img {
  width: clamp(38px, 4vw, 48px);
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(2, 21, 12, 0.18));
}

/* Illustration */
.left-panel .illustration {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: clamp(340px, 42vw, 560px);
  display: flex;
  justify-content: center;
  animation: pos-float 6s ease-in-out infinite;
}

.left-panel .illustration .hero-illustration {
  position: relative;
  z-index: 2;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 40px 45px rgba(2, 21, 12, 0.18));
}

/* Decorative platform (bg.png) tucked beneath the hero */
.left-panel .bg-mask {
  position: absolute;
  z-index: 1;
  bottom: clamp(-2rem, -3vw, -1rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 620px);
  height: auto;
  opacity: 0.85;
  pointer-events: none;
  user-select: none;
}

@keyframes pos-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}

/* Dead template blocks kept neutralized (not present in markup) */
.left-panel .stats,
.demo-alert,
.separator {
  display: none;
}

/* =========================
   5) Right panel — the form
   ========================= */
.right-panel {
  position: relative;
  flex: 0 0 clamp(380px, 42%, 560px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(2.5rem, 4vw, 4rem) clamp(1.75rem, 3.5vw, 3.75rem);
  background: var(--pos-surface);
  color: var(--pos-text);
}

/* everything inside the form column shares one measure */
.right-panel > * {
  width: 100%;
  max-width: 400px;
}

.right-panel h1 {
  font-size: clamp(1.7rem, 2.4vw, 2.05rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
  color: var(--pos-heading);
}

.right-panel h1 span {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: pos-wave 2.6s ease-in-out infinite;
}

@keyframes pos-wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  70%           { transform: rotate(14deg); }
  80%           { transform: rotate(-8deg); }
  90%           { transform: rotate(10deg); }
}

.right-panel p.tagline {
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 2rem;
  color: var(--pos-muted);
}

/* =========================
   6) Form
   ========================= */
form.login-form {
  width: 100%;
}

.form-group {
  margin-bottom: 1.15rem;
}

form.login-form label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pos-heading);
}

form.login-form input[type="text"],
form.login-form input[type="password"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--pos-radius-sm);
  border: 1.5px solid var(--pos-field-border);
  background-color: var(--pos-surface);
  color: var(--pos-heading);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color var(--pos-fast), box-shadow var(--pos-fast),
    background-color var(--pos-fast);
}

form.login-form input::placeholder {
  color: #a9b6af;
}

form.login-form input[type="text"]:hover,
form.login-form input[type="password"]:hover {
  border-color: #bfd3c7;
}

form.login-form input[type="text"]:focus,
form.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--pos-primary);
  background-color: #fbfffc;
  box-shadow: var(--pos-ring);
}

/* browser autofill polish */
form.login-form input:-webkit-autofill,
form.login-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--pos-heading);
  transition: background-color 5000s ease-in-out 0s;
}

/* =========================
   7) Password field + toggle
   ========================= */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  padding-inline-end: 2.75rem;
}

.password-toggle {
  position: absolute;
  inset-inline-end: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--pos-muted);
  transition: color var(--pos-fast), background-color var(--pos-fast);
}

.password-toggle:hover {
  color: var(--pos-primary-deep);
  background: var(--pos-surface-2);
}

.password-toggle:focus-visible {
  outline: none;
  box-shadow: var(--pos-ring);
}

/* =========================
   8) Remember me + Forgot password
   ========================= */
.form-row {
  display: flex;
  align-items: center;
  margin-top: 0.5rem;
}

.form-row.between {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.checkbox-remember {
  display: inline-flex !important;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.checkbox-remember input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.checkbox-custom {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--pos-surface);
  border: 2px solid #cdd9d1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background-color var(--pos-fast), border-color var(--pos-fast),
    box-shadow var(--pos-fast), transform var(--pos-fast);
}

.checkbox-remember:hover .checkbox-custom {
  border-color: var(--pos-primary);
}

.checkbox-remember input:checked + .checkbox-custom {
  background: var(--pos-primary);
  border-color: var(--pos-primary);
  box-shadow: 0 6px 12px -4px rgba(0, 200, 83, 0.55);
}

.checkbox-remember input:checked + .checkbox-custom::after {
  content: "";
  width: 5px;
  height: 9px;
  margin-top: -2px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.checkbox-remember input:focus-visible + .checkbox-custom {
  box-shadow: var(--pos-ring);
}

.checkbox-label {
  font-size: 0.9rem;
  color: var(--pos-text);
}

.forgot-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pos-primary-deep);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--pos-fast);
}

.forgot-link:hover {
  color: var(--pos-primary-strong);
  text-decoration: underline;
}

/* =========================
   9) Primary button (Login)
   ========================= */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem 2.25rem;
  border: none;
  border-radius: var(--pos-radius-sm);
  background-image: linear-gradient(135deg, var(--pos-primary-soft) 0%, var(--pos-primary-strong) 55%, var(--pos-primary-deep) 100%);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--pos-shadow-btn);
  transition: box-shadow var(--pos-smooth), transform var(--pos-fast),
    filter var(--pos-fast), opacity var(--pos-fast);
}

.btn-primary.is-full {
  width: 100%;
}

.btn-primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 16px 28px -10px rgba(0, 184, 75, 0.75);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px -8px rgba(0, 184, 75, 0.6);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--pos-shadow-btn), var(--pos-ring);
}

/* loading state */
.btn-primary.is-loading {
  color: transparent;
  pointer-events: none;
  opacity: 0.92;
}

.btn-primary.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: pos-spin 0.6s linear infinite;
}

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

/* =========================
   10) Footer — create account
   ========================= */
.login-footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--pos-muted);
  margin-top: 1.75rem;
}

.login-footer a {
  color: var(--pos-primary-deep);
  text-decoration: none;
  margin-inline-start: 0.3rem;
  font-weight: 600;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* =========================
   11) Divider "or"
   ========================= */
.divider-or {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.6rem 0;
  color: var(--pos-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider-or::before,
.divider-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--pos-border);
}

.divider-or span {
  margin: 0 0.85rem;
}

/* =========================
   12) Google button
   ========================= */
.social-login {
  display: flex;
  justify-content: center;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  border-radius: var(--pos-radius-sm);
  border: 1.5px solid var(--pos-field-border);
  background-color: var(--pos-surface);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--pos-heading);
  box-shadow: var(--pos-shadow-sm);
  transition: border-color var(--pos-fast), box-shadow var(--pos-fast),
    transform var(--pos-fast), background-color var(--pos-fast);
}

.btn-google:hover {
  border-color: #bfd3c7;
  background-color: var(--pos-surface-2);
  box-shadow: var(--pos-shadow-md);
  transform: translateY(-1px);
}

.btn-google:focus-visible {
  outline: none;
  box-shadow: var(--pos-ring);
}

.google-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: Arial, sans-serif;
  font-size: 1rem;
  color: #ea4335;
}

.btn-google .fa-google {
  color: #ea4335;
  font-size: 1.05rem;
}

.google-text {
  white-space: nowrap;
}

/* =========================
   13) Responsive
   ========================= */
@media (max-width: 992px) {
  .right-panel {
    flex-basis: clamp(360px, 46%, 520px);
  }
}

@media (max-width: 820px) {
  .auth-wrapper {
    flex-direction: column;
  }

  .left-panel {
    flex: 0 0 auto;
    min-height: 240px;
    padding: 3.5rem 1.5rem 2rem;
  }

  .left-panel .illustration {
    max-width: 240px;
    animation: none;
  }

  .left-panel .bg-mask {
    display: none;
  }

  .right-panel {
    flex: 1 1 auto;
    max-width: 100%;
    justify-content: flex-start;
    padding: 2.5rem 1.5rem 3rem;
  }
}

@media (max-width: 480px) {
  .left-panel {
    display: none;
  }

  .right-panel {
    justify-content: center;
    padding: 2.5rem 1.35rem;
  }

  .right-panel > * {
    max-width: 100%;
  }
}

/* =========================
   14) Accessibility & motion
   ========================= */
:focus-visible {
  outline: 2px solid transparent;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
