/* ===================================================================
   BruteForceProtection.css
   BRD Task 30032 — PayCBE Brute-Force Protection
   Consolidated styles for the login page brute-force UI:
     * Two-state error/lockout banner (icon shake, depleting bar)
     * Captcha section polish (image + refresh row, styled input)
     * Form dim/disable behavior during countdown
     * Slim footer version display
   Loaded via _CommonStylesPartial.cshtml.
   =================================================================== */


/* ============ FORM DIM WRAPPER ============
   Wraps the login form; adds .cbe-dimmed when brute-force state is
   active. Countdown JS in _LoginCountdown.cshtml removes .cbe-dimmed
   when the countdown reaches zero to re-enable the form in place. */
.cbe-form-wrap {
    transition: opacity 0.4s ease, filter 0.4s ease;
}
.cbe-form-wrap.cbe-dimmed {
    opacity: 0.35;
    pointer-events: none;
    filter: saturate(0.5);
    user-select: none;
}

/* Elements that should be hidden during a BF countdown/lockout and
   revealed once the countdown JS strips the class. Used by the
   "Having trouble accessing your account?" hint so it appears after
   the countdown finishes (in the resulting normal-error state). */
.bf-initially-hidden { display: none; }


/* ============ CAPTCHA POLISH ============ */
.cbe-captcha-block {
    margin-bottom: 18px;
    padding: 14px 16px;
    background: transparent;
    border: 1px solid #dcddde;
    border-radius: 8px;
}

.cbe-captcha-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.cbe-captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.cbe-captcha-imagebox {
    padding: 6px;
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    line-height: 0;
}

.cbe-captcha-imagebox img {
    display: block;
    width: 160px;
    height: 54px;
    border-radius: 3px;
}

.cbe-captcha-refresh {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #4b5563;
    height: 34px;
    padding: 0 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s;
}
.cbe-captcha-refresh:hover {
    background: #f3f4f6;
    color: #111827;
}
.cbe-captcha-refresh svg { width: 12px; height: 12px; }

.cbe-captcha-input {
    display: block;
    width: 100%;
    max-width: 220px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.95rem;
    letter-spacing: 0.15em;
    text-align: center;
    text-transform: uppercase;
    color: #111827;
    background: #ffffff;
    /* Subtle inset shadow makes the field look "recessed" (input-like) rather
       than "raised" (button-like) — resolves Sankar's review comment that the
       placeholder read as a button label. */
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cbe-captcha-input:focus {
    outline: none;
    border-color: #1a3a6e;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06),
                0 0 0 3px rgba(26, 58, 110, 0.12);
}
.cbe-captcha-input::placeholder {
    /* Placeholder styled clearly as hint text, not as a label. Italic + lighter
       color + normal weight visually distinguishes it from typed input and
       from the sign-in buttons. */
    color: #b5bcc4;
    font-weight: 400;
    font-style: italic;
    text-transform: none;
    letter-spacing: normal;
    opacity: 1;
}


/* ============ TWO-STATE ERROR / LOCKOUT BANNER ============
   State 1 (default): red circle X icon, "Error!" title, error message
   State 2 (.state-locked): red circle lock icon, countdown/lockout msg
   .has-countdown: reveals the thin depleting bottom bar */
.cbe-banner {
    position: relative;
    background: #16233a;
    color: #ffffff;
    padding: 16px 18px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-align: left;
    margin-bottom: 20px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cbe-banner-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #dc3545;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cbe-banner-icon svg {
    width: 16px;
    height: 16px;
    color: #fff;
    position: absolute;
    transition: opacity 0.3s ease;
}
.cbe-banner-icon .icon-x    { opacity: 1; }
.cbe-banner-icon .icon-lock { opacity: 0; }
.cbe-banner.state-locked .cbe-banner-icon .icon-x    { opacity: 0; }
.cbe-banner.state-locked .cbe-banner-icon .icon-lock { opacity: 1; }

.cbe-banner-body { flex: 1; min-width: 0; }
.cbe-banner-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
    transition: opacity 0.25s ease;
}
.cbe-banner-message {
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
    transition: opacity 0.25s ease;
}
.cbe-banner-message strong { color: #fff; font-weight: 600; }


/* Depleting countdown bar along the bottom of the banner */
.cbe-banner-bar {
    position: absolute;
    left: 0; bottom: 0; right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.10);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cbe-banner.state-locked.has-countdown .cbe-banner-bar { opacity: 1; }

.cbe-banner-bar-fill {
    height: 100%;
    background: #dc3545;
    transform-origin: left center;
    animation: cbe-bar-deplete linear forwards;
    animation-duration: var(--cbe-countdown-duration, 5s);
    transition: background 0.5s ease;
}
.cbe-banner-bar-fill.warn { background: #f0a500; }
.cbe-banner-bar-fill.ok   { background: #28a745; }


/* ============ KEYFRAMES ============ */
@keyframes cbe-bar-deplete {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}


/* ============ FOOTER VERSION (LAYOUT) ============
   Overrides HTML5.css's `footer { height: 85px }` and browser
   defaults so the version strip is only as tall as its content. */
footer.cbe-footer {
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    display: block;
}
footer.cbe-footer .footer-version {
    padding: 6px 12px;
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.2;
    color: #6b7280;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.02em;
    text-align: left;
}


/* ============ REDUCED MOTION ============
   Respect user's prefers-reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
    .cbe-form-wrap,
    .cbe-banner,
    .cbe-banner-icon,
    .cbe-banner-icon svg,
    .cbe-banner-title,
    .cbe-banner-message,
    .cbe-banner-bar-fill {
        animation: none !important;
        transition: none !important;
    }
}
