/* =========================================================================
   Password Generator Block — all rules scoped under .sws-pwgen.
   Per-block CSS (loaded via enqueue_assets only when the block is present).
   Ported from the Claude Design spec (PasswordGenerator.dc.html).
   Palette: green #028d40, violet #605cb8, graphite #343a40, muted #777,
   border #e6e6e6, hairline #f2f2f2, surface #f8f9fa.
   ========================================================================= */

@keyframes swsPwgenFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sws-pwgen {
    max-width: 820px;
    margin: 0 auto;
    animation: swsPwgenFade .4s ease-out both;
}
.sws-pwgen *,
.sws-pwgen *::before,
.sws-pwgen *::after { box-sizing: border-box; }

.sws-pwgen__card {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: .25rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, .1);
    overflow: hidden;
}

/* Header --------------------------------------------------------------- */
.sws-pwgen__head { padding: 28px 34px 0; }
.sws-pwgen__eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #028d40;
    margin-bottom: 10px;
}
.sws-pwgen__title {
    margin: 0;
    font-size: 26px;
    font-weight: 500;
    color: #343a40;
    line-height: 1.2;
}

/* Body ----------------------------------------------------------------- */
.sws-pwgen__body { padding: 22px 34px 32px; }

.sws-pwgen__label {
    font-size: 14px;
    font-weight: 500;
    color: #343a40;
    margin-bottom: 8px;
}
.sws-pwgen__label--lg { margin-bottom: 14px; }

/* Password output + actions ------------------------------------------- */
.sws-pwgen__row { gap: 12px; }
.sws-pwgen__field {
    flex: 1 1 340px;
    min-width: 0;
    display: flex;
    align-items: center;
    border: 1px solid #e6e6e6;
    border-radius: .25rem;
    background: #f8f9fa;
    padding: 0 18px;
    height: 54px;
    overflow: hidden;
}
.sws-pwgen__out {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 21px;
    letter-spacing: .03em;
    color: #212529;
}
.sws-pwgen__actions { gap: 10px; }

.sws-pwgen button { cursor: pointer; font-family: inherit; }

.sws-pwgen__regen {
    width: 54px;
    height: 54px;
    flex: none;
    border: 1px solid #028d40;
    border-radius: .25rem;
    background: #fff;
    color: #028d40;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background .2s ease-out, color .2s ease-out;
}
.sws-pwgen__regen:hover,
.sws-pwgen__regen:focus { background: #028d40; color: #fff; outline: none; }

.sws-pwgen__copy {
    height: 54px;
    padding: 0 28px;
    flex: none;
    border: 0;
    border-radius: .25rem;
    background: #028d40;
    color: #fff;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .2s ease-out;
}
.sws-pwgen__copy:hover,
.sws-pwgen__copy:focus { background: #605cb8; color: #fff; outline: none; }

/* Strength meter ------------------------------------------------------- */
.sws-pwgen__strength { margin-top: 18px; gap: 16px; }
.sws-pwgen__segs {
    display: flex;
    gap: 6px;
    flex: 1 1 220px;
    max-width: 340px;
}
.sws-pwgen__seg {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e6e6e6;
    transition: background .25s ease-out;
}
.sws-pwgen__strength-label { font-size: 13px; font-weight: 500; }

.sws-pwgen__meta { margin-top: 10px; gap: 8px 22px; }
.sws-pwgen__meta-item { font-size: 12px; color: #777; }
.sws-pwgen__meta-item i { margin-right: 6px; color: #028d40; }
.sws-pwgen__meta-val { color: #343a40; font-weight: 500; }

/* Length controls ------------------------------------------------------ */
.sws-pwgen__section {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid #f2f2f2;
}
.sws-pwgen__len { gap: 18px; }
.sws-pwgen__len-num {
    width: 74px;
    height: 48px;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: #343a40;
    border: 1px solid #e6e6e6;
    border-radius: .25rem;
    outline: none;
}
.sws-pwgen__round {
    width: 42px;
    height: 42px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: #028d40;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background .2s ease-out;
}
.sws-pwgen__round:hover,
.sws-pwgen__round:focus { background: #605cb8; outline: none; }

/* Range slider (custom track + thumb) */
.sws-pwgen__len-range {
    flex: 1 1 180px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}
.sws-pwgen__len-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #e6e6e6; }
.sws-pwgen__len-range::-moz-range-track { height: 6px; border-radius: 3px; background: #e6e6e6; }
.sws-pwgen__len-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #028d40;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #028d40;
    margin-top: -7px;
    cursor: pointer;
    transition: background .2s ease-out, box-shadow .2s ease-out;
}
.sws-pwgen__len-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #028d40;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #028d40;
    cursor: pointer;
}
.sws-pwgen__len-range:hover::-webkit-slider-thumb { background: #605cb8; box-shadow: 0 0 0 1px #605cb8; }
.sws-pwgen__len-range:hover::-moz-range-thumb { background: #605cb8; box-shadow: 0 0 0 1px #605cb8; }

.sws-pwgen__presets { margin-top: 16px; gap: 8px; }
.sws-pwgen__presets-label { font-size: 12px; color: #777; margin-right: 4px; }
.sws-pwgen__preset {
    min-width: 46px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #e6e6e6;
    border-radius: .25rem;
    background: #fff;
    color: #343a40;
    font-size: 14px;
    font-weight: 500;
    transition: background .2s ease-out, border-color .2s ease-out, color .2s ease-out;
}
.sws-pwgen__preset:hover { border-color: #028d40; }
.sws-pwgen__preset.is-active { border-color: #028d40; background: #028d40; color: #fff; }

/* Settings toggle ------------------------------------------------------ */
.sws-pwgen__toggle {
    margin-top: 26px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.sws-pwgen__chevron { color: #028d40; font-size: 13px; width: 14px; }
.sws-pwgen__toggle [data-pwgen-toggle-label],
.sws-pwgen__toggle > span:not(.sws-pwgen__toggle-rule) {
    font-size: 14px;
    font-weight: 500;
    color: #343a40;
}
.sws-pwgen__toggle-rule { flex: 1; height: 1px; background: #f2f2f2; }

/* Settings panel ------------------------------------------------------- */
.sws-pwgen__settings { margin-top: 16px; }
.sws-pwgen__settings[hidden] { display: none; }
.sws-pwgen__opts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(186px, 1fr));
    gap: 12px;
}
.sws-pwgen__opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid #e6e6e6;
    border-radius: .25rem;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: border-color .2s ease-out;
}
.sws-pwgen__opt:hover { border-color: #028d40; }
.sws-pwgen__opt--wide {
    grid-column: span 2;
    gap: 14px;
    cursor: default;
}
.sws-pwgen__opt--wide:hover { border-color: #e6e6e6; }
.sws-pwgen__opt-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    cursor: pointer;
    user-select: none;
}

.sws-pwgen__check {
    width: 18px;
    height: 18px;
    flex: none;
    border-radius: 4px;
    border: 1px solid #c4c4c4;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease-out, border-color .2s ease-out;
}
.sws-pwgen__check i { color: #fff; font-size: 11px; opacity: 0; transition: opacity .15s ease-out; }
.sws-pwgen__check.is-on { background: #028d40; border-color: #028d40; }
.sws-pwgen__check.is-on i { opacity: 1; }

.sws-pwgen__opt-text { min-width: 0; }
.sws-pwgen__opt-title { display: block; font-size: 14px; font-weight: 500; color: #343a40; line-height: 1.2; }
.sws-pwgen__opt-sub { display: block; font-size: 12px; color: #777; margin-top: 2px; }
.sws-pwgen__opt-sub--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    letter-spacing: .1em;
}

.sws-pwgen__symbols {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    font-size: 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    color: #343a40;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: .25rem;
    outline: none;
}
.sws-pwgen__symbols:disabled { background: #f4f4f4; color: #adb5bd; cursor: not-allowed; }

/* Local-only note ------------------------------------------------------ */
.sws-pwgen__note {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #f2f2f2;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #777;
}
.sws-pwgen__note i { color: #028d40; }

/* Responsive ----------------------------------------------------------- */
@media (max-width: 575.98px) {
    .sws-pwgen__head { padding: 22px 20px 0; }
    .sws-pwgen__body { padding: 18px 20px 26px; }
    .sws-pwgen__title { font-size: 22px; }
    .sws-pwgen__field { flex: 1 1 100%; height: 50px; }
    .sws-pwgen__out { font-size: 18px; }
    .sws-pwgen__actions { flex: 1 1 100%; }
    .sws-pwgen__copy { flex: 1; }
    .sws-pwgen__opt--wide { grid-column: span 1; flex-wrap: wrap; }
}
