/**
 * Enhanced Password Strength Meter Styles
 * Version: 1.0
 * Description: Modern, animated password strength meter for registration form
 */

/* Main container - make it more prominent */
.chroudakais-password-strength-meter {
    margin-top: 20px !important;
    margin-bottom: 20px !important;
    padding: 20px !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    border: 2px solid #e2e8f0 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    transition: all 0.3s ease !important;
    position: relative;
}

/* Add animation when visible */
.chroudakais-password-strength-meter:not([style*="display: none"]) {
    animation: slideInFade 0.3s ease forwards;
}

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

/* Strength meter bar container */
.strength-meter-bar {
    height: 12px !important;
    background: #e5e7eb !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    margin-bottom: 15px !important;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* Animated fill bar */
.strength-meter-fill {
    height: 100% !important;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 20px !important;
    position: relative;
    overflow: hidden;
}

/* Add shimmer effect to fill */
.strength-meter-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Strength levels with enhanced gradients */
.strength-meter-fill.weak {
    width: 33% !important;
    background: linear-gradient(90deg, #ef4444, #dc2626) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3) !important;
}

.strength-meter-fill.medium {
    width: 66% !important;
    background: linear-gradient(90deg, #f59e0b, #ea580c) !important;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3) !important;
}

.strength-meter-fill.strong {
    width: 100% !important;
    background: linear-gradient(90deg, #10b981, #059669) !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3) !important;
}

/* Strength text with icon */
.strength-meter-text {
    font-size: 15px !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px !important;
}

/* Add icons before text */
.strength-meter-text::before {
    content: '🔒';
    font-size: 18px;
}

.strength-meter-text.weak {
    color: #dc2626 !important;
}

.strength-meter-text.weak::before {
    content: '⚠️';
}

.strength-meter-text.medium {
    color: #ea580c !important;
}

.strength-meter-text.medium::before {
    content: '🔐';
}

.strength-meter-text.strong {
    color: #059669 !important;
}

.strength-meter-text.strong::before {
    content: '✅';
}

/* Password requirements list */
.password-requirements {
    background: #f8fafc;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.password-requirements ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.password-requirements li {
    padding: 8px 0 8px 30px !important;
    position: relative !important;
    font-size: 14px !important;
    color: #64748b !important;
    transition: all 0.3s ease !important;
    line-height: 1.4 !important;
}

/* Requirement icons */
.password-requirements li::before {
    content: '○';
    position: absolute;
    left: 0;
    top: 8px;
    font-size: 20px;
    color: #cbd5e1;
    transition: all 0.3s ease;
}

/* Met requirement styling */
.password-requirements li.met {
    color: #059669 !important;
    font-weight: 500;
    transform: translateX(3px);
}

.password-requirements li.met::before {
    content: '✓';
    color: #10b981;
    font-weight: bold;
    animation: checkBounce 0.3s ease;
}

@keyframes checkBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Add a header to requirements */
.password-requirements::before {
    content: 'Exigences du mot de passe:';
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Real-time validation indicator on password field */
#reg_password {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#reg_password:focus {
    outline: none;
}

/* Visual feedback on password field based on strength */
#reg_password.strength-weak {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

#reg_password.strength-medium {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1) !important;
}

#reg_password.strength-strong {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chroudakais-password-strength-meter {
        padding: 15px !important;
        margin-top: 15px !important;
    }
    
    .password-requirements li {
        font-size: 13px !important;
        padding: 6px 0 6px 25px !important;
    }
    
    .password-requirements li::before {
        font-size: 16px;
        top: 6px;
    }
}

/* Dark mode support (if your theme has dark mode) */
@media (prefers-color-scheme: dark) {
    .chroudakais-password-strength-meter {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
        border-color: #475569 !important;
    }
    
    .password-requirements {
        background: #1e293b;
    }
    
    .password-requirements li {
        color: #94a3b8 !important;
    }
    
    .password-requirements li.met {
        color: #10b981 !important;
    }
    
    .strength-meter-bar {
        background: #334155 !important;
    }
}

/* Add a tooltip for password tips */
.password-tip {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.password-tip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1e293b;
}

#reg_password:focus ~ .chroudakais-password-strength-meter .password-tip {
    opacity: 1;
}

/* Animation for when all requirements are met */
.chroudakais-password-strength-meter.all-requirements-met {
    border-color: #10b981 !important;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}
