/**
 * Auth pages (signup, login, forgot-password).
 * Self-contained card + form styles so pages render correctly even if style.css fails to load.
 */
:root {
  --auth-primary: #005a6a;
  --auth-card-bg: #f1f1f1;
  --auth-page-bg: radial-gradient(circle at top left, #e0eef0 0%, #005a6a 100%);
}

body.auth-page {
  margin: 0;
  font-family: var(--jiilna-font-family, 'Nunito', system-ui, sans-serif);
  background: var(--auth-page-bg);
  color: #1e293b;
  min-height: 100vh;
  min-height: 100dvh;
  height: auto !important;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

body.auth-page > .container,
body.auth-page > .auth-container,
body.auth-page > .card {
  flex-shrink: 0;
  width: min(100%, 520px);
  margin: auto;
  position: relative;
  z-index: 1;
  background: var(--auth-card-bg);
  padding: 60px 50px;
  border-radius: 60px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

body.auth-page > .auth-container {
  padding: 50px;
  border-radius: 50px;
}

body.auth-page h2 {
  margin: 0 0 24px;
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
}

body.auth-page .logo {
  margin-bottom: 8px;
}

body.auth-page .auth-page-title {
  margin: 0.35rem 0 0.15rem;
  text-align: center;
  color: var(--auth-primary, #005a6a);
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 700;
  line-height: 1.3;
}

body.auth-page .signup-error {
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.92);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}

body.auth-page .logo a,
body.auth-page .logo a.logo-brand {
  font-size: 35px;
  font-weight: 800;
  color: var(--jiilna-logo-color, #000) !important;
  text-decoration: none !important;
  display: block;
  letter-spacing: 0.08em;
}

body.auth-page input:not([type="hidden"]):not([type="checkbox"]),
body.auth-page select {
  width: 100%;
  padding: 18px 25px;
  margin-bottom: 20px;
  border: 1px solid #ccc;
  border-radius: 20px;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

body.auth-page input:focus:not([type="hidden"]):not([type="checkbox"]),
body.auth-page select:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(0, 90, 106, 0.12);
}

body.auth-page .btn,
body.auth-page .btn-send {
  display: block;
  width: 100%;
  padding: 18px;
  background: var(--auth-primary);
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

body.auth-page .btn:hover,
body.auth-page .btn-send:hover {
  background: #004a57;
}

body.auth-page .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

body.auth-page .forgot-pass {
  margin: -6px 0 24px;
}

body.auth-page .forgot-pass a {
  color: #888;
  text-decoration: none;
  font-size: 14px;
}

body.auth-page .forgot-pass a:hover {
  color: var(--auth-primary);
}

body.auth-page .footer-text {
  margin-top: 25px;
  color: #666;
  font-size: 14px;
}

body.auth-page .footer-text a {
  color: var(--auth-primary);
  font-weight: 700;
  text-decoration: none;
}

body.auth-page .message,
body.auth-page .login-feedback {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

body.auth-page .message.success,
body.auth-page .login-feedback.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

body.auth-page .message.error,
body.auth-page .login-feedback.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

body.auth-page .message.info,
body.auth-page .login-feedback.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

body.auth-page .name-row {
  flex-direction: column;
  gap: 0;
}

body.auth-page .name-row input {
  width: 100%;
}

@media (max-width: 768px) {
  body.auth-page > .container,
  body.auth-page > .auth-container,
  body.auth-page > .card {
    width: 100% !important;
    max-width: 100% !important;
    margin: auto !important;
    padding: 28px 20px !important;
    border-radius: 28px !important;
    transform: none !important;
  }

  body.auth-page .tabs {
    gap: 20px;
  }

  body.auth-page .logo a {
    margin-bottom: 24px;
  }
}

@media (max-width: 480px) {
  body.auth-page > .container,
  body.auth-page > .auth-container,
  body.auth-page > .card {
    margin: auto !important;
    padding: 24px 16px !important;
    border-radius: 24px !important;
  }

  body.auth-page input,
  body.auth-page select,
  body.auth-page .btn {
    font-size: 16px !important;
  }
}

/* Email + password: always LTR (Arabic and English) */
body.auth-page input[type="email"],
body.auth-page input[name="email"],
body.auth-page input[type="password"],
body.auth-page input[name="password"],
body.auth-page .password-input {
  direction: ltr;
  text-align: left;
}

body.auth-page.lang-ar select {
  text-align: right;
  direction: rtl;
}

body.auth-page.lang-en select {
  text-align: left;
  direction: ltr;
}

/* RTL / LTR — login (.container) and forgot-password (.auth-container) */
body.auth-page.lang-ar .container,
body.auth-page.lang-ar .auth-container {
  direction: rtl;
  text-align: right;
}

body.auth-page.lang-ar .container .logo,
body.auth-page.lang-ar .container .logo a,
body.auth-page.lang-ar .container h2,
body.auth-page.lang-ar .container p,
body.auth-page.lang-ar .container form,
body.auth-page.lang-ar .container .forgot-pass,
body.auth-page.lang-ar .container .footer-text,
body.auth-page.lang-ar .container .message,
body.auth-page.lang-ar .auth-container .logo,
body.auth-page.lang-ar .auth-container .logo a,
body.auth-page.lang-ar .auth-container h2,
body.auth-page.lang-ar .auth-container p,
body.auth-page.lang-ar .auth-container form,
body.auth-page.lang-ar .auth-container .blue-link,
body.auth-page.lang-ar .auth-container .message {
  text-align: right;
}

body.auth-page.lang-en .container,
body.auth-page.lang-en .auth-container {
  direction: ltr;
  text-align: left;
}

body.auth-page.lang-en .container .logo,
body.auth-page.lang-en .container .logo a,
body.auth-page.lang-en .container h2,
body.auth-page.lang-en .container p,
body.auth-page.lang-en .container form,
body.auth-page.lang-en .container .forgot-pass,
body.auth-page.lang-en .container .footer-text,
body.auth-page.lang-en .container .message,
body.auth-page.lang-en .auth-container .logo,
body.auth-page.lang-en .auth-container .logo a,
body.auth-page.lang-en .auth-container h2,
body.auth-page.lang-en .auth-container p,
body.auth-page.lang-en .auth-container form,
body.auth-page.lang-en .auth-container .blue-link,
body.auth-page.lang-en .auth-container .message {
  text-align: left;
}

/* Password visibility toggle — icon centered vertically on the right */
body.auth-page .password-field {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
  direction: ltr;
}

body.auth-page .password-field .password-input {
  width: 100%;
  margin: 0 !important;
  padding: 18px 48px 18px 25px;
  border: 1px solid #ccc;
  border-radius: 20px;
  background: transparent;
  font-size: 16px;
  line-height: 1.25;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  direction: ltr;
  text-align: left;
}

body.auth-page .password-visibility-toggle {
  position: absolute;
  right: 10px;
  top: 0;
  bottom: 0;
  left: auto;
  width: 36px;
  height: 36px;
  margin: auto 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transform: none;
  transition: color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
  z-index: 2;
}

body.auth-page .password-visibility-toggle:hover {
  color: #005a6a;
  background-color: rgba(0, 90, 106, 0.08);
}

body.auth-page .password-visibility-toggle:focus-visible {
  outline: 2px solid #005a6a;
  outline-offset: 2px;
}

body.auth-page .password-visibility-toggle .pw-icon {
  display: block;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body.auth-page .password-visibility-toggle .pw-icon[hidden] {
  display: none;
}

body.auth-page .password-visibility-toggle.is-visible .pw-icon-eye {
  opacity: 0;
  transform: scale(0.85);
}

body.auth-page .password-visibility-toggle.is-visible .pw-icon-eye-slash {
  opacity: 1;
  transform: scale(1);
}

body.auth-page .auth-login-card {
  position: relative;
}

body.auth-page .auth-lang-switcher {
  position: absolute;
  top: 20px;
  inset-inline-end: 20px;
  z-index: 2;
}

body.auth-page .auth-lang-switcher .custom-lang-switcher {
  margin: 0;
}

body.auth-page.lang-ar .auth-lang-switcher {
  top: 18px;
  inset-inline-end: 18px;
}
