/* ============================================================
   Azad ERP — enterprise login page (only file loaded by login.html)
   Direction comes from <html dir>, so RTL/LTR mirror automatically.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  /* Language-aware stacks: Tajawal for Arabic, native UI sans for English.
     No new font dependency — both are already available to the browser. */
  --font-ar: 'Tajawal', 'Cairo', system-ui, sans-serif;
  --font-en: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

html, body {
  margin: 0;
  min-height: 100%;
}
html { font-family: var(--font-en); }
html[lang='ar'] { font-family: var(--font-ar); }
body.login-page {
  font-family: inherit;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #2d3748;
}

/* Secondary language control — kept outside the primary card flow. */
.login-lang {
  position: fixed;
  inset-block-start: 16px;
  inset-inline-end: 16px;
  z-index: 1050;
}
.login-lang .dropdown-toggle {
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #fff;
}
.login-lang .dropdown-toggle::after { margin-inline-start: .35rem; }
.login-lang .dropdown-menu {
  min-width: 9rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  font-size: .9rem;
}
.login-lang .dropdown-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .9rem;
}
.login-lang .dropdown-item i { width: 1rem; }

/* Card --------------------------------------------------------------- */
.login-shell {
  width: 100%;
  max-width: 440px;
  margin: auto;
}
.login-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(24, 20, 60, .28);
}

/* Header: compact, logo + identity, ~150-190px on desktop ------------ */
.login-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  text-align: center;
  padding: 16px 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-radius: 16px 16px 0 0;
}
.login-logo-img {
  height: 88px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .18));
}
.login-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.login-product {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .2px;
}
html[lang='ar'] .login-product { letter-spacing: 0; font-size: 1.2rem; }
.login-tagline {
  font-size: .84rem;
  font-weight: 400;
  line-height: 1.5;
  opacity: .92;
}
html[lang='ar'] .login-tagline { font-size: .86rem; }
.login-location {
  font-size: .76rem;
  font-weight: 400;
  line-height: 1.4;
  opacity: .78;
}

/* Form ---------------------------------------------------------------- */
.login-body {
  padding: 16px 22px 12px;
}
.login-box-msg {
  margin: 0 0 12px;
  text-align: center;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.5;
  color: #2d3748;
}
html[lang='ar'] .login-box-msg { font-size: .98rem; }
.palestine-flag {
  display: inline-block;
  width: 18px;
  height: 12px;
  margin-inline: 3px;
  vertical-align: -1px;
  background: linear-gradient(180deg, #000 0 33.33%, #fff 33.33% 66.66%, #007a3d 66.66% 100%);
  position: relative;
}
.palestine-flag::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  border-style: solid;
  border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent #ce1126;
}

/* Notifications render only when present — no reserved empty space. */
.login-body .alert {
  margin: 0 0 10px;
  border-radius: 8px;
  padding: .55rem .8rem;
  font-size: .85rem;
  text-align: start;
  box-shadow: none;
}
.login-body .alert-danger { background: #fdecea; color: #8a1c11; border: 1px solid #f5c2c0; }
.login-body .alert-success { background: #e8f7ee; color: #14532d; border: 1px solid #b7e1c6; }
.login-body .alert-warning { background: #fff8e1; color: #7a5600; border: 1px solid #ffe08a; }
.login-body .alert-info { background: #e8f4fd; color: #0c5460; border: 1px solid #b8dcf5; }
.login-body .alert .close { font-size: 1.1rem; line-height: 1; inset-inline-end: .5rem; }

.auth-input-group {
  margin-bottom: 10px !important;
  align-items: stretch;
}
.auth-input-group .form-control {
  height: 44px;
  min-height: 44px;
  border: 1px solid #d8deea;
  border-radius: 8px 0 0 8px;
  padding: 0 14px;
  font-family: inherit;
  font-size: .93rem;
  font-weight: 400;
  line-height: 44px;
  text-align: start;
  box-shadow: none;
}
html[lang='ar'] .auth-input-group .form-control { font-size: .95rem; }
html[dir='rtl'] .auth-input-group .form-control {
  border-radius: 0 8px 8px 0;
}
.auth-input-group .form-control::placeholder { color: #8b95a7; opacity: 1; text-align: start; }
.auth-input-group .form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .14);
  outline: none;
  z-index: 2;
}
.auth-input-group .input-group-append { display: flex; }
.auth-input-group .input-group-text {
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f8fc;
  border: 1px solid #d8deea;
  color: #6b7689;
  border-radius: 0 8px 8px 0;
  font-size: .95rem;
}
html[dir='rtl'] .auth-input-group .input-group-text { border-radius: 8px 0 0 8px; }
.auth-input-group .toggle-password {
  cursor: pointer;
  border-inline-start: 0;
  background: #f6f8fc;
}
html[dir='rtl'] .auth-input-group .toggle-password { border-inline-end: 0; }
.auth-input-group .toggle-password:hover { color: #667eea; background: #eef1fb; }

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 6px;
}
.login-remember { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.icheck-primary {
  display: flex !important;
  align-items: center !important;
  gap: .5rem !important;
}
.icheck-primary > input[type='checkbox'] {
  position: static !important;
  opacity: 1 !important;
  inset: auto !important;
  margin: 0 !important;
  width: 15px !important;
  height: 15px !important;
  flex: none !important;
  accent-color: #667eea;
  cursor: pointer;
}
.icheck-primary label {
  margin: 0 !important;
  padding: 0 !important;
  font-size: .82rem;
  color: #4a5568;
  cursor: pointer;
}
.icheck-primary label::before,
.icheck-primary label::after { display: none !important; }
.login-recover {
  font-size: .78rem;
  line-height: 1.4;
  color: #5b6472;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.login-recover:hover { color: #667eea; text-decoration: underline; }
.login-submit {
  font-family: inherit;
  letter-spacing: .2px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  padding: .65rem 1.4rem;
  min-width: 130px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  box-shadow: 0 5px 14px rgba(102, 126, 234, .28);
  transition: transform .2s ease, box-shadow .2s ease;
  flex: none;
}
.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, .35);
  color: #fff;
}

/* Footer: compact developer credit, no image -------------------------- */
.login-footer {
  background: #f7f8fc;
  border-top: 1px solid #edf0f7;
  padding: 10px 16px 12px;
  text-align: center;
  color: #5b6472;
  font-size: .78rem;
  line-height: 1.5;
  border-radius: 0 0 16px 16px;
}
.login-footer-company {
  font-weight: 600;
  letter-spacing: .1px;
  color: #3f4859;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
.login-footer-dev { margin-top: 2px; }
.login-footer-wa {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: 4px;
  color: #12805a;
  text-decoration: none;
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
}
.login-footer-wa:hover { color: #0a553c; text-decoration: underline; }

/* Responsive ---------------------------------------------------------- */
@media (max-width: 480px) {
  body.login-page { padding: 16px 12px; }
  .login-header { padding: 14px 16px 12px; }
  .login-logo-img { height: 76px; }
  .login-product { font-size: 1.1rem; }
  .login-body { padding: 14px 16px 10px; }
  .login-actions { flex-wrap: wrap; }
  .login-submit { width: 100%; }
  .login-lang { inset-block-start: 10px; inset-inline-end: 10px; }
}

@media (max-height: 720px) and (min-width: 481px) {
  body.login-page { padding-block: 12px; }
  .login-logo-img { height: 76px; }
  .login-header { padding-block: 12px 10px; }
  .login-body { padding-block: 12px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-submit { transition: none; }
}
