/**
 * Foundation Autocomplete Styles
 */

/* Wrapper positioning */
.foundation-name-wrapper {
    position: relative;
}

/* Results dropdown */
.foundation-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.foundation-autocomplete-results::-webkit-scrollbar {
    width: 6px;
}

.foundation-autocomplete-results::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.foundation-autocomplete-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.foundation-autocomplete-results::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Results list */
.foundation-autocomplete-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Individual items */
.foundation-autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.15s ease;
    direction: rtl;
    text-align: right;
}

.foundation-autocomplete-item:last-child {
    border-bottom: none;
}

.foundation-autocomplete-item:hover,
.foundation-autocomplete-item.active {
    background-color: #f5f5f5;
}

/* Foundation with owner (selectable as secondary contact) */
.foundation-autocomplete-item.foundation-has-owner {
    background-color: #fafafa;
}

.foundation-autocomplete-item.foundation-has-owner:hover {
    background-color: #f5f5f5;
}

/* English name styling */
.foundation-english-name {
    color: #666;
    font-size: 0.9em;
    direction: ltr;
    unicode-bidi: embed;
}

/* Registration number styling */
.foundation-reg-number {
    color: #888;
    font-size: 0.85em;
    font-family: monospace;
}

/* Owner badge (informational) */
.foundation-owner-badge {
    display: inline-block;
    background-color: #42a5f5;
    color: #fff;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 8px;
    float: left;
}

/* Create new option */
.foundation-autocomplete-item.foundation-create-new {
    background-color: #e8f5e9;
    color: #2e7d32;
    font-weight: 500;
}

.foundation-autocomplete-item.foundation-create-new:hover {
    background-color: #c8e6c9;
}

/* Loading state */
.foundation-autocomplete-loading {
    padding: 15px;
    text-align: center;
    color: #666;
}

.foundation-autocomplete-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    margin-right: 8px;
    animation: foundation-spin 0.8s linear infinite;
}

@keyframes foundation-spin {
    to {
        transform: rotate(360deg);
    }
}

/* No results */
.foundation-autocomplete-no-results {
    padding: 15px;
    text-align: center;
    color: #888;
}

/* Selection indicator */
.foundation-selection-indicator {
    margin-top: 8px;
    padding: 10px 12px;
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    direction: rtl;
}

.foundation-selected-name {
    color: #1565c0;
    font-weight: 500;
}

.foundation-selected-english {
    color: #666;
    font-size: 0.9em;
    font-weight: normal;
}

.foundation-clear-selection {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.15s ease;
}

.foundation-clear-selection:hover {
    color: #d32f2f;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .foundation-autocomplete-results {
        max-height: 200px;
    }

    .foundation-autocomplete-item {
        padding: 8px 12px;
        font-size: 0.95em;
    }

    .foundation-selection-indicator {
        padding: 8px 10px;
        font-size: 0.95em;
    }
}
