/* =====================================================================
 * [2026-11-28] ACEM 2027 : Login security (Captcha + Email OTP 2FA)
 * ใช้กับ  app/Views/login.php, app/Views/Templates/modal.login.php (login_admin),
 *        app/Views/Profile/security.php, app/Views/BackEnd/two_factor.php
 * ===================================================================== */
:root{
    --sec-primary: #085041;
    --sec-primary-dark: #063f34;
    --sec-ink: #20332e;
    --sec-muted: #6b7f78;
    --sec-border: #d7e4dc;
    --sec-soft: #f1f7f4;
    --sec-field: #fcfdfc;
}

/* ---------- Icon input (user login : .claude/login.png) ---------- */
.sec-field{ position: relative; }
.sec-field > .sec-field-icon{
    position: absolute; top: 50%; left: 1rem; transform: translateY(-50%);
    color: #5d6f69; font-size: 1rem; pointer-events: none; z-index: 3; width: 1.1rem; text-align: center;
}
.auth-login-card-body .sec-field > .form-control{ padding-left: 2.85rem; background: var(--sec-field); }
.auth-login-card-body .sec-field > .form-control:focus{ background: #fff; }
.auth-login-card-body .sec-field > .form-control.has-toggle{ padding-right: 3rem; }
.sec-field > .sec-toggle-password{
    position: absolute; top: 50%; right: .55rem; transform: translateY(-50%); z-index: 3;
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    border: 0; border-radius: 8px; background: transparent; color: #5d6f69;
}
.sec-field > .sec-toggle-password:hover,.sec-field > .sec-toggle-password:focus-visible{ background: var(--sec-soft); color: var(--sec-primary); outline: none; }

/* ---------- Captcha row ---------- */
.sec-captcha-row{ display: flex; align-items: stretch; gap: .5rem; }
.sec-captcha-row > .sec-field,.sec-captcha-row > .input-group{ flex: 1 1 auto; min-width: 0; }
.sec-captcha-img{
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 150px; min-height: 50px; padding: 2px; overflow: hidden;
    border: 1px solid var(--sec-border); border-radius: 10px; background: #f5f0fa; cursor: pointer;
}
.sec-captcha-img img{ display: block; width: 100%; height: 100%; max-height: 56px; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.sec-captcha-img.is-loading img{ opacity: .35; }
.sec-captcha-refresh{
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 50px; min-height: 50px;
    border: 1px solid var(--sec-border); border-radius: 10px; background: #fff; color: #5d6f69;
}
.sec-captcha-refresh:hover,.sec-captcha-refresh:focus-visible{ border-color: var(--sec-primary); color: var(--sec-primary); outline: none; }
.sec-captcha-refresh.is-spinning i{ animation: secSpin .6s linear; }
@keyframes secSpin{ to{ transform: rotate(360deg); } }
.sec-captcha-input{ text-transform: uppercase; letter-spacing: .25em; font-weight: 600; }
.sec-captcha-input::placeholder{ text-transform: none; letter-spacing: normal; font-weight: 400; }
.sec-forgot{ text-align: right; }
.sec-forgot a{ font-size: .95rem; font-weight: 600 !important; }

/* ---------- Admin modal captcha (.claude/login-admin.png) ---------- */
#loginModal .sec-captcha-row{ margin-bottom: 1rem; }
#loginModal .sec-captcha-row .input-group{ margin-bottom: 0 !important; }
#loginModal .sec-captcha-img,#loginModal .sec-captcha-refresh{ min-height: 48px; }
#loginModal .sec-captcha-img{ width: 140px; }
#loginModal #employee_captcha{ min-width: 0; text-transform: uppercase; letter-spacing: .22em; font-weight: 700; color: #4a5a55; }
#loginModal #employee_captcha::placeholder{ letter-spacing: .14em; font-weight: 700; color: #9aa7a2; }
#loginModal .input-group-text{ min-width: 54px; justify-content: center; background: #f6f8f7; border-right: 1px solid #e3ebe7 !important; }

/* ---------- OTP step ---------- */
.sec-otp-panel{ text-align: center; }
.sec-otp-badge{
    display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin-bottom: .9rem;
    border-radius: 50%; background: var(--sec-soft); color: var(--sec-primary); font-size: 1.6rem;
    box-shadow: 0 0 0 8px rgba(8, 80, 65, .05);
}
.sec-otp-title{ color: var(--sec-ink); font-size: 1.25rem; font-weight: 600; margin-bottom: .35rem; }
.sec-otp-text{ color: var(--sec-muted); font-size: .95rem; line-height: 1.6; margin-bottom: 1.25rem; }
.sec-otp-text b{ color: var(--sec-ink); }
.sec-otp-inputs{ display: flex; justify-content: center; gap: .5rem; margin: 0 auto 1rem; }
.sec-otp-inputs .sec-otp-digit{
    width: 50px; height: 58px; min-height: 58px !important; padding: 0 !important; text-align: center;
    font-size: 1.5rem; font-weight: 700; color: var(--sec-ink); font-family: Consolas, Menlo, monospace;
    border: 1px solid var(--sec-border) !important; border-radius: 12px !important; background: #fff;
}
.sec-otp-inputs .sec-otp-digit:focus{ border-color: var(--sec-primary) !important; box-shadow: 0 0 0 .22rem rgba(8, 80, 65, .13) !important; outline: none; }
.sec-otp-inputs .sec-otp-digit.is-filled{ background: var(--sec-soft); border-color: #b8d3c6 !important; }
.sec-otp-inputs.is-invalid .sec-otp-digit{ border-color: #dc3545 !important; animation: secShake .35s; }
@keyframes secShake{ 25%{ transform: translateX(-4px); } 75%{ transform: translateX(4px); } }
.sec-otp-meta{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: 1rem; font-size: .9rem; }
.sec-otp-meta .btn-link{ padding: 0; font-size: .9rem; font-weight: 600; color: var(--sec-primary); text-decoration: none; }
.sec-otp-meta .btn-link:disabled{ color: var(--sec-muted); }
.sec-otp-timer{ color: var(--sec-muted); }
#loginModal .sec-otp-inputs .sec-otp-digit{ border-radius: 10px !important; }

/* ---------- Account security page (Profile / Back-End) ---------- */
.sec-card{ max-width: 760px; margin: 0 auto; border: 1px solid #e1ebe6; border-radius: 18px; background: #fff; box-shadow: 0 14px 40px rgba(8, 80, 65, .08); overflow: hidden; }
.sec-card-head{ display: flex; gap: 1rem; align-items: flex-start; padding: 1.5rem 1.75rem; border-bottom: 1px solid #edf2ef; background: radial-gradient(ellipse at 0% 0%, #edf7f2 0, #fff 70%); }
.sec-card-head .sec-otp-badge{ flex: 0 0 auto; width: 54px; height: 54px; margin: 0; font-size: 1.35rem; }
.sec-card-title{ font-size: 1.2rem; font-weight: 600; color: var(--sec-ink); margin: 0 0 .25rem; }
.sec-card-sub{ font-size: .93rem; color: var(--sec-muted); margin: 0; line-height: 1.6; }
.sec-card-body{ padding: 1.5rem 1.75rem; font-size: .95rem; color: var(--sec-ink); }
.sec-status{ display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.sec-status.is-on{ background: #e3f4ea; color: #146c43; }
.sec-status.is-off{ background: #f3f4f5; color: #6c757d; }
.sec-steps{ list-style: none; padding: 0; margin: 0 0 1.25rem; }
.sec-steps li{ display: flex; gap: .75rem; align-items: flex-start; padding: .45rem 0; color: #44564f; line-height: 1.55; }
.sec-steps li i{ margin-top: .25rem; color: var(--sec-primary); width: 1.1rem; text-align: center; }
.sec-card .form-control{ min-height: 48px; border-radius: 10px; }
.sec-card .btn{ min-height: 46px; border-radius: 10px; font-weight: 600; padding-left: 1.25rem; padding-right: 1.25rem; }
.sec-card .btn-main{ background: var(--sec-primary); border-color: var(--sec-primary); color: #fff; }
.sec-card .btn-main:hover{ background: var(--sec-primary-dark); border-color: var(--sec-primary-dark); }
.sec-note{ margin-top: 1.25rem; padding: .85rem 1rem; border-radius: 10px; background: var(--sec-soft); color: #486258; font-size: .88rem; line-height: 1.6; }

@media (max-width: 575.98px){
    .sec-captcha-img{ width: 118px; }
    #loginModal .sec-captcha-img{ width: 120px; }
    .sec-captcha-refresh{ width: 44px; }
    .sec-otp-inputs{ gap: .35rem; }
    .sec-otp-inputs .sec-otp-digit{ width: 42px; height: 52px; min-height: 52px !important; font-size: 1.3rem; }
    .sec-card-head,.sec-card-body{ padding: 1.15rem; }
}
