/* ============================================================================
   ESTILOS PARA VALIDADOR DE CONTRASEÑAS - CLINIKDENT
   Barra de fortaleza, requisitos y sugerencias
   ============================================================================ */

/* Contenedor principal de validación */
.password-validation {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    margin-top: 0.5rem;
    animation: slideDown 0.2s ease-out;
}

/* Versión ancho completo debajo de ambos campos */
.password-strength-wrapper .password-validation {
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.password-strength-wrapper .password-strength {
    margin-bottom: .6rem;
}

.password-strength-wrapper .password-strength .progress {
    height: 6px;
}

.password-strength-wrapper #strength-text {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

/* Barra de fortaleza de contraseña */
.password-strength .progress {
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.password-strength .progress-bar {
    transition: all 0.4s ease;
    background: linear-gradient(90deg, #dc3545, #ffc107, #28a745);
    background-size: 300% 100%;
    animation: strengthGlow 2s ease infinite;
}

.password-strength .progress-bar.bg-danger {
    background-position: 0% 50%;
}

.password-strength .progress-bar.bg-warning {
    background-position: 50% 50%;
}

.password-strength .progress-bar.bg-success {
    background-position: 100% 50%;
}

@keyframes strengthGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Lista de requisitos */
.password-requirements {
    background: #fff;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    border: 1px solid #f1f3f5;
}

/* Distribución consistente en dos columnas en desktop, una en móvil */
.password-requirements .row {
    display: grid;
    grid-template-columns: 1fr; /* Lista en una sola columna para mejor lectura */
    gap: 0.45rem 0.75rem;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    transition: color 0.2s ease;
    padding: 0.05rem 0;
}

.requirement-item:last-child {
    margin-bottom: 0;
}

.requirement-item.text-success {
    animation: checkmarkBounce 0.5s ease;
}

@keyframes checkmarkBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.requirement-item i {
    font-size: 0.9rem;
    width: 1rem;
    flex: 0 0 1rem;
    text-align: center;
    line-height: 1;
}

.requirement-item i.bi-check-circle-fill {
    color: #28a745 !important;
    text-shadow: 0 0 5px rgba(40, 167, 69, 0.3);
}

.requirement-item small {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
}

/* Sugerencias de contraseña */
.password-suggestions .alert {
    background: #f8fbff !important;
    border: 1px solid #e6f0ff !important;
    border-left: 4px solid #0d6efd !important;
    border-radius: 10px !important;
    animation: fadeInUp 0.25s ease;
}

.password-suggestions {
    max-height: 180px;
    overflow: auto;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.password-suggestions ul {
    list-style-type: none !important;
    padding-left: 0 !important;
    margin: 0;
}

.password-suggestions li {
    position: relative;
    padding-left: 1.1rem;
    margin-bottom: 0.25rem;
    line-height: 1.35;
}

.password-suggestions li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #0d6efd;
    font-weight: 700;
}

.password-suggestions li:last-child {
    margin-bottom: 0;
}

/* Indicador de coincidencia de contraseñas */
.password-match-indicator {
    animation: slideInFromLeft 0.3s ease;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.password-match-indicator .alert {
    margin-bottom: 0;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.password-match-indicator .alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.05));
    border-color: rgba(40, 167, 69, 0.3);
    color: #155724;
}

.password-match-indicator .alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    border-color: rgba(220, 53, 69, 0.3);
    color: #721c24;
}

/* Indicador de Caps Lock */
.caps-lock-indicator {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.caps-lock-indicator .alert {
    margin-bottom: 0;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 193, 7, 0.05));
    border-color: rgba(255, 193, 7, 0.4);
    color: #856404;
}

/* Efectos de hover para campos de contraseña */
input[type="password"]:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 202, 240, 0.25) !important;
    border-color: #0dcaf0 !important;
}

/* Campo de contraseña con validación */
.form-control.is-valid {
    border-color: #28a745 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.8-.8-.8-.8c-.2-.2-.2-.5 0-.7.2-.2.5-.2.7 0l.8.8.8-.8c.2-.2.5-.2.7 0 .2.2.2.5 0 .7l-.8.8.8.8c.2.2.2.5 0 .7-.2.2-.5.2-.7 0l-.8-.8-.8.8c-.2.2-.5.2-.7 0-.2-.2-.2-.5 0-.7z'/%3e%3c/svg%3e") !important;
}

.form-control.is-invalid {
    border-color: #dc3545 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 1.4 1.4m0-1.4-1.4 1.4'/%3e%3c/svg%3e") !important;
}

/* Generador de contraseñas */
.password-generator {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.password-generator-btn {
    background: linear-gradient(135deg, #6f42c1, #563d7c);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.password-generator-btn:hover {
    background: linear-gradient(135deg, #563d7c, #495057);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

/* Tooltips personalizados */
.password-tooltip {
    position: relative;
    cursor: help;
}

.password-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    animation: tooltipFadeIn 0.3s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .password-validation {
        padding: 0.6rem;
        font-size: 0.92rem;
    }
    
    .password-requirements .row { grid-template-columns: 1fr; }
    
    .requirement-item {
        margin-bottom: 0.4rem;
    }
    
    .password-suggestions li {
        font-size: 0.92rem;
        line-height: 1.3;
    }
}

/* Efectos adicionales para mejor UX */
.password-validation:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* Indicador de caracteres especiales */
.special-chars-hint {
    background: rgba(13, 202, 240, 0.1);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    color: #0dcaf0;
    border: 1px solid rgba(13, 202, 240, 0.2);
}

/* Animación de escritura para sugerencias */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid #0dcaf0;
    white-space: nowrap;
    animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #0dcaf0; }
}