/**
 * Name Autocomplete Styles
 */

/* Wrapper for positioning */
.name-autocomplete-wrapper {
    position: relative;
    width: 100%;
}

/* Dropdown container */
.name-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-top: -1px;
}

/* Autocomplete item */
.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f3f4f6;
}

/* Name display */
.autocomplete-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    margin-bottom: 4px;
}

/* Parent information */
.autocomplete-parents {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.parent-label {
    font-weight: 500;
    color: #4b5563;
}

/* No results message */
.autocomplete-no-results {
    padding: 12px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    font-style: italic;
}

/* Error message */
.autocomplete-error {
    padding: 12px;
    text-align: center;
    color: #dc2626;
    font-size: 13px;
    background-color: #fee2e2;
}

/* Loading state */
.autocomplete-loading {
    padding: 12px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

.autocomplete-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Scrollbar styling */
.name-autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.name-autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.name-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.name-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Focus state for input */
.name-autocomplete-wrapper input:focus {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .name-autocomplete-dropdown {
        max-height: 200px;
    }
    
    .autocomplete-item {
        padding: 8px 10px;
    }
    
    .autocomplete-name {
        font-size: 13px;
    }
    
    .autocomplete-parents {
        font-size: 11px;
    }
}

/* Add to name-autocomplete.css or add-member-modal.css */

/* Visual indicator for selected existing member */
.name-field-wrapper {
    position: relative;
}

.existing-member-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    display: none;
}

.existing-member-indicator.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Highlight name input when existing member selected */
input[name="name"].existing-member-selected {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* Info message styling */
.existing-member-info {
    margin-top: 8px;
    padding: 10px;
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
    font-size: 13px;
    color: #1e40af;
    display: none;
}

.existing-member-info.active {
    display: block;
}

.existing-member-info strong {
    font-weight: 600;
}

.clear-selection-btn {
    margin-left: 8px;
    padding: 2px 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
}

.clear-selection-btn:hover {
    background: #dc2626;
}