/**
 * AF AI Search - Styles
 *
 * @author    AtFirst
 * @copyright AtFirst
 * @license   AFL-3.0
 */

.afaisearch-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: inherit;
}

/* Form */
.afaisearch-form {
    width: 100%;
}

.afaisearch-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.afaisearch-input-wrapper:focus-within {
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.afaisearch-input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #333;
    outline: none;
}

.afaisearch-input::placeholder {
    color: #999;
}

.afaisearch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 4px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #2196f3;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.afaisearch-btn:hover {
    background: #1976d2;
}

.afaisearch-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loader */
.afaisearch-loader {
    position: absolute;
    right: 60px;
    display: flex;
    align-items: center;
}

.afaisearch-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: afaisearch-spin 0.8s linear infinite;
}

@keyframes afaisearch-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hint */
.afaisearch-hint {
    margin-top: 8px;
    padding: 0 4px;
}

.afaisearch-hint small {
    color: #888;
    font-size: 13px;
    font-style: italic;
}

/* Results */
.afaisearch-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.afaisearch-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.afaisearch-results-title {
    font-weight: 600;
    color: #333;
}

.afaisearch-results-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
}

.afaisearch-results-close:hover {
    color: #333;
}

/* Filters list */
.afaisearch-filters-list {
    padding: 16px;
}

.afaisearch-filter-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border-radius: 6px;
}

.afaisearch-filter-item:last-child {
    margin-bottom: 0;
}

.afaisearch-filter-label {
    min-width: 100px;
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.afaisearch-filter-value {
    flex: 1;
    color: #333;
    font-size: 14px;
}

.afaisearch-filter-value strong {
    color: #2196f3;
}

/* Actions */
.afaisearch-results-actions {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    text-align: right;
}

.afaisearch-btn-search {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    background: #4caf50;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.afaisearch-btn-search:hover {
    background: #43a047;
}

/* Error */
.afaisearch-error {
    margin-top: 8px;
    padding: 12px 16px;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    color: #c62828;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .afaisearch-container {
        max-width: 100%;
    }

    .afaisearch-input {
        font-size: 14px;
        padding: 12px 14px;
    }

    .afaisearch-btn {
        width: 44px;
        height: 44px;
    }

    .afaisearch-filter-label {
        min-width: 80px;
        font-size: 13px;
    }

    .afaisearch-filter-value {
        font-size: 13px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .afaisearch-input-wrapper {
        background: #2d2d2d;
        border-color: #444;
    }

    .afaisearch-input {
        color: #eee;
    }

    .afaisearch-results {
        background: #2d2d2d;
        border-color: #444;
    }

    .afaisearch-results-header {
        border-color: #444;
    }

    .afaisearch-results-title {
        color: #eee;
    }

    .afaisearch-filter-item {
        background: #383838;
    }

    .afaisearch-filter-label {
        color: #aaa;
    }

    .afaisearch-filter-value {
        color: #eee;
    }
}
