/* ============================================================
   ASKO PREMIUM AJAX SEARCH DROPDOWN
   3-column design (Products | Machines | Categories)
   ============================================================ */

/* ---- Dropdown Container ---- */
.asko-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-top: 3px solid #0077b6;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.1);
    display: none;
    overflow: hidden;
    max-height: 80vh;
    animation: asko-sd-slide-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 3 columns: extend to 150% of search input width */
.asko-search-dropdown.asko-sd--cols-3 {
    width: 150%;
}

.asko-search-dropdown.is-open {
    display: block;
}

@keyframes asko-sd-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Columns Layout ---- */
.asko-sd__columns {
    display: flex;
    flex-direction: row;
}

.asko-sd__columns--1 .asko-sd__col { width: 100%; }
.asko-sd__columns--2 .asko-sd__col { width: 50%; }
.asko-sd__columns--3 .asko-sd__col { width: 33.33%; }

.asko-sd__col + .asko-sd__col {
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

/* ---- Section Header ---- */
.asko-sd__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 10px;
    font-size: 0.72rem;
    color: #64748b;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    background: rgba(248, 250, 252, 0.6);
}

.asko-sd__icon { font-size: 0.85rem; }

.asko-sd__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #0077b6;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: auto;
}

/* ---- List Container ---- */
.asko-sd__list {
    max-height: 460px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.asko-sd__list::-webkit-scrollbar { width: 4px; }
.asko-sd__list::-webkit-scrollbar-track { background: transparent; }
.asko-sd__list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

/* ---- Product Item ---- */
.asko-sd__product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.asko-sd__product:hover,
.asko-sd__product.is-highlighted {
    background: rgba(0, 119, 182, 0.06);
}

.asko-sd__thumb {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.asko-sd__info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.asko-sd__title {
    font-size: 0.84rem;
    font-weight: 500;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}

.asko-sd__title mark {
    background: rgba(250, 204, 21, 0.3);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 700;
}

.asko-sd__sku {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 1px;
}

.asko-sd__sku mark {
    background: rgba(250, 204, 21, 0.3);
    color: inherit;
    font-weight: 600;
}

.asko-sd__meta {
    text-align: right;
    flex-shrink: 0;
}

.asko-sd__price {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
}

.asko-sd__stock {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 500;
    margin-top: 2px;
    justify-content: flex-end;
}

.asko-sd__stock--instock { color: #16a34a; }
.asko-sd__stock--backorder { color: #d97706; }
.asko-sd__stock--outofstock { color: #94a3b8; }

/* ---- Machine Item ---- */
.asko-sd__machine {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.asko-sd__machine:hover,
.asko-sd__machine.is-highlighted {
    background: rgba(0, 119, 182, 0.06);
}

.asko-sd__machine-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-radius: 8px;
    color: #0077b6;
    flex-shrink: 0;
}

.asko-sd__machine-info {
    flex: 1;
    min-width: 0;
}

.asko-sd__machine-model {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asko-sd__machine-model mark {
    background: rgba(250, 204, 21, 0.3);
    color: inherit;
    font-weight: 700;
}

.asko-sd__machine-art {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 1px;
}

.asko-sd__machine-art mark {
    background: rgba(250, 204, 21, 0.3);
    color: inherit;
    font-weight: 600;
}

.asko-sd__machine-action {
    font-size: 0.75rem;
    color: #0077b6;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    display: none;
}

.asko-sd__machine:hover .asko-sd__machine-action,
.asko-sd__machine.is-highlighted .asko-sd__machine-action {
    display: inline-flex;
}

/* ---- Category Item ---- */
.asko-sd__category {
    display: block;
    padding: 12px 18px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.asko-sd__category:hover,
.asko-sd__category.is-highlighted {
    background: rgba(0, 119, 182, 0.06);
}

.asko-sd__cat-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: #1e293b;
}

.asko-sd__cat-name mark {
    background: rgba(250, 204, 21, 0.3);
    color: inherit;
    font-weight: 700;
}

.asko-sd__cat-path {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asko-sd__cat-count {
    display: inline-block;
    margin-top: 3px;
    font-size: 0.65rem;
    color: #64748b;
    background: rgba(0, 0, 0, 0.04);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ---- Servicetips (2026-07-31) ----
   Egen rad i full bredd under kolumnerna, inte en fjärde spalt: rubrikerna är
   hela meningar och blir oläsliga i en smal kolumn. Delar .asko-sd__header och
   .asko-sd__badge med de andra sektionerna. */
.asko-sd__tips {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.asko-sd__tip {
    display: block;
    padding: 10px 18px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: background 0.15s ease;
}

.asko-sd__tip:last-child { border-bottom: none; }

.asko-sd__tip:hover,
.asko-sd__tip.is-highlighted {
    background: rgba(0, 119, 182, 0.06);
}

.asko-sd__tip-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
}

.asko-sd__tip-excerpt {
    margin-top: 2px;
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;      /* håll raden kort: max två rader per tips */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.asko-sd__tip-title mark,
.asko-sd__tip-excerpt mark {
    background: rgba(250, 204, 21, 0.3);
    color: inherit;
    font-weight: 700;
}

/* ---- View All Footer ---- */
.asko-sd__view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 14px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0077b6;
    background: rgba(0, 119, 182, 0.04);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    transition: background 0.15s, color 0.15s;
}

.asko-sd__view-all:hover,
.asko-sd__view-all.is-highlighted {
    background: rgba(0, 119, 182, 0.1);
    color: #005a8e;
}

/* ---- Response Time ---- */
.asko-sd__timing {
    position: absolute;
    bottom: 40px;
    right: 8px;
    font-size: 0.6rem;
    color: #94a3b8;
    pointer-events: none;
    opacity: 0.6;
}

/* ---- Loading State ---- */
.asko-sd__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: #64748b;
    font-size: 0.85rem;
}

.asko-sd__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 119, 182, 0.15);
    border-top-color: #0077b6;
    border-radius: 50%;
    animation: asko-spin 0.6s linear infinite;
}

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

/* ---- Empty State ---- */
.asko-sd__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 32px 20px;
    text-align: center;
}

.asko-sd__empty p {
    margin: 0;
    font-size: 0.9rem;
    color: #1e293b;
}

.asko-sd__empty span {
    font-size: 0.78rem;
    color: #94a3b8;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .asko-search-dropdown {
        position: fixed;
        top: auto; /* JS sets this dynamically to sit below search form */
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 0;
        max-height: none;
        border: none;
        box-shadow: none;
        background: #fff;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        z-index: 9999;
        padding-top: 0;
    }

    .asko-sd__columns {
        flex-direction: column;
    }

    .asko-sd__columns--2 .asko-sd__col,
    .asko-sd__columns--3 .asko-sd__col--products,
    .asko-sd__columns--3 .asko-sd__col--machines,
    .asko-sd__columns--3 .asko-sd__col--categories {
        width: 100%;
    }

    .asko-sd__col + .asko-sd__col {
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .asko-sd__list {
        max-height: none;
        overflow-y: visible;
    }

    .asko-sd__machine-action {
        display: inline-flex;
        opacity: 1;
        transform: none;
    }

    /* Sticky view-all button at bottom on mobile */
    .asko-sd__view-all {
        position: sticky;
        bottom: 0;
        background: #fff;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        padding: 14px;
        font-size: 0.9rem;
        z-index: 2;
    }
}

/* Lock body scroll when mobile dropdown is open */
body.asko-search-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ===== Remove old search dropdown styles to prevent conflicts ===== */
.search-dropdown { display: none !important; }
