/* ===== PASSWORD CONFIDENCE ASSISTANT =====
 * Real-time password guidance with progressive enhancement.
 * The form works without JS; JS hydrates this with live feedback.
 * CSS variables from main.css: --brand-royal, --accent-emerald, --accent-amber,
 * --accent-rose, --brand-powder, --brand-ice, --surface-card, --text-primary, --text-secondary
 */

/* ---- Input wrapper with visibility toggle ---- */
.pc-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
}

.pc-input-wrapper input[type="password"] {
    padding-right: 34px;
}

.pc-toggle-visibility {
    margin-left: 8px;
    background: none;
    border: 1px solid var(--brand-powder, #b8dde4);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    line-height: 1;
    height: 30px;
    display: flex;
    align-items: center;
    transition: all 0.15s ease;
}

.pc-toggle-visibility:hover {
    color: var(--brand-royal, #3a7ca8);
    border-color: var(--brand-royal, #3a7ca8);
    background: var(--brand-ice, #e0f4f8);
}

.pc-toggle-visibility:focus-visible {
    outline: 2px solid var(--brand-royal, #3a7ca8);
    outline-offset: 2px;
}

.pc-toggle-visibility i[data-lucide] {
    display: block;
}

.pc-toggle-visibility svg {
    display: block;
}

.pc-toggle-visibility--confirm {
    margin-left: 4px;
}

/* ---- Main progress ---- */
.pc-progress {
    margin-top: 0.5rem;
}

.pc-progress-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: var(--brand-powder, #e0e7ee);
    border-radius: 9999px;
    overflow: hidden;
    box-sizing: border-box;
}

.pc-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 9999px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
}

.pc-progress-fill--empty   { background: var(--brand-powder, #e0e7ee); width: 0%; }
.pc-progress-fill--neutral  { background: var(--brand-royal, #3a7ca8); }
.pc-progress-fill--rose     { background: var(--accent-rose, #ef4444); }
.pc-progress-fill--orange   { background: var(--accent-orange, #f97316); }
.pc-progress-fill--amber    { background: var(--accent-amber, #f59e0b); }
.pc-progress-fill--emerald  { background: var(--accent-emerald, #10b981); }

.pc-strength-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.375rem;
    gap: 8px;
}

.pc-strength-badge {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.pc-strength-badge--neutral  { color: var(--text-secondary, #6b7280); }
.pc-strength-badge--rose      { color: var(--accent-rose, #7f1d1d); }
.pc-strength-badge--orange    { color: #9a2a0e; }
.pc-strength-badge--amber     { color: #78350f; }
.pc-strength-badge--emerald   { color: var(--accent-emerald, #065f46); }

/* ---- Generate button ---- */
.pc-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border: 1px solid var(--brand-powder, #b8dde4);
    border-radius: 6px;
    background: var(--surface-card, #ffffff);
    color: var(--brand-royal, #3a7ca8);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pc-generate-btn:hover {
    background: var(--brand-ice, #e0f4f8);
    border-color: var(--brand-royal, #3a7ca8);
}

.pc-generate-btn:active {
    transform: scale(0.97);
}

.pc-generate-btn:focus-visible {
    outline: 2px solid var(--brand-royal, #3a7ca8);
    outline-offset: 2px;
}

.pc-generate-btn i[data-lucide] {
    width: 14px;
    height: 14px;
}

.pc-generate-btn svg {
    width: 14px;
    height: 14px;
}

/* ---- Hint / assistant panel ---- */
.pc-hint-wrapper {
    margin-top: 0.5rem;
}

.pc-hint {
    margin-top: 0.375rem;
    font-size: 13px;
    line-height: 1.5;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    overflow: hidden;
}

.pc-hint-wrapper--info .pc-hint {
    background: var(--brand-ice, #e0f4f8);
    border-left-color: var(--brand-royal, #3a7ca8);
    color: var(--text-primary, #1f2937);
}

.pc-hint-wrapper--success .pc-hint {
    background: var(--accent-emerald-light, #d1fae5);
    border-left-color: var(--accent-emerald, #10b981);
    color: #064e35;
}

.pc-hint-wrapper--error .pc-hint {
    background: var(--accent-rose-light, #ffe4e6);
    border-left-color: var(--accent-rose, #ef4444);
    color: #7f1d1d;
}

.pc-hint--collapsed {
    max-height: 0;
    margin: 0;
    padding: 0 0.75rem;
    pointer-events: none;
    opacity: 0;
    overflow: hidden;
}

.pc-hint-inner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0.375rem;
}

.pc-hint-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.pc-hint-icon i[data-lucide] {
    width: 16px;
    height: 16px;
}

.pc-hint-icon svg {
    width: 16px;
    height: 16px;
}

.pc-hint-text {
    font-weight: 400;
}

.pc-suggestions {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0;
    font-size: 12px;
}

.pc-suggestions li {
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pc-suggestions li::before {
    content: "•";
    color: var(--text-secondary, #6b7280);
    font-weight: bold;
}

/* ---- Hint toggle ---- */
.pc-hint-toggle {
    font-size: 12px;
    color: var(--brand-royal, #3a7ca8);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pc-hint-toggle i[data-lucide] {
    transition: transform 0.2s ease;
    width: 12px;
    height: 12px;
}

.pc-hint-toggle svg {
    transition: transform 0.2s ease;
    width: 12px;
    height: 12px;
}

.pc-hint-toggle--expanded i[data-lucide] {
    transform: rotate(180deg);
}

.pc-hint-toggle--expanded svg {
    transform: rotate(180deg);
}

/* ---- Match indicator ---- */
.pc-match-indicator {
    margin-top: 0.25rem;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0;
}

.pc-match-indicator--valid { color: var(--accent-emerald, #065f46); }
.pc-match-indicator--invalid { color: var(--accent-rose, #7f1d1d); }

.pc-match-indicator i[data-lucide] {
    flex-shrink: 0;
}

.pc-match-indicator svg {
    flex-shrink: 0;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
    .password-confidence {
        font-size: 13px;
    }
    .pc-generate-btn {
        font-size: 13px;
        padding: 8px 14px;
    }
    .pc-hint {
        padding: 0.5rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .pc-generate-btn {
        min-height: 40px;
        padding: 10px 16px;
        font-size: 14px;
    }
    .pc-toggle-visibility {
        min-height: 36px;
        padding: 6px 12px;
    }
    .pc-hint {
        border-radius: 12px;
        padding: 0.75rem;
    }
}

/* ---- Hide elements that should only appear with JS ---- */
.pc-hint[data-pc-hint-content][style*="display"] {
    /* JS controls visibility of the toggle button's expanded/collapsed state */
}
