/**
 * Deko Search - Frontend-Styles (Solaris-Layout)
 *
 * Nachempfunden dem FiboSearch-"Solaris"-Stil: zweispaltiges Dropdown mit
 * Trefferliste links und Details-Panel rechts, Orange-Akzent.
 *
 * Farben/Radius sind als CSS-Variablen gehalten -> leicht anpassbar.
 *
 * @package DekoSearch
 */

.deko-search {
    --dks-radius: 4px;
    --dks-border: #e3e3e3;
    --dks-bg: #ffffff;
    --dks-text: #222222;
    --dks-muted: #8a8a8a;
    --dks-accent: #e8480c;          /* FiboSearch-Solaris-Orange */
    --dks-accent-soft: #fdeee8;
    --dks-price: #222222;

    position: relative;
    width: 100%;
    max-width: 560px;
    box-sizing: border-box;
}

.deko-search *,
.deko-search *::before,
.deko-search *::after {
    box-sizing: border-box;
}

.deko-search--attached {
    max-width: none;
    width: auto;
}

/* ---------- Eigenes Suchfeld (Shortcode / Template-Tag) ---------- */

.deko-search__form {
    position: relative;
    display: flex;
    align-items: center;
}

.deko-search__icon-left {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dks-muted);
    pointer-events: none;
    display: inline-flex;
}

.deko-search__input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    font-size: 15px;
    line-height: 1.4;
    color: var(--dks-text);
    background: var(--dks-bg);
    border: 1px solid var(--dks-border);
    border-radius: var(--dks-radius);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.deko-search__input:focus {
    border-color: var(--dks-accent);
    box-shadow: 0 0 0 2px rgba(232, 72, 12, 0.12);
}

/* ---------- Eigene Suchleiste im Attach-Modus (Lupe links + X) ---------- */

.deko-search--custombar {
    display: flex;
    align-items: center;
}

.deko-search--custombar .deko-search__input {
    padding-left: 40px;
    padding-right: 36px;
}

/* Bulletproof: Theme-Button-Styles (z. B. Flatsome) duerfen nicht
   durchschlagen -> kein grauer Kasten, sauberer runder X-Button. */
.deko-search__clear {
    position: absolute !important;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #9aa0a6 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 50% !important;
    font-size: 19px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-shadow: none !important;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.deko-search__clear[hidden] {
    display: none !important;
}

.deko-search__clear:hover,
.deko-search__clear:focus {
    color: var(--dks-accent) !important;
    background: rgba(0, 0, 0, 0.06) !important;
    outline: none !important;
}

/* ---------- Ergebnis-Dropdown (Solaris, zweispaltig) ---------- */

.deko-search__results {
    position: absolute;
    z-index: 99999;
    top: calc(100% + 6px);
    left: 0;
}

.deko-search__results[hidden] {
    display: none;
}

/* Ein gemeinsamer, dezent gerahmter Container mit Trennlinie (statt zwei
   separater Orange-Boxen) - naeher am FiboSearch-Look. */
.deko-search--solaris {
    display: flex;
    gap: 0;
    width: 560px;
    max-width: calc(100vw - 20px);
    background: var(--dks-bg);
    border: 1px solid var(--dks-border);
    border-radius: var(--dks-radius);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

/* Ohne Details-Panel: schmaleres, einspaltiges Dropdown. */
.deko-search--nopanel {
    width: 380px;
}

.deko-search--nopanel .dks-suggestions {
    border-right: none;
}

.deko-search__status {
    flex: 1 1 auto;
    padding: 18px;
    font-size: 14px;
    color: var(--dks-muted);
    text-align: center;
    background: var(--dks-bg);
}

/* Linke Spalte: Trefferliste */
.dks-suggestions {
    flex: 1 1 52%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--dks-bg);
    border-right: 1px solid #ececec;
    overflow: hidden;
}

.dks-section-label {
    padding: 10px 14px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dks-muted);
    border-bottom: 1px solid #f0f0f0;
}

.deko-search__list {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    max-height: 60vh;
}

.deko-search__item > a {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 14px;
    color: inherit;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.deko-search__item.is-active > a,
.deko-search__item > a:hover {
    background: var(--dks-accent-soft);
    border-left-color: var(--dks-accent);
}

.deko-search__thumb {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: #f6f6f6;
}

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

.deko-search__info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
}

.deko-search__title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--dks-text);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.deko-search__title .dks-hl {
    font-weight: 700;
    color: var(--dks-text);
}

/* Preis unter dem Titel (volle Breite fuer den Produktnamen) */
.deko-search__price {
    margin-top: 2px;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--dks-price);
}

.deko-search__price del {
    color: var(--dks-muted);
    font-weight: 400;
    margin-right: 5px;
}

.deko-search__price ins {
    text-decoration: none;
    font-weight: 600;
}

.deko-search__all {
    display: block;
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: center;
    color: var(--dks-accent);
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
}

.deko-search__all:hover {
    background: var(--dks-accent-soft);
}

/* Rechte Spalte: Details-Panel */
.dks-details {
    flex: 1 1 48%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 18px 16px;
    background: var(--dks-bg);
}

.dks-detail-image {
    display: block;
    width: 100%;
    max-width: 180px;
    margin: 0 auto 12px; /* Bild bleibt zentriert */
}

.dks-detail-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.dks-detail-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dks-text);
    text-decoration: none;
    line-height: 1.3;
}

.dks-detail-title:hover {
    color: var(--dks-accent);
}

.dks-detail-sku {
    margin-top: 3px;
    font-size: 11px;
    color: var(--dks-muted);
}

.dks-detail-price {
    margin-top: 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--dks-text);
}

.dks-detail-price del {
    color: var(--dks-muted);
    font-weight: 400;
    font-size: 14px;
    margin-right: 6px;
}

.dks-detail-price ins {
    text-decoration: none;
}

.dks-detail-desc {
    margin-top: 10px;
    font-size: 12.5px;
    line-height: 1.5;
    color: #555;
}

/* Warenkorb-Bereich */
.dks-detail-cart {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
    width: 100%;
}

.dks-qty {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--dks-border);
    border-radius: 4px;
    overflow: hidden;
}

.dks-qty button {
    width: 30px;
    border: none;
    background: #f7f7f7;
    color: var(--dks-text);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.dks-qty button:hover {
    background: #eee;
}

.dks-qty-input {
    width: 44px;
    border: none;
    border-left: 1px solid var(--dks-border);
    border-right: 1px solid var(--dks-border);
    text-align: center;
    font-size: 14px;
    -moz-appearance: textfield;
}

.dks-qty-input::-webkit-outer-spin-button,
.dks-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dks-detail-btn {
    display: inline-block;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--dks-accent);
    border: 1px solid var(--dks-accent);
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.dks-detail-btn:hover {
    filter: brightness(0.92);
    color: #fff;
}

.dks-detail-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.dks-detail-btn.is-added {
    background: #1a7f37;
    border-color: #1a7f37;
}

/* ---------- Responsive: Details-Panel auf Mobile ausblenden ---------- */
@media (max-width: 768px) {
    .deko-search--solaris {
        width: calc(100vw - 20px);
        flex-direction: column;
    }
    .dks-details {
        display: none;
    }
}
