/* File: wliaa-strong-passwords/css/wlsp-password-meter.css */

/**
 * WLIAA Strong Passwords: password meter styles.
 *
 * 0.2.0 restyle per the Reset Password.dc.html comp. Colors are
 * literals because this stylesheet also loads on wp-login.php and
 * wp-admin, where theme global-styles custom properties do not print;
 * each literal carries a "matches" comment naming the theme token.
 *
 * Accessible: state is never conveyed by color alone (icons, label
 * words, and messages carry it too). Checklist rows are met (green
 * check) or not-yet-met (neutral gray dot): supportive, not punitive.
 */

/* ==========================================================================
   Requirements checklist
   ========================================================================== */

/* Panel chrome for wp-login / wp-admin surfaces. */
.wlsp-meter {
    margin: 12px 0 16px;
    padding: 12px 16px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-width: 400px;
}

/* Bare variant: rendered into a host [data-wlsp-requirements] container
   (theme reset card); the host page owns spacing and intro copy. */
.wlsp-meter--bare {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    max-width: none;
}

.wlsp-meter__heading {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.wlsp-meter__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.wlsp-meter__rule {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    line-height: 1.4;
    color: #757575; /* matches --wp--custom--status--muted */
    transition: color 0.15s ease;
}

/* [hidden] companion (theme guide 7.5 item 11): rows carry an authored
   display, so JS hidden toggles need this to actually hide them. */
.wlsp-meter__rule[hidden] {
    display: none;
}

.wlsp-meter__icon {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    margin-top: 2px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 15px 15px;
    /* Not yet met: neutral gray dot (matches outline-variant #BFC7CF). */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='3.5' fill='%23BFC7CF'/%3E%3C/svg%3E");
}

/* Met: green check (matches --wp--custom--status--success-text). */
.wlsp-meter__rule--pass {
    color: #155724;
}

.wlsp-meter__rule--pass .wlsp-meter__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23155724' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* Containment rules this surface confirms at submit time. */
.wlsp-meter__note {
    margin: 0 0 0 24px;
    font-size: 12.5px;
    line-height: 1.5;
    color: #757575; /* matches --wp--custom--status--muted */
}

.wlsp-meter__note[hidden] {
    display: none;
}

/* ==========================================================================
   Segmented strength bar (Weak / Fair / Good / Strong)
   ========================================================================== */

.wlsp-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.wlsp-bar[hidden] {
    display: none;
}

.wlsp-bar__track {
    display: flex;
    gap: 4px;
    flex: 1;
}

.wlsp-bar__seg {
    height: 4px;
    flex: 1;
    border-radius: 9999px;
    background: #E6E8EC; /* matches surface-container-high */
    transition: background-color 0.3s ease;
}

.wlsp-bar__label {
    font-size: 13px;
    font-weight: 700;
    min-width: 44px;
    text-align: right;
}

/* Level 1, Weak: matches danger #c0392b. */
.wlsp-bar--l1 .wlsp-bar__seg:nth-child(-n+1) {
    background: #c0392b;
}

.wlsp-bar--l1 .wlsp-bar__label {
    color: #c0392b;
}

/* Level 2, Fair: comp literals, no theme token (bar #e4c451, AA label
   text #a8890f). */
.wlsp-bar--l2 .wlsp-bar__seg:nth-child(-n+2) {
    background: #e4c451;
}

.wlsp-bar--l2 .wlsp-bar__label {
    color: #a8890f;
}

/* Level 3, Good: segments match primary-container #5FA8D3; the label
   text uses primary #00678D instead (the comp's #5FA8D3 fails WCAG AA
   for 13px text on white; deliberate deviation, segments keep comp). */
.wlsp-bar--l3 .wlsp-bar__seg:nth-child(-n+3) {
    background: #5FA8D3;
}

.wlsp-bar--l3 .wlsp-bar__label {
    color: #00678D;
}

/* Level 4, Strong: matches --wp--custom--status--success-text. */
.wlsp-bar--l4 .wlsp-bar__seg:nth-child(-n+4) {
    background: #155724;
}

.wlsp-bar--l4 .wlsp-bar__label {
    color: #155724;
}

@media (prefers-reduced-motion: reduce) {
    .wlsp-bar__seg,
    .wlsp-meter__rule {
        transition: none;
    }
}

/* ==========================================================================
   Confirm-match feedback
   ========================================================================== */

.wlsp-confirm-msg {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
}

.wlsp-confirm-msg[hidden] {
    display: none;
}

.wlsp-confirm-msg--ok {
    color: #155724; /* matches --wp--custom--status--success-text */
}

.wlsp-confirm-msg--bad {
    color: #c62828; /* matches --wp--custom--status--error-text */
}

/* Mismatch border on the confirm field
   (matches --wp--custom--status--error-border). */
.wlsp-field input[aria-invalid="true"] {
    border-color: #ef9a9a;
}

/* ==========================================================================
   Show/hide password toggle
   ========================================================================== */

.wlsp-field {
    position: relative;
    display: block;
}

.wlsp-field input {
    width: 100%;
    padding-right: 46px;
    box-sizing: border-box;
}

/* Icons via mask so hover can recolor a single asset. Open eye = will
   show; crossed eye = will hide. */
.wlsp-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    background-color: #757575; /* icon color; matches status muted */
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: 20px 20px;
    mask-size: 20px 20px;
    transition: background-color 0.15s ease;
}

.wlsp-toggle:hover,
.wlsp-toggle:focus-visible {
    background-color: #2b77c7; /* matches interactive */
}

.wlsp-toggle:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Password currently masked: open eye, click to show. */
.wlsp-toggle--hidden {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

/* Password currently visible: crossed eye, click to hide. */
.wlsp-toggle--visible {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");
}

/* Admin color scheme compatibility */
.wp-admin .wlsp-meter {
    background: #f0f0f1;
    border-color: #c3c4c7;
}

/* Login page styling */
.login .wlsp-meter {
    max-width: 100%;
    margin-top: 8px;
}
