/* ── Custom Ajax Search Styles ── */

.cas-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    font-family: inherit;
}

/* Search Bar */
.cas-search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cas-search-bar:focus-within {
    border-color: #2d8f47;
    box-shadow: 0 0 0 3px rgba(45, 143, 71, 0.12);
}

.cas-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 12px 16px;
    font-size: 15px;
    color: #333;
    background: transparent;
}

.cas-search-input::placeholder {
    color: #aaa;
}

.cas-search-btn {
    background: #2d8f47;
    border: none;
    color: #fff;
    padding: 0 18px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.cas-search-btn:hover {
    background: #246e38;
}

/* Dropdown */
.cas-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 99999;
    max-height: 460px;
    overflow-y: auto;
    animation: cas-fade-in 0.15s ease;
}

@keyframes cas-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Loading */
.cas-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    color: #666;
    font-size: 14px;
}

.cas-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #2d8f47;
    border-radius: 50%;
    animation: cas-spin 0.6s linear infinite;
}

@keyframes cas-spin {
    to { transform: rotate(360deg); }
}

/* Section Label */
.cas-section-label {
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    border-top: 1px solid #f0f0f0;
}

.cas-section-label:first-child {
    border-top: none;
}

/* Result Item */
.cas-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none !important;
    color: inherit !important;
    transition: background 0.15s;
    border-bottom: 1px solid #f8f8f8;
}

.cas-result-item:last-of-type {
    border-bottom: none;
}

.cas-result-item:hover {
    background: #f6fbf8;
}

/* Image */
.cas-result-image {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cas-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cas-no-image {
    width: 100%;
    height: 100%;
    background: #ebebeb;
}

/* Info */
.cas-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cas-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cas-result-item:hover .cas-result-title {
    color: #2d8f47;
}

.cas-price {
    font-size: 13px;
    font-weight: 600;
    color: #2d8f47;
}

.cas-price del {
    color: #aaa;
    font-weight: 400;
    margin-right: 4px;
}

.cas-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    background: #f0f4ff;
    color: #5b7dd8;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: fit-content;
}

/* No Results */
.cas-no-results {
    padding: 20px 18px;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* View All */
.cas-view-all {
    display: block;
    text-align: center;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #2d8f47 !important;
    text-decoration: none !important;
    border-top: 1px solid #f0f0f0;
    background: #f9fdf9;
    border-radius: 0 0 10px 10px;
    transition: background 0.15s;
}

.cas-view-all:hover {
    background: #f0faf2;
}

/* Scrollbar */
.cas-results-dropdown::-webkit-scrollbar {
    width: 5px;
}
.cas-results-dropdown::-webkit-scrollbar-track {
    background: #f9f9f9;
}
.cas-results-dropdown::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 480px) {
    .cas-results-dropdown {
        position: fixed;
        left: 10px;
        right: 10px;
        top: auto;
    }
}
