/* ============================================================
   VendeeX Search Controls Panel
   Per-search operational settings (budget, returns, delivery, rules)
   ============================================================ */

/* Panel Container */
.search-controls-panel {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Header */
.search-controls__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f8f9fa, #f0f2f5);
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    user-select: none;
}

.search-controls__header:hover {
    background: linear-gradient(135deg, #f0f2f5, #e8ecf1);
}

.search-controls__header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-controls__icon {
    font-size: 18px;
}

.search-controls__title {
    font-weight: 700;
    color: #215274;
    font-size: 14px;
}

.search-controls__hint {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #e5e7eb;
    color: #6b7280;
}

.search-controls__toggle {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s ease;
}

.search-controls-panel--collapsed .search-controls__toggle {
    transform: rotate(-90deg);
}

/* Body */
.search-controls__body {
    padding: 16px 18px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.search-controls-panel--collapsed .search-controls__body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Field */
.search-controls__field {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.search-controls__field:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.search-controls__field:first-child {
    padding-top: 0;
}

.search-controls__field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-controls__field-text {
    flex: 1;
}

.search-controls__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
    line-height: 1.3;
}

.search-controls__field-row .search-controls__label {
    margin-bottom: 0;
}

.search-controls__avatar-hint {
    display: block;
    font-size: 11px;
    color: #2BB673;
    font-weight: 500;
    margin-top: 2px;
}

/* Budget input with currency prefix */
.search-controls__budget-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-controls__budget-wrap:focus-within {
    border-color: #215274;
    box-shadow: 0 0 0 2px rgba(33, 82, 116, 0.1);
}

.search-controls__currency {
    padding: 8px 10px;
    background: #f9fafb;
    color: #6b7280;
    font-weight: 700;
    font-size: 14px;
    border-right: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.search-controls__budget-wrap .search-controls__input {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
}

.search-controls__budget-wrap .search-controls__input:focus {
    box-shadow: none;
}

/* Input */
.search-controls__input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #374151;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.search-controls__input:focus {
    outline: none;
    border-color: #215274;
    box-shadow: 0 0 0 2px rgba(33, 82, 116, 0.1);
}

.search-controls__input::placeholder {
    color: #9ca3af;
}

/* Select */
.search-controls__select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #374151;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
    cursor: pointer;
}

.search-controls__select:focus {
    outline: none;
    border-color: #215274;
    box-shadow: 0 0 0 2px rgba(33, 82, 116, 0.1);
}

/* Toggle Switch */
.search-controls__switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}

.search-controls__switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.search-controls__slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 11px;
    transition: background 0.2s ease;
}

.search-controls__slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.search-controls__switch input:checked + .search-controls__slider {
    background: #2BB673;
}

.search-controls__switch input:checked + .search-controls__slider::after {
    transform: translateX(18px);
}

/* ============================================================
   Active Rules Summary Bar (shown above search results)
   ============================================================ */
.active-rules-bar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f9ff, #f0fdf4);
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #1f2937;
    line-height: 1.6;
}

.active-rules-bar__icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.active-rules-bar__text {
    flex: 1;
}

.active-rules-bar__label {
    font-weight: 700;
    color: #215274;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Avatar preference chips (soft) */
.active-rules-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    margin: 1px 2px;
    white-space: nowrap;
}

.active-rules-chip--avatar {
    background: #f0f9ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Search rule chips (strong) */
.active-rules-chip--search {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
    font-weight: 600;
}

/* ============================================================
   Excluded Merchants Section (in results)
   ============================================================ */
.excluded-merchants {
    margin-top: 24px;
    padding: 16px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
}

.excluded-merchants__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.excluded-merchants__header-icon {
    font-size: 16px;
}

.excluded-merchants__header-text {
    font-weight: 700;
    font-size: 14px;
    color: #991b1b;
}

.excluded-merchant {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #fee2e2;
}

.excluded-merchant:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.excluded-merchant__name {
    font-weight: 600;
    color: #dc2626;
    font-size: 13px;
    white-space: nowrap;
}

.excluded-merchant__reason {
    font-size: 13px;
    color: #7f1d1d;
    line-height: 1.4;
}

/* Skipped Merchants (not relevant to query) — neutral styling */
.excluded-merchants--skipped {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.excluded-merchants--skipped .excluded-merchants__header-text {
    color: #6b7280;
}

.excluded-merchants--skipped .excluded-merchant {
    border-bottom-color: #f3f4f6;
}

.excluded-merchants--skipped .excluded-merchant__name {
    color: #6b7280;
}

.excluded-merchants--skipped .excluded-merchant__reason {
    color: #9ca3af;
}

/* Policy Passed Badge (on product cards) */
.policy-passed-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .search-controls__body {
        padding: 12px 14px;
    }

    .search-controls__field-row {
        gap: 10px;
    }
}
