/* ========================================
   AC Search - Barra de pesquisa
   ======================================== */

.ac-search-wrap {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Input */
.ac-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.ac-search-input {
    width: 100%;
    padding: 14px 48px 14px 20px !important;
    font-size: 15px !important;
    color: #1a1a1a;
    background: #fff !important;
    border: 2px solid #e2e8f0;
    border-radius: 12px !important;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.ac-search-input::placeholder {
    color: #94a3b8;
}

.ac-search-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.ac-search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #94a3b8;
    pointer-events: none;
    transition: color .2s;
}

.ac-search-input:focus ~ .ac-search-icon {
    color: #6366f1;
}

.ac-search-spinner {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: ac-spin .6s linear infinite;
    display: none;
}

.ac-search-wrap.is-loading .ac-search-spinner {
    display: block;
}

.ac-search-wrap.is-loading .ac-search-icon {
    display: none;
}

@keyframes ac-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Dropdown */
.ac-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, .98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 16px;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, .08),
        0 4px 12px rgba(0, 0, 0, .04),
        0 0 0 1px rgba(0, 0, 0, .02);
    z-index: 99999;
    max-height: 480px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s, visibility .2s, transform .2s;
    scrollbar-width: thin;
}

.ac-search-dropdown.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ac-search-dropdown::-webkit-scrollbar {
    width: 5px;
}

.ac-search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.ac-search-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .12);
    border-radius: 3px;
}

/* Results list (unified) */
.ac-search-results {
    padding: 6px 0;
    list-style: none;
    margin: 0;
}

/* Shared item base */
.ac-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #1a1a1a;
    transition: background .1s;
    cursor: pointer;
}

.ac-search-item:hover,
.ac-search-item.is-active {
    background: rgba(99, 102, 241, .06);
}

/* Thumbnail (shared) */
.ac-search-item-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f1f5f9;
}

/* Info block (shared) */
.ac-search-item-info {
    flex: 1;
    min-width: 0;
}

.ac-search-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.ac-search-item-name mark {
    background: rgba(250, 204, 21, .4);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Category-specific: count badge */
.ac-search-item-meta {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 400;
    margin-top: 1px;
}

/* Category badge icon */
.ac-search-item-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #94a3b8;
}

.ac-search-item-badge svg {
    width: 14px;
    height: 14px;
}

/* View all */
.ac-search-view-all {
    display: block;
    text-align: center;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6366f1;
    text-decoration: none;
    border-top: 1px solid rgba(0, 0, 0, .06);
    transition: background .1s, color .1s;
    border-radius: 0 0 16px 16px;
}

.ac-search-view-all:hover {
    background: rgba(99, 102, 241, .06);
    color: #4338ca;
}

/* No results */
.ac-search-no-results {
    padding: 32px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

.ac-search-no-results svg {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    opacity: .4;
}

/* Skeleton loading */
.ac-search-skeleton {
    padding: 6px 0;
}

.ac-search-skeleton-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
}

.ac-search-skeleton-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e8ecf1 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: ac-shimmer 1.5s infinite;
    flex-shrink: 0;
}

.ac-search-skeleton-lines {
    flex: 1;
}

.ac-search-skeleton-line {
    height: 11px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e8ecf1 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: ac-shimmer 1.5s infinite;
    margin-bottom: 7px;
}

.ac-search-skeleton-line:first-child {
    width: 65%;
}

.ac-search-skeleton-line:last-child {
    width: 35%;
    margin-bottom: 0;
}

@keyframes ac-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Responsivo
   ======================================== */

@media (max-width: 768px) {
    .ac-search-wrap {
        max-width: 100%;
    }

    .ac-search-input {
        padding: 12px 44px 12px 16px;
        font-size: 16px;
        border-radius: 10px;
    }

    .ac-search-dropdown {
        max-height: 60vh;
        border-radius: 12px;
    }

    .ac-search-item {
        padding: 8px 12px;
        gap: 10px;
    }

    .ac-search-item-img {
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }

    .ac-search-view-all {
        border-radius: 0 0 12px 12px;
    }
}
