/**
 * Tool Search Styles
 */

.gth-tool-search {
    max-width: 600px;
    margin: 0 auto 32px auto;
    position: relative;
}

.gth-search-container {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.gth-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.gth-search-icon {
    position: absolute;
    left: 16px;
    color: var(--gth-text-muted, #64748b);
    pointer-events: none;
}

.gth-search-input {
    width: 100%;
    height: 52px;
    padding: 0 48px;
    font-family: inherit;
    font-size: 16px;
    color: var(--gth-text-primary, #1e293b);
    background: var(--gth-bg-card, #ffffff);
    border: 2px solid var(--gth-border-color, #e2e8f0);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.gth-search-input:hover {
    border-color: var(--gth-border-color-hover, #cbd5e1);
}

.gth-search-input:focus {
    border-color: var(--gth-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.gth-search-input::placeholder {
    color: var(--gth-text-muted, #94a3b8);
}

.gth-search-clear {
    position: absolute;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gth-gray-100, #f1f5f9);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gth-text-secondary, #64748b);
    transition: all 0.2s ease;
}

.gth-search-clear:hover {
    background: var(--gth-gray-200, #e2e8f0);
    color: var(--gth-text-primary, #1e293b);
}

.gth-search-filter {
    flex-shrink: 0;
}

.gth-category-filter {
    height: 52px;
    padding: 0 40px 0 16px;
    font-family: inherit;
    font-size: 14px;
    color: var(--gth-text-primary, #1e293b);
    background: var(--gth-bg-card, #ffffff);
    border: 2px solid var(--gth-border-color, #e2e8f0);
    border-radius: 12px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
}

.gth-category-filter:hover {
    border-color: var(--gth-border-color-hover, #cbd5e1);
}

.gth-category-filter:focus {
    border-color: var(--gth-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Search Results Dropdown */
.gth-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--gth-bg-card, #ffffff);
    border: 1px solid var(--gth-border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.gth-search-results-list {
    list-style: none;
    margin: 0;
    padding: 8px;
}

.gth-search-result-item {
    margin: 0;
    padding: 0;
}

.gth-search-result-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.gth-search-result-link:hover,
.gth-search-result-link:focus {
    background: var(--gth-gray-50, #f8fafc);
    outline: none;
}

.gth-search-result-link.highlighted {
    background: var(--gth-primary-subtle, #eff6ff);
}

.gth-search-result-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gth-gray-100, #f1f5f9);
    border-radius: 10px;
    font-size: 20px;
    flex-shrink: 0;
}

.gth-search-result-content {
    flex: 1;
    min-width: 0;
}

.gth-search-result-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--gth-text-primary, #1e293b);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gth-search-result-category {
    font-size: 13px;
    color: var(--gth-text-secondary, #64748b);
    margin: 2px 0 0 0;
}

.gth-search-result-arrow {
    color: var(--gth-text-muted, #94a3b8);
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.15s ease;
}

.gth-search-result-link:hover .gth-search-result-arrow,
.gth-search-result-link.highlighted .gth-search-result-arrow {
    opacity: 1;
    transform: translateX(0);
}

.gth-search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--gth-text-secondary, #64748b);
}

.gth-search-no-results-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.gth-search-loading {
    padding: 24px;
    text-align: center;
    color: var(--gth-text-secondary, #64748b);
}

/* Keyboard hint */
.gth-search-hint {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 12px;
    border-top: 1px solid var(--gth-border-color, #e2e8f0);
    font-size: 12px;
    color: var(--gth-text-muted, #94a3b8);
}

.gth-search-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-family: inherit;
    font-size: 11px;
    background: var(--gth-gray-100, #f1f5f9);
    border: 1px solid var(--gth-border-color, #e2e8f0);
    border-radius: 4px;
    margin-right: 4px;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .gth-search-input {
        background: var(--gth-bg-card, #1e293b);
        color: var(--gth-text-primary, #f1f5f9);
        border-color: var(--gth-border-color, #334155);
    }

    .gth-search-input:focus {
        border-color: var(--gth-primary, #3b82f6);
    }

    .gth-category-filter {
        background: var(--gth-bg-card, #1e293b);
        color: var(--gth-text-primary, #f1f5f9);
        border-color: var(--gth-border-color, #334155);
    }

    .gth-search-results {
        background: var(--gth-bg-card, #1e293b);
        border-color: var(--gth-border-color, #334155);
    }

    .gth-search-result-link:hover,
    .gth-search-result-link.highlighted {
        background: rgba(255, 255, 255, 0.05);
    }

    .gth-search-result-icon {
        background: rgba(255, 255, 255, 0.1);
    }

    .gth-search-clear {
        background: rgba(255, 255, 255, 0.1);
    }

    .gth-search-clear:hover {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .gth-search-container {
        flex-direction: column;
    }

    .gth-category-filter {
        width: 100%;
    }

    .gth-search-input {
        height: 48px;
    }

    .gth-category-filter {
        height: 48px;
    }
}
