/* Smart Auth — Modal Styles
   All selectors prefixed with .sauth- or #sauth- to avoid theme conflicts.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --sauth-accent:       #0073aa;
  --sauth-accent-dark:  #005a87;
  --sauth-accent-light: #e8f4fb;
  --sauth-radius:       14px;
  --sauth-shadow:       0 20px 60px rgba(0,0,0,.25);
  --sauth-font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sauth-text:         #1a1a2e;
  --sauth-muted:        #666;
  --sauth-border:       #dde2ea;
  --sauth-error-bg:     #fff0f0;
  --sauth-error-color:  #c0392b;
  --sauth-info-bg:      #f0fff4;
  --sauth-info-color:   #1a7a4a;
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.sauth-hidden  { display: none !important; }
.sauth-visible { display: flex !important; }

/* ── Overlay ──────────────────────────────────────────────────────────────── */
.sauth-overlay {
  position:        fixed;
  inset:           0;
  z-index:         999999;
  background:      rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         16px;
  box-sizing:      border-box;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.sauth-modal {
  position:         relative;
  background:       #fff;
  border-radius:    var(--sauth-radius);
  padding:          28px;
  max-width:        420px;
  width:            calc(100% - 32px);
  box-shadow:       var(--sauth-shadow);
  font-family:      var(--sauth-font);
  color:            var(--sauth-text);
  max-height:       90vh;
  overflow-y:       auto;
  animation:        sauth-slide-in 250ms ease-out;
}

@keyframes sauth-slide-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Close button ─────────────────────────────────────────────────────────── */
.sauth-close {
  position:   absolute;
  top:        14px;
  right:      14px;
  background: none;
  border:     none;
  font-size:  18px;
  cursor:     pointer;
  color:      var(--sauth-muted);
  line-height: 1;
  padding:    4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.sauth-close:hover { background: #f0f0f0; }

/* ── Typography ───────────────────────────────────────────────────────────── */
.sauth-title {
  font-size:   1.4rem;
  font-weight: 700;
  margin:      0 0 4px;
  color:       var(--sauth-text);
}
.sauth-subtitle {
  font-size:  .9rem;
  color:      var(--sauth-muted);
  margin:     0 0 20px;
}

/* ── Form Fields ──────────────────────────────────────────────────────────── */
.sauth-field {
  margin-bottom: 14px;
  position:      relative;
}
.sauth-input {
  display:       block;
  width:         100%;
  padding:       11px 14px;
  border:        1.5px solid var(--sauth-border);
  border-radius: 8px;
  font-size:     .95rem;
  font-family:   var(--sauth-font);
  color:         var(--sauth-text);
  box-sizing:    border-box;
  transition:    border-color .15s, box-shadow .15s;
  background:    #fafbfc;
  outline:       none;
}
.sauth-input:focus {
  border-color: var(--sauth-accent);
  box-shadow:   0 0 0 3px rgba(0,115,170,.12);
  background:   #fff;
}
.sauth-input::placeholder { color: #aaa; }

select.sauth-input { appearance: none; cursor: pointer; }

/* Password wrap (for toggle button) */
.sauth-password-wrap { position: relative; }
.sauth-password-wrap .sauth-input { padding-right: 44px; }
.sauth-toggle-pw {
  position:   absolute;
  right:      10px;
  top:        50%;
  transform:  translateY(-50%);
  background: none;
  border:     none;
  cursor:     pointer;
  font-size:  18px;
  padding:    4px;
  line-height:1;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.sauth-btn {
  display:       block;
  width:         100%;
  padding:       12px 20px;
  border:        none;
  border-radius: 8px;
  font-size:     .95rem;
  font-family:   var(--sauth-font);
  font-weight:   600;
  cursor:        pointer;
  text-align:    center;
  margin-top:    10px;
  transition:    background .15s, transform .1s, opacity .15s;
}
.sauth-btn:disabled { opacity: .6; cursor: not-allowed; }

.sauth-btn-primary {
  background: var(--sauth-accent);
  color:      #fff;
}
.sauth-btn-primary:hover:not(:disabled) {
  background: var(--sauth-accent-dark);
}
.sauth-btn-primary:active:not(:disabled) { transform: scale(.98); }

.sauth-btn-secondary {
  background: #f0f4f8;
  color:      var(--sauth-text);
  border:     1.5px solid var(--sauth-border);
}
.sauth-btn-secondary:hover:not(:disabled) { background: #e4eaf0; }

.sauth-btn-link {
  background: none;
  color:      var(--sauth-accent);
  font-weight: 500;
  text-decoration: underline;
  padding: 6px 0;
  width: auto;
  margin: 0;
}

/* ── Links inside modal ────────────────────────────────────────────────────── */
.sauth-row-links {
  display:         flex;
  justify-content: flex-end;
  margin-bottom:   4px;
}
.sauth-row-links a,
#sauth-body a {
  color:           var(--sauth-accent);
  font-size:       .85rem;
  text-decoration: none;
}
.sauth-row-links a:hover,
#sauth-body a:hover { text-decoration: underline; }

/* ── User card (found user) ──────────────────────────────────────────────── */
.sauth-user-card {
  display:       flex;
  align-items:   center;
  gap:           12px;
  background:    var(--sauth-accent-light);
  border:        1.5px solid #c3dff0;
  border-radius: 10px;
  padding:       12px 16px;
  margin-bottom: 14px;
}
.sauth-avatar {
  width:         40px;
  height:        40px;
  border-radius: 50%;
  object-fit:    cover;
}
.sauth-avatar-placeholder {
  width:         40px;
  height:        40px;
  border-radius: 50%;
  background:    var(--sauth-accent);
  flex-shrink:   0;
}
.sauth-user-card-name {
  flex: 1;
  font-weight: 600;
}
.sauth-user-card a {
  font-size:  .8rem;
  white-space: nowrap;
}

/* ── Step indicator ────────────────────────────────────────────────────────── */
.sauth-steps {
  display:         flex;
  gap:             4px;
  margin-bottom:   20px;
}
.sauth-step {
  flex:            1;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             4px;
  opacity:         .4;
}
.sauth-step.active { opacity: 1; }
.sauth-step.done   { opacity: .7; }
.sauth-step-num {
  width:         26px;
  height:        26px;
  border-radius: 50%;
  background:    var(--sauth-border);
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     .8rem;
  font-weight:   700;
}
.sauth-step.active .sauth-step-num { background: var(--sauth-accent); color: #fff; }
.sauth-step.done   .sauth-step-num { background: #4caf50; color: #fff; }
.sauth-step-label {
  font-size: .7rem;
  color:     var(--sauth-muted);
  text-align: center;
}

/* ── Chips ────────────────────────────────────────────────────────────────── */
.sauth-chips {
  display: flex;
  gap:     12px;
  margin:  16px 0;
}
.sauth-chip {
  flex:          1;
  padding:       14px 10px;
  border:        1.5px solid var(--sauth-border);
  border-radius: 10px;
  background:    #fafbfc;
  cursor:        pointer;
  font-family:   var(--sauth-font);
  font-size:     .9rem;
  text-align:    center;
  transition:    border-color .15s, background .15s;
}
.sauth-chip:hover {
  border-color: var(--sauth-accent);
  background:   var(--sauth-accent-light);
}

/* ── Field hints ────────────────────────────────────────────────────────────── */
.sauth-field-hint {
  display:   block;
  font-size: .78rem;
  margin-top: 4px;
}
.sauth-hint-good { color: #1a7a4a; }
.sauth-hint-bad  { color: var(--sauth-error-color); }
.sauth-hint      { font-size: .83rem; color: var(--sauth-muted); min-height: 18px; }

/* ── Messages ────────────────────────────────────────────────────────────── */
.sauth-error {
  background:    var(--sauth-error-bg);
  color:         var(--sauth-error-color);
  border:        1px solid #f5c6cb;
  border-radius: 7px;
  padding:       10px 14px;
  font-size:     .875rem;
  margin-bottom: 10px;
}
.sauth-info {
  background:    var(--sauth-info-bg);
  color:         var(--sauth-info-color);
  border:        1px solid #b2dfdb;
  border-radius: 7px;
  padding:       10px 14px;
  font-size:     .875rem;
  margin-bottom: 10px;
}

/* ── Summary block ────────────────────────────────────────────────────────── */
.sauth-summary {
  background:    #f7f9fb;
  border:        1px solid var(--sauth-border);
  border-radius: 8px;
  padding:       12px 16px;
  margin-bottom: 16px;
  font-size:     .9rem;
}
.sauth-summary p { margin: 4px 0; }

/* ── Captcha ─────────────────────────────────────────────────────────────── */
.sauth-captcha {
  background:    #f7f9fb;
  border:        1px dashed var(--sauth-border);
  border-radius: 8px;
  padding:       14px 16px;
  margin-bottom: 14px;
}
.sauth-captcha label {
  display:     block;
  font-size:   .9rem;
  margin-bottom: 8px;
  color:       var(--sauth-text);
}

/* ── Security question ────────────────────────────────────────────────────── */
.sauth-security-question {
  font-size:   .9rem;
  color:       var(--sauth-muted);
  background:  #f7f9fb;
  border-left: 3px solid var(--sauth-accent);
  padding:     8px 12px;
  border-radius: 0 6px 6px 0;
  margin:      4px 0 0;
}

/* ── Mobile-first responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .sauth-modal {
    padding:  20px 16px;
    border-radius: 10px;
  }
  .sauth-chips { flex-direction: column; }
  .sauth-title { font-size: 1.2rem; }
}
