/* ============================================= */
/* KS Search - Dropdown autocomplete             */
/* @author KamikStudio                            */
/* ============================================= */

/* Override overflow:hidden on search container so dropdown is visible */
.ks-search__inner {
    overflow: visible !important;
}

/* Result container - positioned below search input */
.ks-search-result {
    position: absolute;
    top: calc(100% + 6px);
    left: -2px;
    right: -2px;
    min-width: 580px;
    z-index: 2001;
}

/* Dropdown box */
.ks-search-dropdown {
    background: #f8fbf8;
    border: 1px solid rgba(11, 77, 28, 0.08);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
    padding: 18px 20px 16px;
    max-height: 70vh;
    overflow-y: auto;
    animation: ks-search-slideDown 0.2s ease-out;
}

@keyframes ks-search-slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header: title + close button */
.ks-search-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.ks-search-dropdown-title {
    font-size: 14px;
    font-weight: 600;
    color: #123d1c;
}

.ks-search-dropdown-title strong {
    color: #0b4d1c;
}

.ks-search-dropdown-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.ks-search-dropdown-close:hover {
    color: #1f2937;
}

/* ============================================= */
/* Two-column body: products left, categories right */
/* ============================================= */
.ks-search-body {
    display: flex;
    gap: 20px;
}

.ks-search-col-products {
    flex: 1 1 auto;
    min-width: 0;
}

.ks-search-col-categories {
    flex: 0 0 220px;
    border-left: 1px solid #eee;
    padding-left: 16px;
}

/* ============================================= */
/* Product items list                             */
/* ============================================= */
.ks-search-items {
    display: flex;
    flex-direction: column;
}

.ks-search-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.ks-search-item:last-child {
    border-bottom: 0;
}

.ks-search-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 8px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.ks-search-item a:hover {
    background: #eef6ef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    text-decoration: none;
}

/* Product image */
.ks-search-item-img {
    width: 64px;
    min-width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ks-search-item-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Product info */
.ks-search-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ks-search-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1b1b1b;
    line-height: 1.3;
}

.ks-search-item a:hover .ks-search-item-name {
    color: #0b4d1c;
}

/* Reference/SKU */
.ks-search-ref {
    font-size: 12px;
    color: #6b6b6b;
}

/* Price */
.ks-search-item-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.ks-search-price {
    font-size: 14px;
    font-weight: 700;
    color: #0b4d1c;
}

.ks-search-price-old {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
}

/* ============================================= */
/* Categories sidebar (right column)              */
/* ============================================= */
.ks-search-categories {
    display: flex;
    flex-direction: column;
}

.ks-search-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 8px;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
    border-radius: 6px;
}

.ks-search-category-item:last-child {
    border-bottom: 0;
}

.ks-search-category-item:hover {
    background: #eef6ef;
    text-decoration: none;
}

.ks-search-category-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ks-search-category-name {
    font-size: 14px;
    font-weight: 600;
    color: #1b1b1b;
    line-height: 1.2;
}

.ks-search-category-item:hover .ks-search-category-name {
    color: #0b4d1c;
}

.ks-search-category-count {
    font-size: 12px;
    color: #6b6b6b;
}

.ks-search-category-arrow {
    font-size: 22px;
    color: #9ca3af;
    font-weight: 700;
    line-height: 1;
    transition: color 0.15s;
}

.ks-search-category-item:hover .ks-search-category-arrow {
    color: #0b4d1c;
}

/* ============================================= */
/* "Show more" button                             */
/* ============================================= */
.ks-search-more-wrap {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.ks-search-more {
    display: inline-block;
    padding: 6px 14px;
    background: #e8f3ea;
    color: #0b4d1c;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid rgba(11, 77, 28, 0.15);
    transition: background 0.15s ease;
}

.ks-search-more:hover {
    background: #dff0e3;
    color: #0b4d1c;
    text-decoration: none;
}

/* ============================================= */
/* Footer (close link)                            */
/* ============================================= */
.ks-search-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.ks-search-footer-link {
    font-size: 13px;
    color: #6b6b6b;
    text-decoration: none;
    cursor: pointer;
}

.ks-search-footer-link:hover {
    color: #1b1b1b;
    text-decoration: none;
}

/* ============================================= */
/* Loading & No results                           */
/* ============================================= */
.ks-search-loading {
    text-align: center;
    padding: 24px;
    color: #9ca3af;
    font-size: 14px;
}

.ks-search-loading::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #0b4d1c;
    border-radius: 50%;
    animation: ks-search-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
}

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

.ks-search-no-results {
    text-align: center;
    padding: 28px 16px;
    color: #6b7280;
    font-size: 14px;
}

.ks-search-no-results strong {
    display: block;
    margin-bottom: 4px;
    color: #374151;
    font-size: 15px;
}

.ks-search-no-results span {
    display: block;
    font-size: 13px;
}

/* ============================================= */
/* Responsive                                     */
/* ============================================= */
@media (max-width: 992px) {
    .ks-search-result {
        min-width: 0;
        width: calc(100vw - 24px);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .ks-search-body {
        flex-direction: column;
        gap: 12px;
    }

    .ks-search-col-categories {
        flex: 0 0 auto;
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid #eee;
        padding-top: 12px;
    }

    .ks-search-dropdown {
        border-radius: 12px;
        max-height: 60vh;
    }
}

@media (max-width: 575px) {
    .ks-search-dropdown {
        padding: 12px;
        max-height: 55vh;
    }

    .ks-search-item-img {
        width: 52px;
        min-width: 52px;
        height: 52px;
    }

    .ks-search-item-name {
        font-size: 13px;
    }
}

/* ============================================= */
/* Scrollbar styling inside dropdown              */
/* ============================================= */
.ks-search-dropdown::-webkit-scrollbar {
    width: 6px;
}

.ks-search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.ks-search-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ks-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
