/* Overlay Fix */
body.kam-search-active { overflow: hidden; }
.kam-search-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 9998; backdrop-filter: blur(2px); cursor: default; }

/* Wrapper & Box Fix */
.kam-live-search-wrapper { position: relative; width: 100%; max-width: 500px; margin: 0 auto; direction: rtl; }
.kam-search-box { position: relative; z-index: 9999; display: flex; align-items: center; background-color: var(--kaman-color-border, #DBDBDB); border-radius: 12px; padding: 12px 16px; transition: all 0.2s ease; cursor: text; }
.kam-search-icon { color: #717171; font-size: 16px; margin-left: 15px; }
.kam-search-input { flex: 1; background: transparent; border: none; outline: none; font-size: 14px; color: #333; font-family: inherit; }
.kam-search-input::placeholder { color: #888; }
.kam-search-clear { color: #999; cursor: pointer; padding: 0 5px; }

/* Panel Desktop Fix */
.kam-search-panel { position: absolute; top: calc(100% + 10px); left: 0; right: 0; width: 100%; background: #fff; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; z-index: 9999; }
.kam-mobile-search-header { display: none; }
.kam-search-panel-content { padding: 20px; overflow-y: auto; }

/* Zero State (Trending) */
.kam-popular-searches strong { display: block; font-size: 15px; color: #333; margin-bottom: 12px; font-weight: bold; }
.kam-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.kam-tag { background: var(--kaman-color-border, #DBDBDB); color: #555; padding: 6px 12px; border-radius: 20px; font-size: 13px; text-decoration: none; transition: 0.2s; }
.kam-tag:hover { background: #e0e0e1; color: #000; }
.kam-search-banner img { width: 100%; border-radius: 8px; object-fit: cover; }

/* Results List */
.kam-result-item { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; text-decoration: none; color: #333; transition: background 0.2s; }
.kam-result-item:last-child { border-bottom: none; }
.kam-result-item:hover { background: #fafafa; }
.kam-result-item img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; margin-left: 15px; }
.kam-result-info { flex: 1; }
.kam-result-title { display: block; font-size: 14px; font-weight: 500; margin-bottom: 5px; }
.kam-result-price { display: block; font-size: 13px; color: #008a6d; font-weight: bold; }
.kam-view-all-results { display: block; text-align: center; background: var(--kaman-color-border, #DBDBDB); padding: 10px; border-radius: 8px; color: #333; text-decoration: none; margin-top: 15px; font-size: 14px; }
.kam-search-loading { text-align: center; color: #888; font-size: 13px; padding: 20px 0; }

/* Mobile Full Screen Modal */
@media (max-width: 768px) {
    .kam-search-panel { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; z-index: 99999; display: flex; flex-direction: column; }
    .kam-mobile-search-header { display: none; }
    .kam-close-search-btn { background: none; border: none; font-size: 16px; color: #333; font-weight: bold; display: flex; align-items: center; gap: 8px; padding: 0; cursor: pointer; }
    .kam-search-panel-content { padding-top: 104px; }
}

.kam-search-box-row { position: relative; }
.kam-mobile-close-icon { display: none; }
.kam-user-searches { margin-bottom: 16px; }
.kam-user-searches-header { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.kam-user-searches strong { display:block; font-size:15px; color:#333; margin:0; font-weight:bold; }
.kam-user-search-clear-all { background:none; border:none; color:#d60000; cursor:pointer; font-size:14px; }
.kam-user-search-list { display:flex; flex-wrap:wrap; gap:8px; }

@media (max-width: 768px) {
    .kam-search-box-row { /*position: fixed; top: 64px; left: 16px; right: 16px;*/ z-index: 100000; display:flex; align-items:center; gap:8px;flex-direction: row-reverse; }
    .kam-search-box { position: static; flex:1; margin:0; right:auto; left:auto; }
    .kam-live-search-wrapper.kam-mobile-search-focused .kam-search-box { flex-basis: calc(100% - 42px); }
    .kam-mobile-close-icon { width:34px; height:34px; display:flex; align-items:center; justify-content:center; background:none; border:none; color:#000; cursor:pointer; }
    .kam-live-search-wrapper:not(.kam-mobile-search-focused) .kam-mobile-close-icon { display:none !important; }
    .kam-search-panel-content { padding-top: 104px; }
}
