/* Container Box */
.cfs-search-container {
    position: relative;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Rounded Input Bar */
.cfs-search-box {
    display: flex;
    align-items: center;
    position: relative;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 28px;
    padding: 8px 18px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cfs-search-box:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.cfs-search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.cfs-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 15px;
    line-height: 1.4;
    color: #1f2937;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.cfs-input::placeholder {
    color: #9ca3af;
}

/* Spinner Loader */
.cfs-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: cfs-spin 0.6s linear infinite;
    flex-shrink: 0;
    margin-left: 8px;
}

@keyframes cfs-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Dropdown */
.cfs-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    z-index: 9999999;
    max-height: 520px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cfs-dropdown-content {
    padding: 14px 16px;
    display: block;
}

.cfs-mobile-header {
    display: none;
}

.cfs-desktop-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.cfs-group-block {
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
    margin-top: 10px;
}

.cfs-group-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* Category Badges */
.cfs-badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cfs-category-badge {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    line-height: 1.3;
    transition: all 0.15s ease;
}

.cfs-category-badge:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

/* Product Rows */
.cfs-items-list {
    display: flex;
    flex-direction: column;
}

.cfs-product-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    text-decoration: none;
    border-bottom: 1px solid #f9fafb;
    transition: background-color 0.15s ease;
}

.cfs-product-row:last-child {
    border-bottom: none;
}

.cfs-product-row:hover .cfs-item-name {
    color: #2563eb;
}

.cfs-img-wrap {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #f1f2f4;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 12px;
    background: #fdfdfd;
}

.cfs-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cfs-detail-wrap {
    flex: 1;
    min-width: 0;
}

.cfs-item-name {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cfs-item-price {
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    margin-top: 2px;
}

.cfs-item-price del {
    color: #9ca3af;
    font-weight: 400;
    margin-right: 4px;
}

.cfs-item-price ins {
    text-decoration: none;
}

/* View More Button */
.cfs-footer-action {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

.cfs-view-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.cfs-view-more-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.cfs-empty-state {
    font-size: 13px;
    color: #6b7280;
    padding: 10px 0;
    text-align: center;
}

/* Mobile Overlay Rules */
@media (max-width: 768px) {
    .cfs-search-container {
        max-width: 100%;
    }

    .cfs-results-dropdown {
        position: absolute !important;
        top: calc(100% + 6px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 99999999 !important;
        max-height: 65vh !important;
    }

    .cfs-dropdown-content {
        padding: 12px 14px;
    }

    .cfs-desktop-title {
        display: none;
    }

    .cfs-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 14px;
        font-weight: 600;
        color: #111827;
        margin-bottom: 8px;
        padding-bottom: 4px;
        border-bottom: 1px solid #f3f4f6;
    }

    .cfs-close-btn {
        background: none;
        border: none;
        font-size: 22px;
        line-height: 1;
        color: #6b7280;
        cursor: pointer;
        padding: 0 4px;
    }
}