/**
 * ESTILOS PARA VALIDADOR DE SENHA
 * 
 * CSS para componentes de validação de senha:
 * - Medidor de força
 * - Lista de requisitos
 * - Botões de ação
 * - Feedback visual
 */

/* ========================================
   MEDIDOR DE FORÇA DA SENHA
   ======================================== */

.password-strength-meter {
    margin: 15px 0;
}

.strength-bar-container {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.strength-text {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    transition: color 0.3s ease;
}

/* ========================================
   REQUISITOS DE SENHA
   ======================================== */

.password-requirements {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.requirements-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin: 0 0 10px 0;
}

.requirements-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.requirement-item {
    font-size: 13px;
    color: #6c757d;
    padding: 6px 0;
    transition: all 0.2s ease;
}

.requirement-icon {
    display: inline-block;
    width: 20px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.requirement-met {
    color: #28a745;
}

.requirement-met .requirement-icon {
    color: #28a745;
}

.requirement-unmet {
    color: #dc3545;
}

.requirement-unmet .requirement-icon {
    color: #dc3545;
}

/* ========================================
   CAMPO DE SENHA COM AÇÕES
   ======================================== */

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
    flex: 1;
    padding-right: 45px; /* Espaço para botão de toggle */
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    color: #6c757d;
    transition: color 0.2s ease;
}

.password-toggle-btn:hover {
    color: #495057;
}

.password-toggle-btn:focus {
    outline: none;
}

/* ========================================
   BOTÕES DE AÇÃO
   ======================================== */

.password-actions {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.btn-generate-password {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-generate-password:hover {
    background: #138496;
    transform: translateY(-1px);
}

.btn-generate-password:active {
    transform: translateY(0);
}

.btn-show-requirements {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-show-requirements:hover {
    background: #5a6268;
}

/* ========================================
   ALERTAS E MENSAGENS
   ======================================== */

.password-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.password-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.password-alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.password-alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.password-alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* ========================================
   TOOLTIP DE AJUDA
   ======================================== */

.password-help-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
}

.password-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
}

.password-help-tooltip:hover .password-help-content {
    visibility: visible;
    opacity: 1;
}

.password-help-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    width: 250px;
    transition: opacity 0.3s;
}

.password-help-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* ========================================
   ANIMAÇÕES
   ======================================== */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.password-input-error {
    animation: shake 0.5s;
    border-color: #dc3545 !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.requirement-met {
    animation: pulse 0.3s ease;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

@media (max-width: 768px) {
    .password-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .password-toggle-btn {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .password-actions {
        flex-direction: column;
    }
    
    .btn-generate-password,
    .btn-show-requirements {
        width: 100%;
        justify-content: center;
    }
    
    .password-help-content {
        width: 200px;
    }
}

/* ========================================
   MODO ESCURO (OPCIONAL)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .password-requirements {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .requirements-title {
        color: #e2e8f0;
    }
    
    .requirement-item {
        color: #cbd5e0;
    }
    
    .strength-bar-container {
        background-color: #4a5568;
    }
    
    .password-alert-success {
        background: #2f4f3f;
        border-color: #3d6450;
        color: #9ae6b4;
    }
    
    .password-alert-warning {
        background: #4a3f2f;
        border-color: #5d4e37;
        color: #fbd38d;
    }
    
    .password-alert-danger {
        background: #4f2f2f;
        border-color: #633838;
        color: #fc8181;
    }
}

/* ========================================
   CLASSES UTILITÁRIAS
   ======================================== */

.password-field-group {
    margin-bottom: 20px;
}

.password-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
}

.password-label-required::after {
    content: " *";
    color: #dc3545;
}

.password-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    font-style: italic;
}

/* ========================================
   ESTADOS DO INPUT
   ======================================== */

input[type="password"]:focus,
input[type="text"].password-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

input[type="password"].is-valid,
input[type="text"].password-input.is-valid {
    border-color: #28a745;
}

input[type="password"].is-invalid,
input[type="text"].password-input.is-invalid {
    border-color: #dc3545;
}

/* ========================================
   LOADING STATE
   ======================================== */

.password-validating {
    position: relative;
}

.password-validating::after {
    content: "";
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}
