/*
 * Persian Suite — Clean Two-Column Split-Card Login Redesign
 *
 * Applies identically to:
 *   1. Admin Authentication screens (body.login_admin: login, OTP, forgot/reset password, 2FA)
 *   2. Customer Portal Authentication screens (body.ps-client-auth: /authentication/login,
 *      /authentication/forgot_password, /authentication/register, and OTP client login)
 */

:root {
  --ps-canvas-1: #f4f9ff;
  --ps-canvas-2: #edf5ff;
  --ps-brand-bg-1: #eaf2ff;
  --ps-brand-bg-2: #dceaff;
  --ps-card-bg: #ffffff;
  --ps-text: #0f172a;
  --ps-text-secondary: #475569;
  --ps-muted: #64748b;
  --ps-border: #d5dfec;
  --ps-border-soft: #e6edf7;
  --ps-primary: #0092d6;
  --ps-primary-2: #007ec4;
  --ps-primary-glow: rgba(0, 146, 214, 0.28);
  --ps-blue-icon: #2563eb;
  --ps-danger: #c62828;
}

@keyframes psCardAppear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes psSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================================
 * 1. SHARED AUTH CANVAS (Admin + Customer Portal Auth)
 * ========================================================================== */

body.login_admin,
body.ps-client-auth {
  min-height: 100vh;
  margin: 0 !important;
  padding: 32px 20px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 12% 14%, rgba(219, 234, 254, 0.65), transparent 42%),
    radial-gradient(circle at 88% 86%, rgba(224, 242, 254, 0.72), transparent 44%),
    linear-gradient(135deg, var(--ps-canvas-1) 0%, #f9fcff 52%, var(--ps-canvas-2) 100%) !important;
  color: var(--ps-text);
  -webkit-font-smoothing: antialiased;
}

/* Hide stock Perfex customer navbar & footer on customer auth screens */
body.ps-client-auth nav.navbar,
body.ps-client-auth .header,
body.ps-client-auth footer.footer,
body.ps-client-auth .navbar-fixed-top {
  display: none !important;
}

body.ps-client-auth #wrapper,
body.ps-client-auth #content,
body.ps-client-auth #content > .container {
  width: 100% !important;
  max-width: 1020px !important;
  min-height: auto !important;
  margin: 0 auto !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.login_admin .authentication-form-wrapper,
body.ps-client-auth .ps-client-auth-wrapper {
  width: 100%;
  max-width: 980px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  animation: psCardAppear 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.ps-client-auth.ps-client-register .ps-client-auth-wrapper {
  max-width: 1060px !important;
}

/* Unified split card */
.ps-split-card {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  background: var(--ps-card-bg);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow:
    0 24px 60px -18px rgba(15, 36, 74, 0.14),
    0 8px 24px -12px rgba(15, 36, 74, 0.08);
  min-height: 500px;
}

body.ps-client-auth.ps-client-register .ps-split-card {
  grid-template-columns: 1.35fr 0.85fr;
}

/* ============================================================================
 * 2. FORM PANEL (Right side in RTL)
 * ========================================================================== */

.ps-form-panel {
  background: #ffffff;
  padding: 44px 46px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ps-form-header {
  margin-bottom: 24px;
}

.ps-form-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ps-form-title-icon {
  color: var(--ps-blue-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ps-form-title-icon svg {
  width: 24px;
  height: 24px;
}

.ps-form-panel .ps-form-title-row h1,
.ps-form-panel .ps-form-title-row h2,
.ps-form-panel .ps-form-title-row h3 {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  color: var(--ps-text) !important;
  text-align: start !important;
  line-height: 1.35;
}

.ps-form-subtitle {
  margin: 0 !important;
  font-size: 13.5px !important;
  color: var(--ps-muted) !important;
  line-height: 1.75;
  text-align: start !important;
}

/* Flatten ALL nested Perfex / Bootstrap / OTP wrappers inside .ps-form-panel */
.ps-form-panel .ps-native-form-box,
.ps-form-panel .ps-native-form-box .panel_s,
.ps-form-panel .ps-native-form-box .panel-body,
.ps-form-panel .ps-native-form-box .mtop40,
.ps-form-panel .ps-native-form-box > div.tw-bg-white,
.ps-form-panel .ps-native-form-box > div[class*="tw-shadow"],
.ps-form-panel .ps-native-form-box > div[class*="tw-border"] {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  width: 100% !important;
  float: none !important;
}

.ps-form-panel .form-group {
  margin-bottom: 16px;
}

.ps-form-panel label.control-label,
.ps-form-panel .form-group > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.ps-form-panel input.form-control,
.ps-form-panel select.form-control {
  height: 48px !important;
  padding: 10px 15px !important;
  font-size: 14px !important;
  color: var(--ps-text) !important;
  background-color: #ffffff !important;
  border: 1.5px solid var(--ps-border) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.ps-form-panel input.form-control:hover {
  border-color: #94a3b8 !important;
}

.ps-form-panel input.form-control:focus {
  border-color: var(--ps-primary) !important;
  box-shadow: 0 0 0 3.5px rgba(0, 146, 214, 0.14) !important;
  outline: none !important;
}

.ps-form-panel input[type="email"],
.ps-form-panel input[type="tel"] {
  direction: ltr;
  text-align: left;
}

/* Password toggle wrapper */
.ps-pw-wrap {
  position: relative;
  display: block;
}

.ps-pw-wrap input.form-control {
  padding-inline-end: 46px !important;
}

.ps-pw-toggle {
  position: absolute;
  top: 50%;
  inset-inline-end: 8px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ps-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 150ms ease, background-color 150ms ease;
}

.ps-pw-toggle:hover {
  color: var(--ps-primary);
  background-color: rgba(0, 146, 214, 0.08);
}

.ps-pw-toggle svg {
  width: 18px;
  height: 18px;
}

/* Checkbox */
.ps-form-panel .checkbox {
  margin: 4px 0 8px;
}

.ps-form-panel .checkbox label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ps-text-secondary);
  cursor: pointer;
}

.ps-form-panel .checkbox input[type="checkbox"] {
  accent-color: var(--ps-primary);
}

/* Vibrant cyan-blue primary submit button */
.ps-form-panel button[type="submit"].btn-primary,
.ps-form-panel button[type="submit"].btn-info,
.ps-form-panel .btn.btn-primary.btn-block,
.ps-form-panel button.tw-bg-primary-600 {
  width: 100%;
  height: 48px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: linear-gradient(90deg, var(--ps-primary-2) 0%, var(--ps-primary) 100%) !important;
  color: #ffffff !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 22px -8px var(--ps-primary-glow) !important;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease !important;
}

.ps-form-panel button[type="submit"].btn-primary:hover,
.ps-form-panel button[type="submit"].btn-info:hover,
.ps-form-panel .btn.btn-primary.btn-block:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 14px 26px -8px var(--ps-primary-glow) !important;
}

.ps-btn-loading {
  opacity: 0.86;
  pointer-events: none;
}

.ps-btn-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: psSpin 650ms linear infinite;
}

/* Divider ("سایر گزینه‌ها") */
.ps-form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: #94a3b8;
  font-size: 12px;
}

.ps-form-divider::before,
.ps-form-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ps-border-soft);
}

/* Secondary outlined buttons grid */
.ps-secondary-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.ps-secondary-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px !important;
  border: 1px solid var(--ps-border) !important;
  background: #f8fafc !important;
  color: #1e293b !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.ps-secondary-btn:hover {
  background: #eff6ff !important;
  border-color: #93c5fd !important;
  color: var(--ps-blue-icon) !important;
}

/* Alerts */
.ps-form-panel .alert {
  border-radius: 10px !important;
  border: 0 !important;
  border-inline-start: 3.5px solid currentColor !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  line-height: 1.65;
  margin-bottom: 16px !important;
}

.ps-form-panel .alert-danger {
  background: #fef2f2 !important;
  color: var(--ps-danger) !important;
}

.ps-form-panel .alert-success {
  background: #ecfdf5 !important;
  color: #047857 !important;
}

/* Form panel footer credit */
.ps-form-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

/* ============================================================================
 * 3. BRAND & FEATURES PANEL (Left side in RTL)
 * ========================================================================== */

.ps-brand-panel {
  background: linear-gradient(180deg, var(--ps-brand-bg-1) 0%, var(--ps-brand-bg-2) 100%);
  padding: 40px 38px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-inline-start: 1px solid rgba(37, 99, 235, 0.08);
  position: relative;
}

.ps-brand-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.ps-brand-logo-wrap {
  margin-bottom: 18px;
}

.ps-brand-logo-wrap .company-logo,
.ps-brand-logo-wrap .ps-cloned-logo {
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  text-align: start !important;
}

.ps-brand-logo-wrap a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 18px -6px rgba(15, 36, 74, 0.14);
}

.ps-brand-logo-wrap img {
  max-height: 38px;
  width: auto;
  display: block;
}

/* White pill badge */
.ps-version-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ps-blue-icon);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 6px 18px -6px rgba(37, 99, 235, 0.22);
  margin-bottom: 20px;
}

.ps-version-pill svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ps-brand-title {
  margin: 0 0 12px;
  font-size: 21px;
  font-weight: 800;
  color: var(--ps-text);
  line-height: 1.45;
}

.ps-brand-desc {
  margin: 0 0 28px;
  font-size: 13.5px;
  color: var(--ps-text-secondary);
  line-height: 1.85;
}

/* Feature list with white rounded-square icon tiles */
.ps-feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.ps-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
}

.ps-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ps-blue-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -2px rgba(15, 36, 74, 0.08);
}

.ps-feature-icon svg {
  width: 18px;
  height: 18px;
}

/* Bottom security badge */
.ps-security-note {
  margin-top: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ps-muted);
}

.ps-security-note svg {
  width: 14px;
  height: 14px;
  color: var(--ps-blue-icon);
  flex-shrink: 0;
}

/* ============================================================================
 * 4. RESPONSIVE
 * ========================================================================== */

@media (max-width: 860px) {
  body.login_admin,
  body.ps-client-auth {
    padding: 20px 12px !important;
  }

  .ps-split-card,
  body.ps-client-auth.ps-client-register .ps-split-card {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
    min-height: auto;
  }

  .ps-form-panel {
    padding: 32px 24px 28px;
  }

  .ps-brand-panel {
    padding: 28px 24px;
    border-inline-start: 0;
    border-top: 1px solid rgba(37, 99, 235, 0.08);
  }
}
