/* Advanced product search — autocomplete panel */
.tc-search-widget {
    position: relative;
    width: 100%;
}

.tc-search-form .search-wrapper,
.tc-search-form .input-group {
    position: relative;
}

.tc-search-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1080;
    background: #fff;
    border: 1px solid #ece5da;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(87, 46, 10, 0.14);
    overflow: hidden;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tc-search-panel[hidden] {
    display: none !important;
}

.tc-search-panel.is-open {
    display: block;
}

.tc-search-section {
    padding: 0.45rem 0;
}

.tc-search-section + .tc-search-section {
    border-top: 1px solid #f3ede4;
}

.tc-search-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #8a7b6c;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tc-search-clear-recent {
    border: 0;
    background: transparent;
    color: #d85f1f;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.tc-search-recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.15rem 0.75rem 0.45rem;
}

.tc-search-recent-chip {
    border: 1px solid #efe6d8;
    background: #fffaf3;
    color: #4b5563;
    border-radius: 999px;
    padding: 0.22rem 0.62rem;
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tc-search-recent-chip:hover {
    background: #fff0d7;
    border-color: #f1dfc7;
}

.tc-search-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.15rem 0.75rem 0.45rem;
}

.tc-search-category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    border: 1px solid #e8f5d5;
    background: #f7fee7;
    color: #4d7c0f;
    border-radius: 999px;
    padding: 0.24rem 0.62rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.tc-search-category-chip:hover {
    background: #ecfccb;
    color: #3f6212;
}

.tc-search-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.tc-search-item:hover,
.tc-search-item.is-active {
    background: #fff8ed;
}

.tc-search-item img,
.tc-search-item .tc-search-thumb-fallback {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f8f4ee;
    border: 1px solid #f1ebe2;
}

.tc-search-thumb-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b8a99a;
    font-size: 1rem;
}

.tc-search-item-body {
    flex: 1;
    min-width: 0;
}

.tc-search-item-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tc-search-item-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.12rem;
    flex-wrap: wrap;
}

.tc-search-item-cat {
    font-size: 0.65rem;
    color: #8a7b6c;
}

.tc-search-stock {
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.08rem 0.38rem;
}

.tc-search-stock.in {
    background: #ecfdf5;
    color: #15803d;
}

.tc-search-stock.out {
    background: #fef2f2;
    color: #dc2626;
}

.tc-search-item-price {
    text-align: end;
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 800;
    color: #d85f1f;
    white-space: nowrap;
}

.tc-search-item-price del {
    display: block;
    font-size: 0.62rem;
    color: #9ca3af;
    font-weight: 500;
}

.tc-search-footer {
    border-top: 1px solid #f3ede4;
    padding: 0.55rem 0.85rem;
    background: #fffaf3;
}

.tc-search-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #d85f1f;
    text-decoration: none;
}

.tc-search-footer a:hover {
    color: #b94716;
}

.tc-search-empty,
.tc-search-loading {
    padding: 1rem 0.85rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.78rem;
}

.tc-search-loading .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
    color: #d85f1f;
}

.tc-search-empty strong {
    display: block;
    color: #374151;
    margin-bottom: 0.25rem;
}

.tc-search-empty a {
    display: inline-flex;
    margin-top: 0.45rem;
    color: #d85f1f;
    font-weight: 700;
    text-decoration: none;
}

#mobileSearchBar .tc-search-panel {
    left: 0;
    right: 0;
}

@media (max-width: 991.98px) {
    .tc-search-panel {
        max-height: min(58vh, 360px);
        border-radius: 12px;
    }

    .tc-search-item {
        padding: 0.48rem 0.7rem;
    }

    .tc-search-item img,
    .tc-search-item .tc-search-thumb-fallback {
        width: 40px;
        height: 40px;
    }
}

html[dir="ltr"] .tc-search-item-price {
    text-align: right;
}

html[data-theme="dark"] .tc-search-panel {
    background: #1c1c1e;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .tc-search-section + .tc-search-section,
html[data-theme="dark"] .tc-search-footer {
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .tc-search-footer {
    background: #232323;
}

html[data-theme="dark"] .tc-search-item:hover,
html[data-theme="dark"] .tc-search-item.is-active {
    background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .tc-search-item-name {
    color: #f5f5f7;
}

html[data-theme="dark"] .tc-search-recent-chip {
    background: #232323;
    border-color: rgba(255, 255, 255, 0.1);
    color: #d4d4d8;
}

.tc-search-service-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    margin-inline-end: 0.35rem;
    vertical-align: middle;
}

.tc-search-category-chip--service {
    border-color: rgba(216, 95, 31, 0.25);
    color: #b94716;
}

.tc-search-empty-links {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}
