/* Gauthenticate addon — overrides on top of sh-login.css.
   Loaded only by views/admin/gauthenticate/login.php and
   views/patient/gauthenticate/login.php. */

/* 2FA verify form is hidden on first paint; JS reveals it after
   verfiy_login / verfiy_userlogin returns status:2 with authenticator:true. */
.lp-form.gauthenticate-form { display: none; }

/* Smooth fade between login form and verify form. */
.lp-form { transition: opacity .25s ease; }

/* Small helper text shown above the verification code input. */
.lp-help {
  font-size: .85rem;
  color: var(--lp-muted, #6b7280);
  margin-bottom: .75rem;
}

/* The verify form wraps its code input in a plain `<div>` (not the
   `.lp-field` class that sh-login.css uses to space the regular
   login form's field above its submit button). That means the
   parent stylesheet's field→button gap rule doesn't match here and
   the input collides with the button below. Add explicit margin so
   the layout visually matches the login form. */
.gauthenticate-form .lp-btn-submit {
  margin-top: 1rem;
}

/* Bootstrap 5 has no jQuery .button('loading') plugin. The view JS
   toggles aria-busy + an inline spinner. */
.lp-btn-submit[aria-busy="true"] {
  opacity: .7;
  cursor: progress;
}
.lp-btn-submit .lp-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: lp-spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: .5rem;
}
@keyframes lp-spin { to { transform: rotate(360deg); } }


/* ============================================================
   SETUP 2FA PAGE  ·  views/admin/gauthenticate/setup.php
   ------------------------------------------------------------
   Visual polish: numbered step badges, copyable secret key,
   framed QR, segmented-style code input. Backend contract
   (form action / field names / AJAX handlers) is unchanged —
   this layer is pure CSS + a small clipboard JS handler in
   the view's <script> block.
   ============================================================ */

.sh-gauth-setup-card {
    border: 1px solid var(--border, #e1e5ea);
    border-radius: var(--radius-md, 8px);
}

/* ---------- Numbered step list ---------- */
.sh-gauth-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.sh-gauth-steps > li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: var(--fs-body, 14px);
    color: var(--ink, #2b3038);
    line-height: 1.5;
}
.sh-step-badge {
    flex: 0 0 28px;
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink, #ffffff);
    font-weight: var(--fw-bold, 700);
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
}
.sh-step-text {
    flex: 1;
    padding-top: 4px;
}

/* ---------- Manual setup key with copy button ---------- */
.sh-gauth-manual-key {
    margin-top: 4px;
}
.sh-gauth-manual-label {
    display: block;
    color: var(--muted, #6b7280);
    font-size: var(--fs-sm, 12px);
    margin-bottom: 8px;
    font-weight: var(--fw-regular, 400);
}
.sh-gauth-key-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border, #e1e5ea);
    border-radius: var(--radius-md, 8px);
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    /* Cap to roughly half of col-md-7 so the box doesn't look
       oversized for a 16-char secret. max-width (not width) so
       longer future secrets still grow up to min-content. */
    max-width: 50%;
}
/* On tablet / mobile (single-column stack) let the box take the
   full width — half of a narrow col-12 looks cramped. */
@media (max-width: 767.98px) {
    .sh-gauth-key-box { max-width: 100%; }
}
.sh-gauth-key-box code {
    background: transparent;
    color: var(--ink, #2b3038);
    font-size: 14px;
    font-weight: var(--fw-semibold, 600);
    letter-spacing: .04em;
    padding: 0;
    word-break: break-all;
}
.sh-gauth-copy-btn {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid var(--border, #e1e5ea);
    color: var(--ink-2, #35404a);
    padding: 4px 10px;
    border-radius: var(--radius, 6px);
    font-size: 12px;
    font-weight: var(--fw-semibold, 600);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-family: inherit;
}
.sh-gauth-copy-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink, #ffffff);
}
.sh-gauth-copy-btn.copied {
    background: var(--green, #22a06b);
    border-color: var(--green, #22a06b);
    color: #ffffff;
}

/* ---------- QR card frame ---------- */
.sh-gauth-verify-form {
    max-width: 320px;
    margin: 0 auto;
    text-align: center;
}
.sh-gauth-qr-frame {
    display: inline-block;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--border, #e1e5ea);
    border-radius: var(--radius-md, 8px);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(20, 30, 50, .04));
    margin: 0 0 18px;
}
.sh-gauth-qr-frame img {
    display: block;
    max-width: 200px;
    width: 100%;
    height: auto;
}

/* ---------- 6-digit code input ---------- */
.sh-gauth-code-input {
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 22px;
    font-weight: var(--fw-semibold, 600);
    letter-spacing: .35em;
    text-align: center;
    padding: 10px 14px;
    height: 48px;
    text-indent: .35em;
}
.sh-gauth-code-input::placeholder {
    letter-spacing: .25em;
    color: var(--faint, #b0b8c4);
    font-weight: var(--fw-regular, 400);
}
.sh-gauth-code-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem var(--accent-soft, rgba(10, 160, 137, .15));
}

/* ---------- Verify button ---------- */
.sh-gauth-verify-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: var(--fw-semibold, 600);
    padding: 10px 16px;
    height: 44px;
    font-size: var(--fs-body, 14px);
}
.sh-gauth-verify-btn[aria-busy="true"] {
    opacity: .7;
    cursor: progress;
}

/* ---------- "Already enabled" alert ---------- */
.sh-gauth-already-enabled {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--green-soft, #d4f1e2);
    border-color: var(--green, #22a06b);
    color: var(--ink, #2b3038);
    padding: 14px 16px;
}
.sh-gauth-already-enabled .fa-check-circle {
    color: var(--green, #22a06b);
    font-size: 18px;
    margin-top: 1px;
    flex: 0 0 auto;
}

/* ---------- Responsive: stack at sm ---------- */
@media (max-width: 767.98px) {
    .sh-gauth-verify-form {
        margin-top: 16px;
    }
}

/* ---------- RTL mirror ---------- */
[dir="rtl"] .sh-gauth-steps > li,
[dir="rtl"] .sh-gauth-key-box,
[dir="rtl"] .sh-gauth-already-enabled {
    direction: rtl;
}
