:root {
  --lg-bg: #f5f6fa;
  --lg-surface: #ffffff;
  --lg-border: transparent; /* borders show on hover / focus only */
  --lg-text: #1f2937;
  --lg-muted: #6b7280;
  --lg-accent: #33506b;
  --lg-brand-from: #1f2d3d;
  --lg-brand-to: #33506b;
  --lg-panel-from: #e6eef7; /* light navy panel so the coloured logo keeps its own colours */
  --lg-panel-to: #c9dbee;
  --lg-panel-text: #1f2d3d;
  --lg-panel-muted: #4a5f77;
  --lg-field: #f3f6fb;
  --lg-danger: #b42318;
  --lg-danger-soft: #fdecea;
  --lg-radius: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--lg-bg);
  color: var(--lg-text);
  font-family: 'Cairo', sans-serif;
}

/* ---------- card: two vertical halves ---------- */
.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 960px;
  min-height: 560px;
  background: var(--lg-surface);
  border-radius: var(--lg-radius);
  box-shadow: 0 20px 50px rgba(16, 24, 40, .12);
  overflow: hidden;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px 40px;
  color: var(--lg-panel-text);
  text-align: center;
  background: linear-gradient(160deg, var(--lg-panel-from), var(--lg-panel-to));
  overflow: hidden;
}
.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(51, 80, 107, .08);
  pointer-events: none;
}
.login-brand::before { width: 340px; height: 340px; bottom: -130px; left: -110px; }
.login-brand::after  { width: 220px; height: 220px; top: -80px; right: -60px; }
.login-brand > * { position: relative; z-index: 1; }
.login-brand__logo { width: 240px; max-width: 80%; height: auto; }
.login-brand__title { font-size: 1.9rem; font-weight: 800; }
.login-brand__text { max-width: 300px; color: var(--lg-panel-muted); line-height: 1.8; }

/* road line under the brand text, a hint of the delivery theme */
.login-road { position: relative; width: 70%; height: 2px; margin-top: 12px; background: repeating-linear-gradient(90deg, rgba(51,80,107,.45) 0 14px, transparent 14px 26px); opacity: .7; }

.login-form-wrap { display: flex; flex-direction: column; justify-content: center; padding: 48px 48px 40px; }
.login-title { font-size: 1.6rem; font-weight: 800; }
.login-subtitle { margin: 6px 0 28px; color: var(--lg-muted); }

/* ---------- fields ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 700; }
.field__control { position: relative; }
.field__control > i.field__icon {
  position: absolute; top: 50%; right: 16px; transform: translateY(-50%);
  color: var(--lg-muted); font-size: 16px; pointer-events: none;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  height: 48px;
  padding: 0 46px;
  background: var(--lg-field);
  border: 1px solid var(--lg-border);
  border-radius: 12px;
  color: var(--lg-text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.field input::placeholder { color: #9aa4b2; }
.field input:focus { outline: none; background: #fff; border-color: var(--lg-brand-to); box-shadow: 0 0 0 3px rgba(51, 80, 107, .15); }
.field input.is-invalid { border-color: var(--lg-danger); background: #fff; }

.toggle-password {
  position: absolute; top: 50%; left: 8px; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--lg-muted); cursor: pointer; font-size: 16px;
}
.toggle-password:hover,
.toggle-password:focus-visible { background: rgba(31, 41, 55, .06); color: var(--lg-text); outline: none; }

.remember { display: flex; align-items: center; gap: 8px; margin: 4px 0 22px; color: var(--lg-muted); font-size: .92rem; }
.remember input { width: 17px; height: 17px; accent-color: var(--lg-brand-to); }

/* ---------- alerts from layouts.messages ---------- */
.login-card .alert {
  margin-bottom: 16px; padding: 10px 14px; border-radius: 10px;
  background: var(--lg-danger-soft) !important; color: var(--lg-danger) !important;
  border: 1px solid #f5c6c2; font-size: .9rem;
}
.login-card .alert.alert-success { background: #e6f4ec !important; color: #1f7a4d !important; border-color: #bfe3cf; }
.login-card .alert.alert-warning { background: #fdf3d8 !important; color: #9a6700 !important; border-color: #f0dba0; }
.login-card .alert i { margin-inline-end: 8px; }

/* ---------- submit button with the delivery animation ---------- */
.login-btn {
  position: relative;
  display: block;
  width: 100%;
  height: 44px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--lg-brand-from);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .25s ease, box-shadow .25s ease;
}
.login-btn:hover,
.login-btn:focus-visible { background: var(--lg-accent); box-shadow: 0 8px 20px rgba(51, 80, 107, .28); outline: none; }

.login-btn__label { position: relative; z-index: 2; transition: opacity .2s ease; }

/* progress trail that grows behind the vehicle */
.login-btn__trail {
  position: absolute; inset-block: 0; right: 0; width: 0;
  background: rgba(255, 255, 255, .16);
  z-index: 1;
}

/* the vehicle drives from the start (right) to the end (left) of the button */
.login-btn__vehicle {
  position: absolute; top: 50%; right: 14px; z-index: 3;
  font-size: 22px; line-height: 1;
  transform: translateY(-50%) scaleX(-1); /* icon faces left, the direction of travel in RTL */
  opacity: 0;
}

.login-btn.is-moving { pointer-events: none; background: var(--lg-brand-from); box-shadow: none; }
.login-btn.is-moving .login-btn__label { opacity: 0; }
.login-btn.is-moving .login-btn__trail { animation: lg-trail var(--lg-drive, .95s) cubic-bezier(.55, .05, .35, 1) forwards; }
.login-btn.is-moving .login-btn__vehicle { animation: lg-drive var(--lg-drive, .95s) cubic-bezier(.55, .05, .35, 1) forwards; }

@keyframes lg-drive {
  0%   { right: 14px; opacity: 0; }
  12%  { opacity: 1; }
  100% { right: calc(100% - 36px); opacity: 1; }
}
@keyframes lg-trail {
  0%   { width: 0; }
  100% { width: 100%; }
}

.login-footer { margin-top: 28px; color: var(--lg-muted); font-size: .82rem; text-align: center; }

/* ---------- small screens ---------- */
@media (max-width: 800px) {
  body { padding: 0; place-items: stretch; }
  .login-card { grid-template-columns: 1fr; min-height: 100vh; border-radius: 0; box-shadow: none; }
  .login-brand { padding: 32px 24px; gap: 12px; }
  .login-brand__logo { width: 170px; }
  .login-brand__title { font-size: 1.4rem; }
  .login-brand__text, .login-road { display: none; }
  .login-form-wrap { padding: 32px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-btn.is-moving .login-btn__trail,
  .login-btn.is-moving .login-btn__vehicle { animation-duration: .01s; }
}

.field input:hover { border-color: #33506b; }

/* ---------- stores / couriers login: account type cards + helper links ---------- */
.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 8px; }
.type-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 12px; border-radius: 16px;
  background: var(--lg-field); border: 1px solid var(--lg-border);
  color: var(--lg-text); text-decoration: none; text-align: center;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.type-card img { width: 110px; height: 110px; object-fit: contain; }
.type-card__name { font-size: 1.1rem; font-weight: 800; }
.type-card__hint { color: var(--lg-muted); font-size: .85rem; }
.type-card:hover,
.type-card:focus-visible { border-color: var(--lg-accent); transform: translateY(-3px); box-shadow: 0 10px 22px rgba(16, 24, 40, .10); outline: none; }

.login-links { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; text-align: center; }
.login-links a { color: var(--lg-muted); font-size: .92rem; text-decoration: none; }
.login-links a:hover,
.login-links a:focus-visible { color: var(--lg-accent); text-decoration: underline; outline: none; }

@media (max-width: 800px) { .type-grid { grid-template-columns: 1fr 1fr; } .type-card img { width: 84px; height: 84px; } }
@media (prefers-reduced-motion: reduce) { .type-card { transition: none; } .type-card:hover { transform: none; } }

/* ---------- store registration ---------- */
.login-card--wide { max-width: 1040px; min-height: 620px; }
.login-card--wide .login-form-wrap { padding: 40px 44px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .field--wide { grid-column: 1 / -1; }
.field__error { display: block; margin-top: 4px; color: var(--lg-danger); font-size: .82rem; }
.field input[type="email"] { width: 100%; }

.branch-chosen {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 0 16px; background: var(--lg-field); border: 1px solid var(--lg-border); border-radius: 12px;
}
.branch-chosen span { font-weight: 700; }
.branch-chosen a { color: var(--lg-muted); font-size: .88rem; text-decoration: none; }
.branch-chosen a:hover, .branch-chosen a:focus-visible { color: var(--lg-accent); text-decoration: underline; outline: none; }

.branch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 8px 0 4px; }
.branch-card {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 14px;
  background: var(--lg-field); border: 1px solid var(--lg-border);
  color: var(--lg-text); font-weight: 700; text-decoration: none;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.branch-card i { color: var(--lg-muted); font-size: 18px; }
.branch-card:hover, .branch-card:focus-visible { border-color: var(--lg-accent); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16, 24, 40, .08); outline: none; }

@media (max-width: 800px) {
  .login-card--wide .login-form-wrap { padding: 28px 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .branch-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .branch-card { transition: none; } .branch-card:hover { transform: none; } }
