/* Piilotetaan Blocksy:n oma hakumodaali — käytetään omaa */
#search-modal { display: none !important; }

/* Hakumodal */
.cs-search-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px 16px;
}

.cs-search-modal[hidden] {
    display: none;
}

.cs-search-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

/* Paneeli */
.cs-search-panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

/* Hakukenttärivi */
.cs-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #ebebeb;
    flex-shrink: 0;
}

#cs-search-input {
    flex: 1;
    font-size: 17px;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}

#cs-search-input::-webkit-search-cancel-button {
    display: none;
}

.cs-search-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #888;
    display: flex;
    align-items: center;
    line-height: 1;
}

.cs-search-close:hover {
    color: #111;
}

/* Tabit */
.cs-search-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid #ebebeb;
    flex-shrink: 0;
}

.cs-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    margin-bottom: -1px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.02em;
    font-family: inherit;
    transition: color 0.15s;
}

.cs-tab.active {
    color: #111;
    border-bottom-color: #111;
}

.cs-tab:hover:not(.active) {
    color: #333;
}

/* Tulosalue */
.cs-search-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.cs-tab-panel {
    display: none;
}

.cs-tab-panel.active {
    display: block;
}

.cs-results {
    padding: 6px 0;
}

/* Tuotekortti hakutuloksessa */
.cs-product-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.cs-product-item:hover {
    background: #f7f7f7;
}

.cs-product-image {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f2f2f2;
}

.cs-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cs-product-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.cs-product-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-product-price {
    font-size: 13px;
    color: #666;
}

/* Merkki/osasto/sivu -hakutulos */
.cs-term-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 20px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.cs-term-item:hover {
    background: #f7f7f7;
}

.cs-term-name {
    font-size: 14px;
    font-weight: 500;
}

.cs-term-count {
    font-size: 12px;
    color: #999;
}

/* Tila-viestit */
.cs-state {
    padding: 24px 20px;
    color: #999;
    font-size: 14px;
}

/* Estä body-scrollaus modaalin ollessa auki */
body.cs-modal-open {
    overflow: hidden;
}

/* Hakupainike (shortcode) */
.cs-search-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: inherit;
    padding: 4px 8px;
}

.cs-search-open:hover {
    opacity: 0.7;
}
