/* Autosuggestion Styles */
.autosuggestion-container {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Ensure the search form has relative positioning */
#search {
    position: relative;
}

#search form {
    position: relative;
}

.autosuggestion-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

.autosuggestion-item {
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

.autosuggestion-item:hover,
.autosuggestion-item.selected {
    background-color: #f8f9fa;
}

.autosuggestion-item.selected {
    background-color: #e3f2fd;
}

.suggestion-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    min-height: 20px;
}

.suggestion-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    font-weight: 400;
    line-height: 1.4;
    word-break: break-word;
}

.suggestion-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Type-specific styling */
.suggestion-type-title {
    background-color: #e8f5e8;
    color: #2e7d32;
}

.suggestion-type-tag {
    background-color: #fff3e0;
    color: #f57c00;
}

.suggestion-type-category {
    background-color: #e3f2fd;
    color: #1976d2;
}

.suggestion-type-person {
    background-color: #fce4ec;
    color: #c2185b;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .autosuggestion-container {
        background: #2d2d2d;
        border-color: #404040;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .autosuggestion-list {
        background: #2d2d2d;
    }

    .autosuggestion-item {
        border-bottom-color: #404040;
    }

    .autosuggestion-item:hover,
    .autosuggestion-item.selected {
        background-color: #3a3a3a;
    }

    .autosuggestion-item.selected {
        background-color: #1e3a5f;
    }

    .suggestion-text {
        color: #e0e0e0;
    }

    .suggestion-type-title {
        background-color: #1b5e20;
        color: #a5d6a7;
    }

    .suggestion-type-tag {
        background-color: #e65100;
        color: #ffcc02;
    }

    .suggestion-type-category {
        background-color: #0d47a1;
        color: #90caf9;
    }

    .suggestion-type-person {
        background-color: #880e4f;
        color: #f8bbd9;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .autosuggestion-container {
        max-height: 250px;
        border-radius: 6px;
    }

    .suggestion-content {
        padding: 10px 12px;
    }

    .suggestion-text {
        font-size: 13px;
    }

    .suggestion-type {
        font-size: 10px;
        padding: 1px 6px;
    }
}

/* Animation for smooth appearance */
.autosuggestion-container {
    animation: fadeInDown 0.2s ease-out;
}

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

/* Loading state */
.autosuggestion-container.loading .autosuggestion-list::after {
    content: "Loading suggestions...";
    display: block;
    padding: 12px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
    font-style: italic;
}

/* Empty state */
.autosuggestion-container.empty .autosuggestion-list::after {
    content: "No suggestions found";
    display: block;
    padding: 12px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
    font-style: italic;
}

/* Focus styles for accessibility */
.autosuggestion-item:focus {
    outline: 2px solid #2196f3;
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .autosuggestion-container {
        border: 2px solid #000;
    }

    .autosuggestion-item {
        border-bottom: 1px solid #000;
    }

    .autosuggestion-item:hover,
    .autosuggestion-item.selected {
        background-color: #000;
        color: #fff;
    }
}
