/* =========================================================
   cuenta.css - Ventana "Cambiar contrasena" (panel /main)
   Mismo lenguaje visual que la ventana de detalle de error.
   ========================================================= */

/* Item del menu (el de "Cerrar sesion" es rojo; este no) */
.user-menu-dropdown .pw-menu-item {
    color: #0f172a !important;
    border-bottom: 1px solid #f1f5f9;
}

.user-menu-dropdown .pw-menu-item i {
    color: #64748b;
}

.user-menu-dropdown .pw-menu-item:hover {
    background: #f8fafc !important;
}

/* ---- Fondo ---- */
.pw-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.pw-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.22s ease, visibility 0s linear 0s;
}

.pw-overlay,
.pw-overlay *:not(i):not([class*="fa-"]) {
    font-family: var(--base-font, 'Sora', sans-serif);
}

/* ---- Tarjeta ---- */
.pw-modal {
    background: #fff;
    border-radius: 16px;
    width: min(440px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    transform: translateY(10px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.pw-overlay.open .pw-modal {
    transform: none;
}

.pw-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.pw-head-ico {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d84b5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.pw-head-text {
    min-width: 0;
}

.pw-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #0f172a;
}

.pw-sub {
    font-size: 12.5px;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.45;
}

.pw-close {
    margin-left: auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 0;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    align-self: flex-start;
    transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
}

.pw-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ---- Formulario ---- */
.pw-body {
    padding: 18px 20px 20px;
    margin: 0;
}

.pw-hidden-user {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
}

.pw-field {
    margin-bottom: 14px;
}

.pw-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.pw-input {
    position: relative;
    display: flex;
    align-items: center;
}

.pw-input-ico {
    position: absolute;
    left: 13px;
    font-size: 13px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.15s ease;
}

.pw-input input {
    width: 100%;
    box-sizing: border-box;
    height: 44px;
    padding: 0 44px 0 38px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    color: #0f172a;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pw-input input:focus {
    border-color: #1d84b5;
    box-shadow: 0 0 0 3px rgba(29, 132, 181, 0.15);
}

.pw-input input:focus + .pw-eye,
.pw-input:focus-within .pw-input-ico {
    color: #1d84b5;
}

.pw-eye {
    position: absolute;
    right: 6px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pw-eye:hover {
    background: #f8fafc;
    color: #475569;
}

.pw-field-error .pw-input input {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* ---- Medidor de fuerza ---- */
.pw-meter {
    height: 6px;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
    margin-top: -4px;
}

.pw-meter-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.25s ease;
}

.pw-meter-bar.pw-weak   { background: #dc2626; }
.pw-meter-bar.pw-fair   { background: #f59e0b; }
.pw-meter-bar.pw-good   { background: #22c55e; }
.pw-meter-bar.pw-strong { background: #16a34a; }

.pw-meter-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #94a3b8;
    margin-top: 6px;
    min-height: 16px;
}

.pw-meter-label.pw-weak   { color: #dc2626; }
.pw-meter-label.pw-fair   { color: #b45309; }
.pw-meter-label.pw-good,
.pw-meter-label.pw-strong { color: #15803d; }

/* ---- Reglas ---- */
.pw-rules {
    list-style: none;
    margin: 10px 0 16px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #eef1f6;
    border-radius: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 12px;
}

.pw-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #64748b;
    transition: color 0.2s ease;
}

.pw-rules li i {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e2e8f0;
    color: transparent;
    font-size: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.pw-rules li.ok {
    color: #15803d;
}

.pw-rules li.ok i {
    background: #16a34a;
    color: #fff;
}

/* ---- Coinciden ---- */
.pw-match {
    font-size: 12px;
    font-weight: 600;
    margin-top: -6px;
    min-height: 16px;
    color: #94a3b8;
}

.pw-match.ok  { color: #15803d; }
.pw-match.bad { color: #dc2626; }

/* ---- Mensaje ---- */
.pw-msg {
    font-size: 13px;
    line-height: 1.45;
    border-radius: 10px;
    margin-top: 10px;
    padding: 0 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
}

.pw-msg.pw-msg-error {
    max-height: 90px;
    padding: 10px 12px;
    background: #fef2f2;
    color: #b91c1c;
}

/* ---- Botones ---- */
.pw-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.pw-btn {
    height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.pw-btn-ghost {
    background: #fff;
    border-color: #e2e8f0;
    color: #334155;
}

.pw-btn-ghost:hover {
    background: #f8fafc;
}

.pw-btn-primary {
    background: var(--primary-solid, #0c4a79);
    color: #fff;
    min-width: 190px;
}

.pw-btn-primary:hover:not(:disabled) {
    background: var(--active-primary-solid, #113055);
}

.pw-btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pw-btn-primary.pw-btn-busy {
    opacity: 0.85;
    cursor: progress;
}

.pw-btn-primary.pw-btn-done {
    background: #16a34a;
    opacity: 1;
}

/* Modo normal: sin "Cerrar sesion". Modo obligatorio: sin cerrar/cancelar */
.pw-overlay:not(.pw-forced) #pwLogout { display: none; }
.pw-overlay.pw-forced #pwCancel,
.pw-overlay.pw-forced #pwClose { display: none; }
.pw-overlay.pw-forced #pwLogout { margin-right: auto; }

@media screen and (max-width: 520px) {
    .pw-rules { grid-template-columns: 1fr; }
    .pw-actions { flex-wrap: wrap; }
    .pw-btn-primary { flex: 1 1 100%; min-width: 0; }
}

/* ---- Movimiento ---- */
@media (prefers-reduced-motion: no-preference) {
    @keyframes pw-shake {
        0%, 100% { transform: translateX(0); }
        20% { transform: translateX(-6px); }
        40% { transform: translateX(5px); }
        60% { transform: translateX(-4px); }
        80% { transform: translateX(2px); }
    }

    @keyframes pw-pop {
        0%   { transform: scale(0.6); }
        60%  { transform: scale(1.15); }
        100% { transform: scale(1); }
    }

    .pw-shake { animation: pw-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
    .pw-rules li.ok i { animation: pw-pop 0.25s ease; }
    .pw-close:hover { transform: rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
    .pw-overlay, .pw-modal, .pw-meter-bar, .pw-msg { transition: none; }
}
