/* =========================================================
   LexLegis Auth — F7 login-screen styled pages
   Pages use F7's native classes: .login-screen-content,
   .login-screen-title, .list-strong-ios .inset, .list-button,
   .block-footer. This file only adds the small extras.
   ========================================================= */

.auth-page {
  --lex-primary: #4b5565;
  --auth-text-primary: #000000;
  --auth-text-secondary: #000000;
  --auth-bg: #ffffff;
  --lex-select-light: #fafafa;
  --lex-select-dark: #222630;
  --lex-select-text-light: #0b0b0d;
  --lex-select-text-dark: #ffffff;
  --f7-theme-color: var(--lex-primary);
}

html.dark .auth-page,
.dark .auth-page,
.dark-mode .auth-page {
  --auth-text-primary: #ffffff;
  --auth-text-secondary: #ffffff;
  --auth-bg: #0b0b0d;
  --lex-select-bg: var(--lex-select-dark);
  --lex-select-text: var(--lex-select-text-dark);
}

.auth-page {
  --lex-select-bg: var(--lex-select-light);
  --lex-select-text: var(--lex-select-text-light);
}

/* Subtitle directly under .login-screen-title */
.login-screen-content .login-screen-subtitle {
  margin: 8px auto 18px;
  max-width: 32em;
  padding: 0 16px;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  color: var(--auth-text-secondary);
}
html.md .login-screen-content .login-screen-subtitle { font-size: 14px; }

/* Page background follows app tokens */
.auth-page .page-content { background: var(--auth-bg); color: var(--auth-text-primary); }
html.dark .auth-page .page-content,
.dark .auth-page .page-content { background: var(--color-bg, #0b0b0d); }

.auth-page .login-screen-title,
.auth-page .item-title,
.auth-page .item-label,
.auth-page .item-input-wrap input,
.auth-page .item-input-wrap textarea,
.auth-page .block-title,
.auth-page .block-footer,
.auth-page .auth-footer-links,
.auth-page .otp-hint,
.auth-page .auth-terms,
.auth-page .auth-terms a {
  color: var(--auth-text-primary);
}

.auth-page .item-input-wrap input::placeholder,
.auth-page .item-input-wrap textarea::placeholder {
  color: var(--auth-text-secondary);
  opacity: 0.7;
}

/* Inline error banner */
.auth-error {
  display: none;
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin: 0 var(--f7-list-inset-side-margin, 16px) 12px;
}
.auth-error.visible { display: block; }

/* Footer link rows under the submit button (use F7 .block-footer) */
.auth-footer-links { text-align: center; }
.auth-footer-links a {
  color: var(--auth-text-primary);
  font-weight: 600;
  text-decoration: none;
}
.auth-footer-links .auth-dot { margin: 0 6px; opacity: 0.6; }

.auth-forgot-inline {
  text-align: right;
  margin-top: -2px;
  margin-bottom: 10px;
  padding-right: 4px;
}

.auth-sso-group {
  display: grid;
  gap: 10px;
  margin: 10px;
}

.auth-sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border-radius: 10px;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 600;
  color: #000000 !important;
  background: var(--color-secondary, #ffffff);
  border: 1px solid color-mix(in srgb, var(--color-secondary, #ffffff) 85%, #000 15%);
  
}
.auth-sso-btn:hover {
  background: var(--color-secondary, #FAFAFA);
}

.auth-sso-btn:active {
  opacity: 0.92;
}

html.dark .auth-sso-btn,
.dark .auth-sso-btn,
.dark-mode .auth-sso-btn {
  color: #ffffff !important;
  background: #0b0b0d;
  border: 1px solid #ffffff;
}

html.dark .auth-sso-btn:hover,
.dark .auth-sso-btn:hover,
.dark-mode .auth-sso-btn:hover {
  background: #16181d;
}

.auth-sso-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.auth-sso-logo svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Terms checkbox row */
.auth-terms-block { padding-top: 4px; padding-bottom: 4px; }
.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--auth-text-primary);
  line-height: 1.5;
}
.auth-terms input { margin-top: 3px; }
.auth-terms a { color: var(--auth-text-primary); font-weight: 600; }

.auth-terms-check {
  --f7-checkbox-active-color: var(--lex-primary);
}

.auth-terms-check .auth-terms-text {
  color: var(--auth-text-primary);
  font-size: 13px;
  line-height: 1.45;
}

.auth-terms-check .auth-terms-text a {
  color: var(--auth-text-primary);
  font-weight: 600;
  text-decoration: underline;
}

/* Primary CTA on all auth screens */
.auth-page .list-button,
.auth-page a.list-button,
.auth-page .button.button-fill {
  background: #4b5565;
  border: 1px solid #4b5565;
  color: #ffffff;
  border-radius: 10px;
  font-weight: 600;
  margin: 10px  !important  /* override F7 list-button margins */       ;
}

.auth-page .list-button:active,
.auth-page a.list-button:active,
.auth-page .button.button-fill:active {
  background: #3f4754;
  border-color: #3f4754;
}

.auth-page .list-button.is-loading,
.auth-page a.list-button.is-loading,
.auth-page .button.button-fill.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.9;
}

.auth-page .list-button.is-loading::after,
.auth-page a.list-button.is-loading::after,
.auth-page .button.button-fill.is-loading::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  animation: auth-btn-spin 0.7s linear infinite;
}

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

.password-field-wrap {
  position: relative;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--auth-text-secondary);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle-btn .f7-icons {
  font-size: 18px;
  line-height: 1;
}

.password-toggle-btn:active {
  background: rgba(75, 85, 101, 0.12);
}

.password-field-wrap input {
  padding-right: 44px;
}

/* Success icon (reset-sent) */
.auth-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 24px auto 8px;
}
.login-screen-content > .auth-success-icon { display: flex; }

/* ===== OTP ===== */
.otp-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 8px 0 12px;
}
.otp-input {
  width: 48px;
  height: 60px;
  padding: 0;
  border-radius: 14px;
  border: 1.5px solid var(--f7-list-item-border-color, #e5e7eb);
  background: var(--f7-page-bg-color, #ffffff);
  color: var(--f7-text-color, #0f172a);
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  caret-color: var(--f7-theme-color, #007aff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease,
    background-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
@media (hover: hover) {
  .otp-input:hover { border-color: var(--f7-list-item-border-color, #cbd5e1); }
}
.otp-input:not(:placeholder-shown),
.otp-input.is-filled {
  border-color: var(--f7-theme-color, #007aff);
  background: rgba(0, 122, 255, 0.04);
}
.otp-input:focus,
.otp-input:focus-visible {
  border-color: var(--f7-theme-color, #007aff);
  box-shadow:
    0 0 0 4px rgba(0, 122, 255, 0.15),
    0 1px 2px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.otp-input.is-error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
  animation: otp-shake 0.35s ease;
}
@keyframes otp-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}
.otp-input:disabled { opacity: 0.6; cursor: not-allowed; }
.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

html.dark .otp-input,
.dark .otp-input {
  background: #1c1d22;
  border-color: #2e3038;
  color: #f5f5f7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
html.dark .otp-input:not(:placeholder-shown),
.dark .otp-input:not(:placeholder-shown) {
  background: rgba(10, 132, 255, 0.12);
  border-color: var(--f7-theme-color, #0a84ff);
}
html.dark .otp-input:focus,
.dark .otp-input:focus {
  border-color: var(--f7-theme-color, #0a84ff);
  box-shadow:
    0 0 0 4px rgba(10, 132, 255, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

@media (max-width: 360px) {
  .otp-row { gap: 8px; }
  .otp-input { width: 42px; height: 54px; font-size: 20px; border-radius: 12px; }
}

.otp-hint {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted, #64748b);
  margin: 0 0 8px;
}

/* ===== Profile setup chips ===== */
.role-chips-block { padding-top: 4px; padding-bottom: 4px; }
.role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border, #e2e8f0);
  background: transparent;
  color: var(--color-text-primary, #0f172a);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.role-chip.active {
  background: var(--f7-theme-color, var(--color-text-primary, #0f172a));
  color: #fff;
  border-color: var(--f7-theme-color, var(--color-text-primary, #0f172a));
}
html.dark .role-chip, .dark .role-chip {
  border-color: #2a2c33;
  color: #fff;
}
html.dark .role-chip.active, .dark .role-chip.active {
  background: var(--f7-theme-color, #4b5565);
  color: #fff;
  border-color: var(--f7-theme-color, #4b5565);
}

/* ===== Welcome dashboard ===== */
.auth-welcome-content {
  padding-top: 28px;
  padding-left: 16px;
  padding-right: 16px;
}

.auth-welcome-continue {
  max-width: 560px;
  margin: 0 auto 18px;
}

.auth-welcome-section-title {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.auth-welcome-list {
  max-width: 560px;
  margin: 0 auto 14px;
}

.auth-feature-grid {
  max-width: 560px;
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.auth-feature-link {
  text-decoration: none;
  color: inherit;
}

.auth-feature-link.is-disabled {
  pointer-events: none;
}

.auth-feature-card {
  border: 1px solid var(--f7-list-item-border-color, #e5e7eb);
  border-radius: 14px;
  padding: 12px;
  background: var(--auth-bg);
}

.auth-feature-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.auth-feature-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
}

.auth-feature-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(75, 85, 101, 0.12);
  color: var(--auth-text-primary);
}

.auth-feature-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--auth-text-primary);
}

.auth-feature-tagline {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--auth-text-secondary);
}

.auth-feature-action {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--lex-primary);
}

.auth-feature-empty {
  border: 1px dashed var(--f7-list-item-border-color, #e5e7eb);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  color: var(--auth-text-secondary);
  font-size: 13px;
}

html.dark .auth-feature-card,
.dark .auth-feature-card {
  border-color: #2a2c33;
  background: #121318;
}

@media (min-width: 768px) {
  .auth-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
