/* [chatbot_directory]: filter sidebar, platform cards, compare tray.
   Shortcode: shortcodes/chatbot_directory.php. Everything is scoped to .cbd
   (the directory) or .cbd-card (one platform card, also used on its own). */

/* The colours are set on .cbd (the directory) and on .cbd-card, so a card also
   works on its own outside the directory: the [verdict] box on review pages
   (verdict() in functions.php) is one .cbd-card. The sticky bar on reviews
   (review_sticky_bar() in functions.php) uses the card's stars and Visit
   button, so it gets the colours too. */
.cbd, .cbd-card, .review-sticky-bar {
    --cbd-blue: #1187ee;
    --cbd-blue-soft: #e8f2fd;
    --cbd-green: #00b341;
    --cbd-green-dark: #009636;
    --cbd-go: #0bcc24;      /* Visit button */
    --cbd-go-dark: #209702; /* its bottom edge */
    --cbd-star: #f5b301;
    --cbd-red: #d64545;
    --cbd-fg: #1d2733;
    --cbd-muted: #5f6d7c;
    --cbd-line: #e1e7ef;
    --cbd-panel: #f5f8fc;
    --cbd-card: #ffffff;
    --cbd-head: "Montserrat",sans-serif;
    color: var(--cbd-fg);
    font-size: 15px;
    line-height: 1.6;
}

.cbd {
    display: grid;
    grid-template-columns: 300px minmax(0,1fr);
    gap: 28px;
    align-items: start;
    padding-bottom: var(--cbd-tray-h, 0px);
}

.cbd [hidden] {
    display: none !important;
}

:is(.cbd, .cbd-card) :is(h2, h3, h4) {
    font-family: var(--cbd-head);
    margin: 0;
    line-height: 1.25;
}

:is(.cbd, .cbd-card) .cbd-muted {
    color: var(--cbd-muted);
}

.cbd .cbd-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--cbd-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.cbd .cbd-filters {
    background: var(--cbd-panel);
    border: 1px solid var(--cbd-line);
    border-radius: 12px;
    padding: 18px 8px 18px 16px;
    /* room for the scrollbar is kept free even when there's nothing to
       scroll, so opening a group (and getting a scrollbar) doesn't make the
       filters narrower and wrap their labels */
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    position: sticky;
    top: 46px; /* below the site's sticky top bar (30px) */
    /* --cbd-tray-h: height of the compare tray, set by the script while it's open */
    max-height: calc(100vh - 62px - var(--cbd-tray-h, 0px));
    overflow: auto;
}

.cbd .cbd-f-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.cbd .cbd-f-head h2 {
    font-size: 18px;
}

.cbd .cbd-fsec {
    border-top: 1px solid var(--cbd-line);
    padding: 14px 0 6px;
}

.cbd .cbd-fsec h3 {
    font-size: 14px;
    margin-bottom: 8px;
}

.cbd .cbd-opt {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: 14px;
    padding: 3px 0;
    cursor: pointer;
    margin: 0;
}

.cbd .cbd-opt input {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    accent-color: var(--cbd-blue);
    flex: none;
}

.cbd .cbd-n {
    margin-left: auto;
    /* fixed width, so a label doesn't wrap or unwrap when its count goes from 9 to 10 */
    flex: 0 0 2.2em;
    text-align: right;
    color: var(--cbd-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.cbd .cbd-range {
    padding: 2px 0 4px;
}

/* the star in "4.5\2605 and up" (slider label and chip): same gold as the card stars */
.cbd .cbd-star-ic {
    color: var(--cbd-star);
}

.cbd .cbd-range-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.cbd .cbd-range input[type="range"] {
    width: 100%;
    margin: 6px 0 0;
    accent-color: var(--cbd-blue);
    cursor: pointer;
}

.cbd .cbd-sub {
    margin: 4px 0 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cbd-muted);
}

.cbd .cbd-more-btn {
    width: 100%;
    margin-top: 12px;
    background: var(--cbd-card);
    border: 1px solid var(--cbd-line);
    border-radius: 8px;
    padding: 9px;
    font-family: var(--cbd-head);
    font-size: 14px;
    font-weight: 700;
    color: var(--cbd-fg);
    cursor: pointer;
}

.cbd .cbd-grp {
    border-top: 1px solid var(--cbd-line);
    padding: 10px 0;
}

.cbd .cbd-grp summary {
    font-family: var(--cbd-head);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cbd .cbd-grp summary::-webkit-details-marker {
    display: none;
}

.cbd .cbd-grp summary::after {
    /* chevron drawn with two borders: points down when closed, up when open */
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    margin: -4px 4px 0 0;
    border-right: 2px solid var(--cbd-muted);
    border-bottom: 2px solid var(--cbd-muted);
    transform: rotate(45deg);
    transition: transform .15s ease;
}

.cbd .cbd-grp[open] summary::after {
    content: "";
    margin-top: 4px;
    transform: rotate(-135deg);
}

@media (prefers-reduced-motion: reduce) {
    .cbd .cbd-grp summary::after {
        transition: none;
    }
}

.cbd .cbd-grp-opts {
    padding-top: 6px;
}

.cbd .cbd-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    justify-content: space-between;
}

.cbd .cbd-count {
    font-family: var(--cbd-head);
    font-size: 16px;
    font-weight: 700;
}

.cbd .cbd-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0;
    font-size: 14px;
}

.cbd .cbd-quick-btn {
    background: var(--cbd-panel);
    color: var(--cbd-blue);
    border: 1px solid var(--cbd-line);
    border-radius: 99px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

.cbd .cbd-quick-btn:hover {
    border-color: var(--cbd-blue);
}

.cbd .cbd-quick-btn.is-on {
    background: var(--cbd-blue);
    border-color: var(--cbd-blue);
    color: #fff;
}

.cbd .cbd-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 auto;
    font-size: 14px;
    color: var(--cbd-muted);
}

.cbd .cbd-sort-select {
    background: var(--cbd-card);
    color: var(--cbd-fg);
    border: 1px solid var(--cbd-line);
    border-radius: 8px;
    height: 32px;
    padding: 0 5px;
    line-height: normal;
    font-size: 14px;
    font-weight: 600;
    min-height: 0;
    width: auto;
    cursor: pointer;
}

.cbd .cbd-results {
    display: grid;
    gap: 14px; /* same space above and below the chips */
}

.cbd .cbd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

.cbd .cbd-chips:empty {
    display: none;
}

.cbd .cbd-chip {
    background: var(--cbd-blue-soft);
    color: var(--cbd-blue);
    border: 0;
    border-radius: 99px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.cbd .cbd-chip::after {
    content: " \00d7";
}

.cbd .cbd-list {
    display: grid;
    gap: 16px;
}

.cbd-card {
    background: var(--cbd-card);
    border: 1px solid var(--cbd-line);
    border-radius: 12px;
    overflow: hidden;
}

.cbd-card .cbd-top {
    display: grid;
    grid-template-columns: 76px minmax(0,1fr) auto;
    gap: 16px;
    padding: 18px 20px 14px;
    align-items: start;
}

/* The logo fills its 76px box and starts at the top, on the same line as the
   name. Its corners are rounded like the buttons. */
.cbd-card .cbd-logo {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: start center;
    overflow: hidden;
}

.cbd-card .cbd-logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.cbd-card .cbd-initial {
    font-family: var(--cbd-head);
    font-size: 28px;
    font-weight: 700;
    color: var(--cbd-blue);
}

.cbd-card .cbd-name {
    font-family: var(--cbd-head);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
}

.cbd-card .cbd-name a {
    color: var(--cbd-fg);
    text-decoration: none;
}

.cbd-card .cbd-name a:hover {
    color: var(--cbd-blue);
}

.cbd-card .cbd-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    margin-top: 3px;
}

.cbd-card .cbd-rating b {
    font-family: var(--cbd-head);
}

/* Five stars drawn as one SVG shape, filled up to --cbd-fill (the rating).
   A shape, not the ★ character: each browser draws that character with a
   different fallback font, so it sat lower than the number in some.
   --cbd-stars-h: the height of one star (20px; smaller in the sticky bar). */
:is(.cbd-card, .review-sticky-bar) .cbd-stars {
    --h: var(--cbd-stars-h, 20px);
    flex: none;
    width: calc(var(--h) * 5.65); /* 5 stars with 15% of a star between */
    height: var(--h);
    background: linear-gradient(90deg, var(--cbd-star) var(--cbd-fill), var(--cbd-line) 0);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 23.1 20'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z'/%3E%3C/svg%3E") 0 0 / calc(var(--h) * 1.15) var(--h) repeat-x;
}

.cbd-card .cbd-facts {
    display: grid;
    gap: 2px;
    margin-top: 5px;
    font-size: 14px;
}

.cbd-card .cbd-facts strong {
    font-weight: 600;
}

.cbd-card .cbd-badge {
    background: var(--cbd-blue-soft);
    color: var(--cbd-blue);
    border-radius: 99px;
    padding: 1px 9px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 2px;
    white-space: nowrap;
}

.cbd-card .cbd-cta {
    display: grid;
    gap: 8px;
    min-width: 170px;
    max-width: 230px; /* a longer line under the button (the discount on a review) wraps instead of widening the column */
}

:is(.cbd, .cbd-card, .review-sticky-bar) .cbd-btn {
    display: block;
    text-align: center;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: var(--cbd-head);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: 0;
}

:is(.cbd-card, .review-sticky-bar) .cbd-go {
    background: var(--cbd-go);
    color: #fff;
    border-bottom: 3px solid var(--cbd-go-dark);
}

:is(.cbd-card, .review-sticky-bar) .cbd-go:hover {
    /* on hover the button takes the colour of its bottom edge */
    background: var(--cbd-go-dark);
    color: #fff;
}

.cbd-card .cbd-rev {
    border: 1.5px solid var(--cbd-blue);
    color: var(--cbd-blue);
    background: transparent;
}

.cbd-card .cbd-rev:hover {
    background: var(--cbd-blue-soft);
    color: var(--cbd-blue);
}

.cbd-card .cbd-body {
    display: grid;
    gap: 14px;
    padding: 14px 20px 16px;
    border-top: 1px solid var(--cbd-line);
}

/* Our Verdict / Pros / Cons, in the site's heading colour (--color-dark, set
   in style.css). h4 in the comparison list; h2 and h3 in the [verdict] box,
   where review pages colour headings with #main #content-wrap, hence the
   !important. */
.cbd-card .cbd-body :is(h2, h3, h4) {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-dark, var(--cbd-fg)) !important;
}

.cbd-card .cbd-verdict {
    font-size: 16px;
}

.cbd-card .cbd-verdict p {
    margin: 0 0 8px;
}

.cbd-card .cbd-verdict.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cbd-card .cbd-verdict.is-clamped p {
    display: inline;
}

.cbd-card .cbd-verdict.is-clamped p+p::before {
    content: " ";
}

.cbd-card .cbd-toggle {
    background: none;
    border: 0;
    padding: 0;
    margin-top: 4px;
    color: var(--cbd-blue);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.cbd-card .cbd-pcs {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    gap: 22px;
}

.cbd-card .cbd-pc {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
    font-size: 15px;
}

.cbd-card .cbd-pc li {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px;
    margin: 0;
}

/* Pros: green circle with a white check. Cons: grey circle with a white
   cross, so a con doesn't shout. The same icons as Yes / No in the criteria
   tables (shortcodes/assets/css/style.css, .fa-check / .fa-times). */
.cbd-card .cbd-pro li::before,
.cbd-card .cbd-con li::before {
    content: "";
    width: 18px;
    height: 18px;
    margin-top: 2px;
    background-repeat: no-repeat;
    background-size: contain;
}

.cbd-card .cbd-pro li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%2322c55e'/%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%23ffffff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.cbd-card .cbd-con li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%23c7c7d1'/%3E%3Cpath d='M7 7l6 6M13 7l-6 6' fill='none' stroke='%23ffffff' stroke-width='1.9' stroke-linecap='round'/%3E%3C/svg%3E");
}

.cbd-card .cbd-foot {
    padding: 12px 20px;
    background: var(--cbd-panel);
    border-top: 1px solid var(--cbd-line);
    font-size: 14px;
}

.cbd-card .cbd-cmp {
    display: inline-flex;
    gap: 9px;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
}

.cbd-card .cbd-cmp input {
    width: 18px;
    height: 18px;
    accent-color: var(--cbd-blue);
    margin: 0;
}

.cbd .cbd-empty {
    padding: 30px;
    text-align: center;
    border: 1px dashed var(--cbd-line);
    border-radius: 12px;
    color: var(--cbd-muted);
}

.cbd .cbd-tray {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cbd-card);
    border-top: 1px solid var(--cbd-line);
    box-shadow: 0 -6px 24px rgba(0,0,0,.08);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom,0px));
    z-index: 999;
}

.cbd .cbd-tray-in {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    justify-content: center;
}

.cbd .cbd-slots {
    display: flex;
    gap: 10px;
}

.cbd .cbd-slot {
    width: 60px;
    height: 60px;
    border: 1px solid var(--cbd-line);
    border-radius: 8px;
    display: grid;
    place-items: center;
    position: relative;
    background: #fff;
}

.cbd .cbd-slot img {
    max-width: 46px;
    max-height: 46px;
    width: auto;
    height: auto;
}

.cbd .cbd-slot span {
    font-family: var(--cbd-head);
    font-size: 20px;
    font-weight: 700;
    color: var(--cbd-blue);
}

.cbd .cbd-x {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 0;
    background: var(--cbd-fg);
    color: #fff;
    font-size: 12px;
    line-height: 20px;
    cursor: pointer;
    padding: 0;
}

.cbd .cbd-now {
    background: var(--cbd-blue);
    color: #fff;
    padding: 12px 22px;
    font-size: 15px;
}

.cbd .cbd-now[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

.cbd .cbd-hint {
    color: var(--cbd-muted);
    font-size: 13px;
}

.cbd .cbd-open-filters,.cbd .cbd-drawer-close {
    display: none;
}

:is(.cbd, .cbd-card) :focus-visible {
    outline: 2px solid var(--cbd-blue);
    outline-offset: 2px;
}

@media only screen and (max-width: 900px) {
    .cbd {
        grid-template-columns: 1fr;
    }

    .cbd .cbd-filters {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        border-radius: 0;
        max-height: none;
    }

    .cbd .cbd-filters.is-open {
        display: block;
    }

    .cbd .cbd-drawer-close {
        display: block;
        width: 100%;
        margin-top: 14px;
        position: sticky;
        bottom: 0;
        box-shadow: 0 -8px 16px var(--cbd-panel);
    }

    .cbd .cbd-open-filters {
        display: inline-block;
        background: var(--cbd-blue);
        color: #fff;
        padding: 8px 14px;
    }

    .cbd-card .cbd-top {
        grid-template-columns: 60px minmax(0,1fr);
    }

    .cbd-card .cbd-logo {
        width: 60px;
        height: 60px;
    }

    /* Phone: the buttons under the card, full width, one under the other */
    .cbd-card .cbd-cta {
        grid-column: 1/-1;
        min-width: 0;
        max-width: none;
    }

    .cbd .cbd-tray-in {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .cbd .cbd-slots {
        gap: 6px;
    }

    .cbd .cbd-slot {
        width: 44px;
        height: 44px;
    }

    .cbd .cbd-slot img {
        max-width: 34px;
        max-height: 34px;
    }

    .cbd .cbd-hint {
        display: none;
    }

    .cbd .cbd-now {
        padding: 10px 14px;
        font-size: 14px;
        white-space: nowrap;
    }

    .cbd .cbd-tray-clear {
        white-space: nowrap;
    }

    .cbd-card .cbd-pcs {
        grid-template-columns: 1fr;
        gap: 14px; /* the same as between the verdict and Pros */
    }
}

/* The theme's validate-checkout-fields.js gives every input with a value the
   class is-valid (green border + check icon, for form fields). Checkboxes and
   sliders always have a value, so cancel that look inside the directory. */
.cbd input.is-valid,
.cbd input.is-valid:focus {
    background-image: none !important;
}

/* keep the theme's normal checkbox border (OceanWP: 1px #bbbbbb) */
.cbd input[type="checkbox"].is-valid,
.cbd input[type="checkbox"].is-valid:focus {
    border: 1px solid #bbbbbb !important;
}

.cbd input[type="range"].is-valid,
.cbd input[type="range"].is-valid:focus {
    border: none !important;
}
