/* Enhanced Password Component Styles */

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

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
    padding-right: 90px !important; /* Space for both buttons */
}

.password-input-wrapper input[type="password"]::placeholder {
    letter-spacing: normal;
}

/* Toggle Button */
.password-toggle-btn {
    position: absolute;
    right: 45px; /* Default when generate button exists */
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 10;
}

/* When no generate button, move toggle closer */
.password-input-wrapper:not(:has(.password-generate-btn)) .password-toggle-btn {
    right: 12px;
}

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

.password-toggle-btn:focus {
    outline: none;
    color: #2563eb;
}

/* Generate Button */
.password-generate-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.password-generate-btn:hover {
    color: #1d4ed8;
    transform: scale(1.1);
}

.password-generate-btn:focus {
    outline: none;
    color: #1e40af;
}

.password-generate-btn:active {
    transform: scale(0.95);
}

/* Strength Indicator */
.password-strength-indicator {
    margin-top: 8px;
    display: none;
}

.strength-bar {
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

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

.strength-text {
    font-size: 0.75rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Tooltip */
.password-tooltip {
    position: absolute;
    top: -35px;
    right: 0;
    background-color: #1f2937;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 50;
}

.password-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #1f2937;
}

.password-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* Hidden class utility */
.hidden {
    display: none !important;
}

/* Ensure proper spacing when used with validation icons */
.password-input-wrapper input.valid-input,
.password-input-wrapper input.invalid-input {
    padding-right: 120px !important; /* Extra space for validation icon */
}

/* Animation for generate button */
@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.password-generate-btn:active {
    animation: pulse-ring 0.6s ease-out;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .password-toggle-btn {
        right: 40px;
    }

    .password-generate-btn {
        right: 10px;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .password-toggle-btn,
    .password-generate-btn {
        color: #9ca3af;
    }

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

    .password-generate-btn {
        color: #60a5fa;
    }

    .password-generate-btn:hover {
        color: #93c5fd;
    }

    .strength-bar {
        background-color: #374151;
    }
}
