/**
 * Typesense Search Styles for MyPilotStore
 *
 * Combines Doofinder's 3-column grid with Findify's reviews/descriptions.
 * Color scheme matches MPS site (blue titles, teal buttons).
 */

/* ==========================================================================
   Layout
   ========================================================================== */

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 8px 0;
    border-bottom: 1px solid #e8e8e8;
}

.results-header #stats {
    font-size: 13px;
    color: #555;
}

.results-header #stats strong {
    color: #222;
    font-weight: 600;
}

.search-layout {
    display: flex;
    gap: 30px;
}

.search-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.search-results {
    flex: 1;
    min-width: 0;
}

/* Mobile: Stack sidebar above results */
@media (max-width: 992px) {
    .search-layout {
        flex-direction: column;
    }

    .search-sidebar {
        width: 100%;
        order: 1;
    }

    .search-results {
        order: 2;
    }
}

/* ==========================================================================
   Facets / Filters (Left Sidebar)
   ========================================================================== */

.facet-section {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.facet-section:last-of-type {
    border-bottom: none;
}

.facet-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Collapsible arrow indicator */
.facet-section h4::after {
    content: "^";
    font-size: 13px;
    color: #888;
    font-weight: 400;
}

/* Brand/Category search input */
.ais-RefinementList-searchBox {
    margin-bottom: 8px;
}

.ais-RefinementList-searchBox form {
    display: flex;
    position: relative;
}

.ais-RefinementList-searchBox .ais-SearchBox-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    height: 28px;
    box-sizing: border-box;
}

.ais-RefinementList-searchBox .ais-SearchBox-submit,
.ais-RefinementList-searchBox .ais-SearchBox-reset,
.ais-RefinementList-searchBox .ais-SearchBox-loadingIndicator {
    display: none;
}

.ais-SearchBox-form {
    margin: 0;
    padding: 0;
}

/* Refinement list items */
.ais-RefinementList-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: none;
    overflow: visible;
}

.ais-RefinementList-item {
    margin-bottom: 9px;
}

.ais-RefinementList-item:first-child {
    margin-top: 0;
}

.ais-RefinementList-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: #444;
}

.ais-RefinementList-label:hover {
    color: #0066a1;
}

.ais-RefinementList-item--selected .ais-RefinementList-label {
    color: #0066a1;
    font-weight: 600;
}

.ais-RefinementList-checkbox {
    margin-right: 9px;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.ais-RefinementList-labelText {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 165px;
}

.ais-RefinementList-count {
    margin-left: 8px;
    color: #999;
    font-size: 12px;
}

/* Remove default parentheses */
.ais-RefinementList-count::before,
.ais-RefinementList-count::after {
    content: "";
}

/* Show more / View more button */
.ais-RefinementList-showMore {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 0;
    margin-top: 6px;
    display: block;
    width: 100%;
    text-align: right;
}

.ais-RefinementList-showMore:hover {
    color: #0066a1;
}

.ais-RefinementList-showMore--disabled {
    display: none;
}

/* Price range slider - noUiSlider (InstantSearch.js v4) */
.ais-RangeSlider {
    padding: 15px 4px 42px;
}

/* Track */
.ais-RangeSlider .noUi-target {
    background: #e0e0e0;
    border: none;
    border-radius: 3px;
    box-shadow: none;
    height: 5px;
}

/* Filled portion between handles */
.ais-RangeSlider .noUi-connect {
    background: #3a7ca5;
    border-radius: 3px;
}

/* Handles */
.ais-RangeSlider .noUi-handle {
    background: white;
    border: 2.5px solid #3a7ca5;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    top: -8px;
    right: -10px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Remove default noUiSlider handle lines */
.ais-RangeSlider .noUi-handle::before,
.ais-RangeSlider .noUi-handle::after {
    display: none;
}

.ais-RangeSlider .noUi-handle:hover {
    border-color: #2d6180;
    box-shadow: 0 1px 8px rgba(0,0,0,0.25);
}

.ais-RangeSlider .noUi-handle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(58,124,165,0.2);
}

/* Tooltips (price badges above handles) */
.ais-RangeSlider .noUi-tooltip {
    background: #3a7ca5;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    bottom: 28px;
    white-space: nowrap;
}

/* Downward arrow on tooltip */
.ais-RangeSlider .noUi-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #3a7ca5;
}

/* Pip labels below track ($4 / $667 / $1,329) */
.ais-RangeSlider .noUi-pips {
    padding: 10px 0 0;
    height: auto;
}

.ais-RangeSlider .noUi-value {
    color: #888;
    font-size: 11px;
}

/* Show tick marks only at labeled positions */
.ais-RangeSlider .noUi-marker {
    background: #ccc;
    width: 1px;
    height: 6px;
}

/* In stock toggle */
.ais-ToggleRefinement-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: #444;
}

.ais-ToggleRefinement-checkbox {
    margin-right: 8px;
}

/* Clear filters button */
.ais-ClearRefinements-button {
    width: 100%;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    font-size: 13px;
    margin-top: 10px;
}

.ais-ClearRefinements-button:hover {
    background: #eee;
}

.ais-ClearRefinements-button--disabled {
    display: none;
}

/* Current refinements (active filter pills) */
.ais-CurrentRefinements {
    margin-bottom: 15px;
}

.ais-CurrentRefinements-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-CurrentRefinements-item {
    display: flex;
    align-items: center;
}

.ais-CurrentRefinements-category {
    display: flex;
    align-items: center;
    background: #e6f2ff;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.ais-CurrentRefinements-delete {
    background: none;
    border: none;
    color: #0066a1;
    cursor: pointer;
    margin-left: 6px;
    font-size: 14px;
    line-height: 1;
}

/* ==========================================================================
   Stats & Sort Header
   ========================================================================== */

#sort-by {
    display: flex;
    align-items: center;
    gap: 6px;
}

#sort-by::before {
    content: "Sorted by:";
    color: #555;
    font-size: 13px;
    white-space: nowrap;
}

#sort-by .ais-SortBy {
    position: relative;
}

#sort-by .ais-SortBy::after {
    content: "▼";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: #555;
    pointer-events: none;
}

#sort-by .ais-SortBy-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 4px 28px 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    color: #333;
    cursor: pointer;
    min-width: 130px;
}

/* ==========================================================================
   Product Cards (Hits) - 3 Column Grid
   ========================================================================== */

.ais-Hits-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 2 columns on tablet */
@media (max-width: 992px) {
    .ais-Hits-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 1 column on mobile */
@media (max-width: 576px) {
    .ais-Hits-list {
        grid-template-columns: 1fr;
    }
}

.ais-Hits-item {
    padding: 0;
}

.product-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.product-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-image {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-title {
    font-size: 14px;
    font-weight: 500;
    color: #0066a1;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title:hover {
    color: #004d7a;
    text-decoration: underline;
}

.product-title mark {
    background: #fff3cd;
    color: #0066a1;
    padding: 0 2px;
}

/* Reviews (like Findify) */
.reviews {
    font-size: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reviews i {
    color: #000;
}

.reviews span {
    color: #666;
    font-size: 11px;
}

/* Short description (like Findify) */
.product-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Pricing */
.product-price {
    margin-bottom: 0;
}

.price {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.price-was {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    display: block;
    margin-bottom: 2px;
}

.price-was::before {
    content: "List Price: ";
}

.price-now {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

/* See Details button (like Doofinder) */
.btn-see-details {
    display: block;
    width: 100%;
    padding: 12px;
    background: #3a7ca5;
    color: white;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-see-details:hover {
    background: #2d6180;
    color: white;
}

/* Inline link-style button (used in zero-results "clear filters" message) */
.link-btn {
    background: none;
    border: none;
    color: #0066a1;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
}

/* ==========================================================================
   No Results
   ========================================================================== */

.no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    grid-column: 1 / -1;
}

.no-results h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 10px;
}

.no-results p {
    color: #666;
    font-size: 14px;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.ais-Pagination {
    margin-top: 30px;
}

.ais-Pagination-list {
    display: flex;
    justify-content: center;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-Pagination-item {
    display: flex;
}

.ais-Pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.ais-Pagination-link:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.ais-Pagination-item--selected .ais-Pagination-link {
    background: #3a7ca5;
    border-color: #3a7ca5;
    color: white;
}

.ais-Pagination-item--disabled .ais-Pagination-link {
    color: #ccc;
    cursor: not-allowed;
}

.ais-Pagination-item--disabled .ais-Pagination-link:hover {
    background: white;
    border-color: #ddd;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.hidden {
    display: none !important;
}

/* Make product card relative for badge positioning and overflow visible only on blog/support/badge cards */
.card-blog,
.card-support,
.product-card.has-badge {
    position: relative;
    overflow: visible !important;
}

/* Ensure top image container rounds top corners since card overflow is visible on blog/support/badge cards */
.card-blog .product-image,
.card-support .product-image,
.product-card.has-badge .product-image {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    overflow: hidden;
}

/* ==========================================================================
   Blog and Support Cards Styles
   ========================================================================== */

.card-blog {
    border-color: #bee5eb;
    background-color: #fcfcfd;
}

.card-support {
    border-color: #c3e6cb;
    background-color: #fcfdfc;
}

.btn-blog {
    background: #17a2b8;
}

.btn-blog:hover {
    background: #138496;
}

.btn-support {
    background: #28a745;
}

.btn-support:hover {
    background: #218838;
}

.support-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2f0d9;
    height: 180px;
    position: relative;
    border-bottom: 1px solid #eee;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    overflow: hidden;
}

.support-icon {
    width: 64px;
    height: 64px;
    color: #28a745;
}

/* Offer Ribbon Badge (Folded Ribbon) styles - renamed to avoid conflicts with global .offer-btn */
.mps-ribbon-badge {
    position: absolute;
    left: 0px;
    top: -10px;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    padding: 0px 15px;
    min-height: 25px;
    line-height: 25px;
    min-width: 80px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.mps-ribbon-badge span {
    display: block;
    color: #fff;
}

/* CSS-only swallow-tail ribbon notch on the right */
.mps-ribbon-badge span:after {
    content: "";
    position: absolute;
    right: -10px;
    top: 0;
    width: 0;
    height: 0;
    border-top: 12.5px solid transparent;
    border-bottom: 12.5px solid transparent;
    border-right: 10px solid transparent;
    border-left: 0;
}

/* Folded shadow corner on bottom-left */
.mps-ribbon-badge span:before {
    content: "";
    position: absolute;
    left: -15px; /* offsets the padding of .mps-ribbon-badge */
    bottom: -10px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-left: 10px solid transparent;
}

/* Color Modifiers */
.mps-ribbon-badge--blog {
    background: #17a2b8; /* teal */
}
.mps-ribbon-badge--blog span:after {
    border-top-color: #17a2b8;
    border-bottom-color: #17a2b8;
}
.mps-ribbon-badge--blog span:before {
    border-top-color: #117a8b;
}

.mps-ribbon-badge--support {
    background: #54b852; /* standard green */
}
.mps-ribbon-badge--support span:after {
    border-top-color: #54b852;
    border-bottom-color: #54b852;
}
.mps-ribbon-badge--support span:before {
    border-top-color: #3b7946;
}

.mps-ribbon-badge--webflag {
    background: #54b852; /* standard green */
}
.mps-ribbon-badge--webflag span:after {
    border-top-color: #54b852;
    border-bottom-color: #54b852;
}
.mps-ribbon-badge--webflag span:before {
    border-top-color: #3b7946;
}



