/**
 * Enhanced Password Strength Meter Styles
 * For Chroudakais Authentication Plugin
 */

/* Main container */
.chroudakais-enhanced-password-meter {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    animation: slideDown 0.3s ease-out;
}

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

/* Strength meter container */
.strength-meter-container {
    margin-bottom: 20px;
}

/* Bar wrapper with percentage */
.strength-meter-bar-wrapper {
    position: relative;
    margin-bottom: 10px;
}

/* The background bar */
.strength-meter-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

/* Animated stripes for the fill */
.strength-meter-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 20px 20px;
    animation: moveStripes 1s linear infinite;
}

@keyframes moveStripes {
    from { background-position: 0 0; }
    to { background-position: 20px 0; }
}

/* Percentage display */
.strength-percentage {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    background: white;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Strength label */
.strength-meter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.strength-text {
    font-weight: 600;
    color: #374151;
}

.strength-emoji {
    font-size: 20px;
}

/* Requirements grid */
.password-requirements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

/* Requirement items */
.requirement-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.requirement-item.met {
    color: #10b981;
}

.requirement-item .req-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    background: #fee2e2;
    color: #ef4444;
    transition: all 0.2s ease;
}

.requirement-item.met .req-icon {
    background: #dcfce7;
    color: #22c55e;
    animation: checkPop 0.3s ease;
}

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

.requirement-item .req-text {
    flex: 1;
}

/* Feedback section */
.password-feedback {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.feedback-list {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.feedback-list li {
    position: relative;
    font-size: 13px;
    color: #dc2626;
    margin-bottom: 5px;
    padding-left: 20px;
}

.feedback-list li::before {
    content: '⚠';
    position: absolute;
    left: 0;
    top: 0;
}

/* Strength-based colors */
.strength-meter-fill.very-weak {
    background: linear-gradient(90deg, #ef4444, #dc2626) !important;
}

.strength-meter-fill.weak {
    background: linear-gradient(90deg, #f97316, #ea580c) !important;
}

.strength-meter-fill.fair {
    background: linear-gradient(90deg, #eab308, #ca8a04) !important;
}

.strength-meter-fill.strong {
    background: linear-gradient(90deg, #84cc16, #65a30d) !important;
}

.strength-meter-fill.very-strong {
    background: linear-gradient(90deg, #22c55e, #16a34a) !important;
}

/* Text color matching */
.strength-meter-text.very-weak {
    color: #ef4444;
}

.strength-meter-text.weak {
    color: #f97316;
}

.strength-meter-text.fair {
    color: #eab308;
}

.strength-meter-text.strong {
    color: #84cc16;
}

.strength-meter-text.very-strong {
    color: #22c55e;
}

/* Icon animations and colors */
.strength-icon {
    display: inline-flex;
    transition: all 0.3s ease;
}

.strength-icon.very-weak svg {
    color: #ef4444;
}

.strength-icon.weak svg {
    color: #f97316;
}

.strength-icon.fair svg {
    color: #eab308;
}

.strength-icon.strong svg {
    color: #84cc16;
}

.strength-icon.very-strong svg {
    color: #22c55e;
}

.strength-icon.pulse {
    animation: iconPulse 0.3s ease;
}

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

/* Enhanced meter header */
.strength-meter-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* Requirements list styling */
#password-requirements-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

#password-requirements-list li {
    display: flex;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    color: #6b7280;
    transition: all 0.2s ease;
}

#password-requirements-list li.met {
    color: #10b981;
    font-weight: 500;
}

#password-requirements-list li .req-check {
    display: inline-block;
    width: 16px;
    margin-right: 8px;
    text-align: center;
    font-weight: bold;
    color: inherit;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chroudakais-enhanced-password-meter {
        padding: 15px;
    }
    
    .password-requirements-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .requirement-item {
        padding: 5px 0;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .chroudakais-enhanced-password-meter {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: #374151;
    }
    
    .strength-meter-bar {
        background: #374151;
    }
    
    .strength-text {
        color: #e5e7eb;
    }
    
    .requirement-item {
        color: #9ca3af;
    }
    
    .requirement-item.met {
        color: #34d399;
    }
    
    .password-requirements-grid,
    .password-feedback {
        border-top-color: #374151;
    }
}

/* Integration with existing meter (hide old one if present) */
#password-strength-meter:not(.chroudakais-enhanced-password-meter) {
    display: none !important;
}

/* Ensure our meter shows when old one would */
.chroudakais-enhanced-password-meter {
    display: block !important;
}

/* Password field visual feedback */
#reg_password {
    transition: border-color 0.3s ease;
}

#reg_password:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Confirm password field visual feedback */
#reg_password_confirm {
    transition: all 0.3s ease;
}

#reg_password_confirm:focus {
    outline: none;
}

/* Visual states for password confirmation */
#reg_password_confirm.password-match {
    border-color: #22c55e !important;
    background-color: rgba(34, 197, 94, 0.05);
}

#reg_password_confirm.password-mismatch {
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.05);
}

/* Show/hide password toggle button (optional enhancement) */
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 5px;
}

.password-toggle:hover {
    color: #374151;
}

/* Animation for meter appearance */
.chroudakais-enhanced-password-meter {
    opacity: 0;
    animation: fadeInScale 0.3s ease forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Improve existing elements if they exist */
.chroudakais-password-strength-meter:not(.chroudakais-enhanced-password-meter) + .chroudakais-enhanced-password-meter {
    margin-top: -20px; /* Reduce gap if both exist */
}
