/* MrFiat Search Service — Customer-Facing Styles */
/* Matches Debut theme: Lato font, white bg, clean card grid */

.mrf-search-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 9998;
    display: none;
}
.mrf-search-overlay.active { display: block; }

/* ─── Predictive Dropdown ────────────────────────────── */

.mrf-suggest-dropdown {
    position: fixed;
    background: #fff;
    border: 1px solid #e8e8e1;
    border-top: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 10000;
    max-height: 520px;
    overflow-y: auto;
    display: none;
    font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
    min-width: 600px;
}
.mrf-suggest-dropdown.active { display: block; }

/* Two-column layout */
.mrf-suggest-columns {
    display: flex;
    min-height: 200px;
}

.mrf-suggest-left {
    flex: 0 0 45%;
    padding: 12px 0;
    border-right: 1px solid #e8e8e1;
}

.mrf-suggest-right {
    flex: 1;
    padding: 12px 16px;
}

.mrf-suggest-section {
    padding: 0 0 10px 0;
    margin-bottom: 6px;
}
.mrf-suggest-section:last-child { margin-bottom: 0; }

.mrf-suggest-heading {
    padding: 4px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
}
.mrf-suggest-right > .mrf-suggest-heading {
    padding-left: 0;
}

/* Query suggestions (left column) */
.mrf-suggest-query {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.mrf-suggest-query:hover { background: #f9f9f7; }
.mrf-suggest-query-icon {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

/* Category links (left column) */
.mrf-suggest-category {
    display: block;
    padding: 4px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.mrf-suggest-category:hover { background: #f9f9f7; color: #000; }

.mrf-suggest-more {
    display: block;
    padding: 4px 16px;
    font-size: 13px;
    color: #557b97;
    text-decoration: none;
    cursor: pointer;
}
.mrf-suggest-more:hover { text-decoration: underline; }

/* Product cards (right column) */
.mrf-suggest-products {
    display: flex;
    gap: 12px;
}

.mrf-suggest-product-card {
    flex: 1;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.15s;
}
.mrf-suggest-product-card:hover { opacity: 0.8; }

.mrf-suggest-product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid #e8e8e1;
    border-radius: 2px;
    margin-bottom: 6px;
}

.mrf-suggest-product-title {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 2px;
}

.mrf-suggest-product-price {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}

/* View all button */
.mrf-suggest-viewall {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    background: #333;
    border-top: 1px solid #e8e8e1;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.mrf-suggest-viewall:hover { background: #555; }

/* Responsive: collapse to single column on narrow screens */
@media (max-width: 640px) {
    .mrf-suggest-dropdown { min-width: 0; }
    .mrf-suggest-columns { flex-direction: column; }
    .mrf-suggest-left { flex: none; border-right: none; border-bottom: 1px solid #e8e8e1; }
    .mrf-suggest-products { flex-wrap: wrap; }
    .mrf-suggest-product-card { flex: 0 0 calc(33% - 8px); }
}

/* ─── Search Results Page ────────────────────────────── */

.mrf-results-container {
    display: flex;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 12px;
    font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
}

.mrf-results-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.mrf-results-main { flex: 1; min-width: 0; }

.mrf-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e8e1;
}

.mrf-results-count {
    font-size: 14px;
    color: #666;
}

.mrf-results-sort select {
    padding: 6px 10px;
    border: 1px solid #e8e8e1;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

/* Product Grid */
.mrf-product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
/* Kill any theme-inherited borders/lines on grid children */
.mrf-product-grid *,
.mrf-product-grid *::before,
.mrf-product-grid *::after {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
}

@media (max-width: 960px) {
    .mrf-product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .mrf-product-grid { grid-template-columns: repeat(2, 1fr); }
    .mrf-results-container { flex-direction: column; }

    /* Mobile filter drawer */
    .mrf-results-sidebar {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%;
        background: #fff;
        z-index: 9999;
        overflow-y: auto;
        padding: 16px;
        padding-top: 60px;
    }
    .mrf-results-sidebar.mrf-drawer-open { display: block; }
    .mrf-filter-toggle { display: flex!important; }
    .mrf-drawer-close { display: flex!important; }
}

@media (max-width: 480px) {
    .mrf-product-grid { grid-template-columns: 1fr; }
}

.mrf-product-card {
    background: #fff;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    overflow: hidden;
    transition: opacity 0.2s;
    text-decoration: none !important;
    color: inherit;
    display: flex;
    flex-direction: column;
}
.mrf-product-card:hover { opacity: 0.85; }

.mrf-product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: none !important;
}

.mrf-product-card-body {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mrf-product-card-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
    /* Reserve exactly 3 lines so all titles take same space */
    min-height: 3.9em; /* 3 lines × 1.3 line-height */
}

.mrf-product-card-vendor {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
    /* Fixed single line so vendor doesn't shift price */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mrf-product-card-price {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-top: auto;
}

.mrf-product-card-stock {
    font-size: 12px;
    margin-top: 4px;
}
.mrf-product-card-stock.in-stock { color: #4a8c4a; }
.mrf-product-card-stock.out-of-stock { color: #c44; }

.mrf-product-card-sku {
    font-size: 11px;
    color: #bbb;
    margin-top: 4px;
}

/* ─── Facets Sidebar ─────────────────────────────────── */

.mrf-facet-group {
    margin-bottom: 20px;
}

.mrf-facet-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e8e8e1;
}

.mrf-facet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
    color: #555;
    cursor: pointer;
}
.mrf-facet-item:hover { color: #333; background: #f9f9f7; }
.mrf-facet-item.active {
    color: #fff;
    background: #333;
    border-radius: 3px;
    padding: 3px 6px;
}
.mrf-facet-item.active .mrf-facet-count { color: #ccc; }
.mrf-facet-count {
    font-size: 11px;
    color: #999;
}
.mrf-facet-clear {
    font-size: 12px;
    color: #c44;
    cursor: pointer;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8e8e1;
}
.mrf-facet-clear:hover { text-decoration: underline; }

/* ─── Mobile filter toggle + drawer close (base: hidden) */
.mrf-filter-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}
.mrf-filter-toggle svg { width: 16px; height: 16px; }

.mrf-drawer-close {
    display: none;
    position: fixed;
    top: 12px; right: 16px;
    z-index: 10000;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ─── Pagination ─────────────────────────────────────── */

.mrf-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e8e8e1;
}

.mrf-pagination button {
    padding: 6px 12px;
    border: 1px solid #e8e8e1;
    background: #fff;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.mrf-pagination button:hover { background: #f9f9f7; }
.mrf-pagination button.active { background: #333; color: #fff; border-color: #333; }
.mrf-pagination button:disabled { opacity: 0.4; cursor: default; }

/* ─── No Results ─────────────────────────────────────── */

.mrf-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.mrf-no-results h3 { font-size: 20px; color: #666; margin-bottom: 8px; }
.mrf-no-results p { font-size: 14px; }
.mrf-suggestion-link {
    color: #557b97;
    cursor: pointer;
    text-decoration: underline;
}

/* ─── Collections in Results ─────────────────────────── */

.mrf-collection-matches {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f9f9f7;
    border: 1px solid #e8e8e1;
    border-radius: 4px;
}

.mrf-collection-matches h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    margin-bottom: 6px;
}

.mrf-collection-matches a {
    display: inline-block;
    margin-right: 16px;
    font-size: 14px;
    color: #557b97;
    text-decoration: none;
}
.mrf-collection-matches a:hover { text-decoration: underline; }

/* ─── Loading Spinner ────────────────────────────────── */

.mrf-loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.mrf-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e8e8e1;
    border-top-color: #333;
    border-radius: 50%;
    animation: mrf-spin 0.8s linear infinite;
}

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