/* codingnexus_search — Such-Modal (Morayne-Nachbau) */
.cn-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    background: rgba(0, 0, 0, .55);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 48px 90px 60px;
}
.cn-modal-backdrop.is-open { display: block; }
.cn-modal-lock, .cn-modal-lock body { overflow: hidden; }

.cn-modal {
    position: relative;
    background: #fff;
    border-radius: 10px;
    max-width: 1800px;
    margin: 0 auto;
    padding: 26px 34px 38px;
    min-height: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}

/* Schliessen-Kreis, aussen an der Modal-Ecke */
.cn-modal-x {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--primary, #f7a600);
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

.cn-modal-logo {
    display: block;
    height: 40px;
    width: auto;
    margin: 0 0 22px;
}

/* Suchzeile */
.cn-modal-bar {
    display: flex;
    align-items: stretch;
    margin-bottom: 14px;
}
.cn-modal-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid #e5b96b;
    border-right: 0;
    border-radius: 4px 0 0 4px;
    padding: .7rem 1rem;
    font-size: 1.05rem;
    outline: none;
}
.cn-modal-input:focus { border-color: var(--primary, #f7a600); }
.cn-modal-go {
    flex: 0 0 auto;
    width: 56px;
    border: 0;
    border-radius: 0 4px 4px 0;
    background: var(--primary, #f7a600);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

/* Begriffs-Chips */
.cn-modal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.cn-chip {
    border: 1px solid #d9d9d9;
    border-radius: 999px;
    background: #fff;
    padding: .3rem .95rem;
    font-size: .9rem;
    color: #222;
    cursor: pointer;
    white-space: nowrap;
}
.cn-chip:hover { border-color: var(--primary, #f7a600); }
.cn-chip strong { font-weight: 700; }

/* Toolbar: Zaehler + Sortierung (nur mit Suchbegriff) */
/* Zweispaltig: Filter-Seitenleiste links, Ergebnisse rechts */
/* Filter-Seitenleiste — luftig wie im Live-System (Morayne): breiter, groessere
   Schrift, mehr Abstand, borderless mit dezenter Trennlinie zum Grid. */
.cn-modal-body {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}
/* Rechte Spalte: Suchleiste + Chips + Ergebnisse untereinander */
.cn-modal-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
/* Linke Spalte: Logo (oben) + Filter, durchgehend wie im Live-System */
.cn-modal-side { flex: 0 0 250px; }
.cn-side-content {
    max-height: 62vh;
    overflow-y: auto;
    overflow-x: hidden;   /* kein horizontaler Balken durch lange Namen/Badges */
    /* Luft zur Scrollleiste (Live-Look): sonst klebt der Preis-Slider daran.
       scrollbar-gutter haelt den Abstand konstant, auch ohne sichtbaren Balken. */
    padding-right: 16px;
    scrollbar-gutter: stable;
}
/* Der Preis-Block darf den vollen Spalteninnenraum nutzen; nur minimale
   Eigenpolsterung, damit die Griffe/Badges nicht an den Rand stossen. */
.cn-side-price .cn-price { padding: 4px 2px 0; }
.cn-side-h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 18px;
}
.cn-side-reset {
    border: 0;
    background: none;
    color: var(--primary, #f7a600);
    font-size: .82rem;
    cursor: pointer;
    padding: 0;
}
.cn-side-grp { margin-bottom: 26px; }
.cn-side-t {
    font-size: .82rem; text-transform: uppercase; letter-spacing: .05em;
    color: #999; margin-bottom: 12px;
}
.cn-facets { list-style: none; margin: 0; padding: 0; }
.cn-facets li { margin: 0; }
.cn-facet {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    border: 0;
    background: none;
    text-align: left;
    padding: .5rem .5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    color: #333;
}
.cn-facet:hover { background: #f5f5f5; }
.cn-facet.is-active { background: var(--primary, #f7a600); color: #fff; }
.cn-facet-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-facet-c { color: #aaa; font-size: .92rem; flex: none; }
.cn-facet.is-active .cn-facet-c { color: #fff; }
.cn-facet-all { color: var(--primary, #f7a600); font-weight: 600; }
.cn-price { padding: 4px 6px 0; }
/* Dual-Range-Slider im Morayne-Stil: Wert-Badges ueber den Griffen, dicke
   orange Fuellung, grosse weisse Griffe, Skala mit Ticks darunter. Zwei
   ueberlagerte range-Inputs, nur die Griffe sind klickbar. */
.cn-slider {
    position: relative;
    height: 22px;
    margin-top: 40px;   /* Platz fuer die Wert-Badges darueber */
}
.cn-slider-rail, .cn-slider-fill {
    position: absolute; top: 8px; height: 6px; border-radius: 3px;
}
.cn-slider-rail { left: 0; right: 0; background: #f2d9a8; }
.cn-slider-fill { background: var(--primary, #f7a600); }
.cn-slider-t {
    position: absolute; top: 0; left: 0; width: 100%; height: 22px; margin: 0;
    background: none; pointer-events: none;
    -webkit-appearance: none; appearance: none;
}
.cn-slider-t::-webkit-slider-runnable-track { height: 22px; background: none; border: 0; }
.cn-slider-t::-moz-range-track { height: 22px; background: none; border: 0; }
.cn-slider-t::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; pointer-events: auto;
    width: 22px; height: 22px; margin-top: 0; border-radius: 50%;
    background: #fff; border: 3px solid var(--primary, #f7a600); cursor: grab;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.cn-slider-t::-moz-range-thumb {
    pointer-events: auto; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; border: 3px solid var(--primary, #f7a600); cursor: grab;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
/* Wert-Badge ueber dem jeweiligen Griff, mit Pfeil nach unten */
.cn-badge {
    position: absolute; top: -34px; transform: translateX(-50%);
    background: var(--primary, #f7a600); color: #fff; font-weight: 700;
    font-size: .82rem; line-height: 1; padding: 6px 9px; border-radius: 6px;
    white-space: nowrap; pointer-events: none; z-index: 6;
}
.cn-badge::after {
    content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: var(--primary, #f7a600); border-bottom: 0;
}
/* Skala unter dem Slider: Ticks + drei Beschriftungen */
.cn-slider-ticks {
    display: flex; justify-content: space-between; margin: 6px 2px 2px;
}
.cn-slider-ticks span { width: 1px; height: 6px; background: #d0d0d0; }
.cn-slider-scale {
    display: flex; justify-content: space-between;
    font-size: .78rem; color: #999; margin-top: 2px;
}

.cn-modal-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.cn-modal-count { font-size: .95rem; color: #444; }
.cn-modal-sort {
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: .45rem .7rem;
    background: #fff;
    font-size: .95rem;
    cursor: pointer;
}

/* Produktgrid: breitenabhaengig, auf grossen Schirmen ~7 Spalten */
.cn-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 14px;
}
.cn-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #ececec;
    border-radius: 6px;
    padding: 12px;
    text-decoration: none;
    color: #222;
    background: #fff;
    transition: box-shadow .12s ease;
}
.cn-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
    text-decoration: none;
    color: #000;
}
.cn-card-imgwrap {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    margin-bottom: 10px;
    overflow: hidden;
}
.cn-card-imgwrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cn-card-name {
    font-weight: 700;
    font-size: .92rem;
    line-height: 1.35;
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cn-card-meta {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cn-card-price { font-weight: 700; font-size: 1.15rem; }
.cn-card-star { color: #888; font-weight: 400; }
/* Ampelfarben wie im Shop: 2 gruen (verfuegbar), 1 gelb (laengere Lieferzeit),
   0 rot (ausverkauft). Vorher war alles gruen — auch "Ausverkauft". */
.cn-card-avail { font-size: .82rem; color: #2e9b3d; }
.cn-card-avail.cn-avail-2 { color: #2e9b3d; }
.cn-card-avail.cn-avail-1 { color: #c8860a; }
.cn-card-avail.cn-avail-0 { color: #cc2b2b; }

/* Fusszeile */
.cn-modal-foot { margin-top: 20px; text-align: center; }
.cn-modal-all {
    border: 0;
    border-radius: 6px;
    background: var(--primary, #f7a600);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    padding: .7rem 1.6rem;
    cursor: pointer;
}
.cn-modal-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 2rem 0;
}

/* Mobil: Modal fuellt fast den Schirm, X innen */
@media (max-width: 767px) {
    .cn-modal-backdrop { padding: 10px; }
    .cn-modal { padding: 18px 14px 24px; border-radius: 8px; }
    .cn-modal-x { top: 8px; right: 8px; width: 38px; height: 38px; box-shadow: none; }
    .cn-modal-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    /* Gestapelt: erst Suchleiste+Ergebnisse, dann die Filter darunter */
    .cn-modal-body { flex-direction: column; gap: 14px; }
    .cn-modal-main { order: 1; }
    .cn-modal-side { order: 2; flex: none; width: 100%; }
    .cn-side-content { max-height: 340px; }
    .cn-modal-logo { height: 30px; margin-bottom: 12px; }
}
