/* =========================================================
   SEARCH OFFER CARDS
   Matches the current Best Offers card layout.
   ========================================================= */

.search-coupons-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.search-page .search-offer-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 18px;
    border: 1px solid #e2e5e9;
    border-color: #e5e7eb;
    box-shadow: none;
    border-radius: 12px;
    background: #ffffff;
    box-sizing: border-box;
    transition:
        transform .18s ease,
        border-color .18s ease,
        box-shadow .18s ease;
}

.search-page .search-offer-card:hover {
    transform: translateY(-2px);
    border-color: #d1d5db;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.07);
}

.search-page .search-offer-card .deal-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 31px;
}

.search-page .search-offer-card .deal-card-header > div:first-child {
    display: flex !important;
    align-items: center;
    gap: 6px !important;
    flex-wrap: wrap;
}

.search-page .search-offer-card .deal-type {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid #dfe3e8;
    border-radius: 6px;
    background: #f5f6f7;
    color: #344054;
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .05em;
    box-sizing: border-box;
}

.search-page .search-offer-card .deal-discount {
    flex: 0 0 auto;
    color: #f97316;
    font-size: 19px;
    line-height: 1.2;
    font-weight: 800;
    white-space: nowrap;
    text-align: right;
}

.search-page .search-offer-card .deal-store {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 108px;
    margin: 12px 0 10px;
    color: inherit;
    text-decoration: none;
}

.search-page .search-offer-card .deal-store-logo {
    width: 82px;
    height: 82px;
    flex: 0 0 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #edf0f2;
    border-radius: 10px;
    background: #ffffff;
}

.search-page .search-offer-card .deal-store-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.search-page .search-offer-card .deal-store-logo-placeholder {
    color: #777777;
    font-size: 24px;
    font-weight: 800;
}

.search-page .search-offer-card .deal-store-name {
    min-width: 0;
    color: #7b8490;
    font-size: 13px;
    line-height: 1.3;
}

.search-page .search-offer-card .deal-title {
    margin: 2px 0 8px;
    color: #111827;
    font-size: 16px;
    line-height: 1.45;
    font-weight: 800;
}

.search-page .search-offer-card .deal-description {
    display: none;
}

.search-page .search-offer-card .deal-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #eef0f2;
    color: #737b86;
    font-size: 12px;
    line-height: 1.4;
}

.search-page .search-offer-card .deal-card-action {
    margin-top: 13px;
}

.search-page .search-offer-card .deal-get-button {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border: 1px solid #f97316;
    border-radius: 8px;
    background: #ffffff;
    color: #f97316;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 800;
    cursor: pointer;
    box-sizing: border-box;
    transition:
        background .18s ease,
        color .18s ease,
        border-color .18s ease;
}

.search-page .search-offer-card .deal-get-button:hover {
    background: #f97316;
    border-color: #f97316;
    color: #ffffff;
}

.search-page .search-offer-card .deal-get-button:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .search-coupons-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {

    .search-coupons-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .search-page .search-offer-card {
        padding: 16px;
    }

    .search-page .search-offer-card .deal-store {
        min-height: 88px;
    }

    .search-page .search-offer-card .deal-store-logo {
        width: 68px;
        height: 68px;
        flex-basis: 68px;
    }

    .search-page .search-offer-card .deal-discount {
        font-size: 17px;
    }
}

/* =========================================================
   SEARCH STEP 3 - OFFER FILTERS
   ========================================================= */


.search-offer-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.search-offer-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 15px;
    border: 1px solid #f97316;
    border-radius: 18px;
    background: #ffffff;
    color: #f97316;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    box-sizing: border-box;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}


/* Hover: light orange for inactive filters */
.search-offer-filter:hover:not(.active) {
    background: #fff7ed;
    color: #ea580c;
    border-color: #f97316;
    text-decoration: none;
}

/* Active filter: solid orange */
.search-offer-filter.active,
.search-offer-filter.active:hover {
    background: #f97316;
    color: #ffffff;
    border-color: #f97316;
    text-decoration: none;
}


.search-filter-empty {
    padding: 28px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    color: #6b7280;
    text-align: center;
    font-size: 14px;
}

@media (max-width: 600px) {
    .search-offer-filters {
        gap: 7px;
    }

    .search-offer-filter {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* =========================================================
   SEARCH OFFER POPUP
   Matches the unified Offer Popup used across customer pages.
   ========================================================= */

.offer-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.offer-popup.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.offer-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .62);
}

.offer-popup-dialog {
    position: relative;
    z-index: 1;
    width: min(92%, 560px);
    max-height: min(88vh, 680px);
    overflow-y: auto;
    padding: 22px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .22);
}

.offer-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.offer-popup-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.offer-popup-close:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

.offer-popup-loading {
    padding: 34px 10px;
    color: #64748b;
    text-align: center;
    font-size: 13px;
}

.offer-popup-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-right: 38px;
}

.offer-popup-type {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 5px;
    background: #f1f5f9;
    color: #475569;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
}

.offer-popup-discount {
    flex: 0 0 auto;
    color: #f97316;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    text-align: right;
}

.offer-popup-dialog h2 {
    margin: 10px 38px 7px 0;
    color: #0f172a;
    font-size: 21px;
    line-height: 1.3;
}

.offer-popup-store {
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.offer-popup-description {
    margin-top: 12px;
    color: #475569;
    font-size: 13px;
    line-height: 1.6;
}

.offer-popup-section {
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid #eef0f2;
}

.offer-popup-section-title {
    margin-bottom: 4px;
    color: #334155;
    font-size: 11px;
    font-weight: 800;
}

.offer-popup-section-text {
    color: #64748b;
    font-size: 12px;
    line-height: 1.55;
}

.offer-popup-expiry {
    margin-top: 13px;
    color: #94a3b8;
    font-size: 11px;
}

.offer-popup-code-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 16px;
}

.offer-popup-code {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border: 1px dashed #f97316;
    border-radius: 8px;
    background: #fff8f2;
    color: #1e293b;
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.offer-popup-copy,
.offer-popup-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #f97316;
    border-radius: 8px;
    background: #f97316;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.offer-popup-copy:hover,
.offer-popup-action:hover {
    border-color: #ea580c;
    background: #ea580c;
    color: #fff;
}

.offer-popup-copy:focus-visible,
.offer-popup-action:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

.offer-popup-action {
    width: 100%;
    margin-top: 12px;
}

.offer-popup-error {
    padding: 24px 8px;
    color: #b42318;
    text-align: center;
    font-size: 13px;
}

@media (max-width: 600px) {
    .offer-popup-dialog {
        width: calc(100% - 24px);
        max-height: 90vh;
        padding: 20px 16px;
        border-radius: 12px;
    }

    .offer-popup-head {
        gap: 10px;
    }

    .offer-popup-discount {
        font-size: 16px;
    }

    .offer-popup-dialog h2 {
        font-size: 19px;
    }

    .offer-popup-code-wrap {
        grid-template-columns: 1fr;
    }

    .offer-popup-copy {
        width: 100%;
    }
}

/* =========================================================
   SEARCH PAGE
   White + Orange Theme
   ========================================================= */

.search-page {
    margin-bottom: 50px;
}


/* =========================================================
   BREADCRUMB
   ========================================================= */

.search-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
    color: #6b7280;
    font-size: 13px;
}

.search-breadcrumb a {
    color: #f97316;
    font-weight: 600;
    text-decoration: none;
}

.search-breadcrumb a:hover {
    color: #ea580c;
    text-decoration: underline;
}

.search-breadcrumb span {
    color: #9ca3af;
}


/* =========================================================
   SEARCH HEADER
   ========================================================= */

.search-page-header {
    margin-bottom: 38px;
    padding: 30px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
}

.search-page-header h1 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 30px;
    line-height: 1.25;
}

.search-page-header > p {
    margin: 0 0 22px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}


/* =========================================================
   SEARCH FORM
   ========================================================= */

.search-page-form {
    width: 100%;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    max-width: 750px;
    min-height: 54px;
    padding: 5px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(17, 24, 39, 0.05);
}

.search-input-wrapper:focus-within {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.10);
}

.search-input-wrapper input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 15px;
    box-sizing: border-box;
    border: 0;
    outline: none;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
}

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

.search-input-wrapper button {
    flex: 0 0 auto;
    min-width: 105px;
    height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 6px;
    background: #f97316;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-input-wrapper button:hover {
    background: #ea580c;
}


/* =========================================================
   RESULTS HEADER
   ========================================================= */

.search-results-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.search-results-header h2 {
    margin: 0 0 5px;
    color: #111827;
    font-size: 24px;
    line-height: 1.3;
}

.search-results-header p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.search-results-header p strong {
    color: #374151;
}

.search-results-count {
    flex: 0 0 auto;
    padding: 8px 13px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    color: #f97316;
    font-size: 12px;
    font-weight: 800;
}


/* =========================================================
   RESULT SECTIONS
   ========================================================= */

.search-results-section {
    margin-bottom: 42px;
}

.search-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}

.search-section-heading h2 {
    margin: 0;
    color: #111827;
    font-size: 21px;
    line-height: 1.3;
}

.search-section-heading > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 27px;
    height: 27px;
    padding: 0 7px;
    box-sizing: border-box;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 50%;
    color: #f97316;
    font-size: 11px;
    font-weight: 800;
}


/* =========================================================
   SEARCH STORES
   ========================================================= */

.search-stores-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.search-store-card {
    min-width: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.search-store-card:hover {
    transform: translateY(-3px);
    border-color: #f97316;
    box-shadow: 0 7px 20px rgba(249, 115, 22, 0.10);
}

.search-store-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 15px;
    box-sizing: border-box;
    color: inherit;
    text-decoration: none;
}

.search-store-link:hover {
    color: inherit;
    text-decoration: none;
}

.search-store-logo {
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    padding: 7px;
    box-sizing: border-box;
    background: #f9fafb;
    border-radius: 7px;
}

.search-store-logo img {
    max-width: 115px;
    max-height: 48px;
    object-fit: contain;
}

.search-store-logo span {
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.search-store-link h3 {
    margin: 0 0 6px;
    color: #111827;
    font-size: 15px;
    line-height: 1.35;
}

.search-store-link:hover h3 {
    color: #f97316;
}

.search-store-link p {
    display: -webkit-box;
    display: box;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    margin: 0 0 12px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.search-store-action {
    display: block;
    margin-top: auto;
    padding-top: 11px;
    border-top: 1px solid #f0f0f0;
    color: #f97316;
    font-size: 12px;
    font-weight: 700;
}


/* =========================================================
   SEARCH COUPONS
   ========================================================= */

.search-coupon-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-coupon-category {
    display: inline-block;
    width: fit-content;
    margin-bottom: 10px;
    padding: 4px 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
}


/* =========================================================
   SEARCH DEALS
   ========================================================= */

.search-deals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.search-deal-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-deal-card .deal-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.search-deal-card .deal-type {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 4px 8px;
    box-sizing: border-box;
    background: #f3f4f6;
    border-radius: 5px;
    color: #6b7280;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.search-deal-card .deal-discount {
    color: #f97316;
    font-size: 15px;
    font-weight: 800;
}

.search-deal-card .deal-store-link {
    display: inline-block;
    width: fit-content;
    margin: 12px 0 8px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.search-deal-card .deal-store-link:hover {
    color: #f97316;
}

.search-deal-card .deal-title {
    margin: 0 0 9px;
    font-size: 17px;
    line-height: 1.4;
}

.search-deal-card .deal-title a {
    color: #111827;
    text-decoration: none;
}

.search-deal-card .deal-title a:hover {
    color: #f97316;
}

.search-deal-card .deal-description {
    display: -webkit-box;
    display: box;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    margin: 0 0 13px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

.search-deal-card .deal-meta {
    margin-top: auto;
    margin-bottom: 14px;
    color: #9ca3af;
    font-size: 12px;
}

.search-deal-card .deal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-deal-card .deal-get-button,
.search-deal-card .deal-view-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    box-sizing: border-box;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.search-deal-card .deal-get-button {
    flex: 1;
    background: #f97316;
    border: 1px solid #f97316;
    color: #ffffff;
}

.search-deal-card .deal-get-button:hover {
    background: #ea580c;
    border-color: #ea580c;
    color: #ffffff;
}

.search-deal-card .deal-view-link {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
}

.search-deal-card .deal-view-link:hover {
    border-color: #f97316;
    color: #f97316;
}


/* =========================================================
   EMPTY / INITIAL STATE
   ========================================================= */

.search-empty-state,
.search-initial-state {
    padding: 55px 25px;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.search-empty-icon {
    margin-bottom: 12px;
    font-size: 30px;
}

.search-empty-state h2,
.search-initial-state h2 {
    margin: 0 0 9px;
    color: #111827;
    font-size: 22px;
}

.search-empty-state p,
.search-initial-state p {
    margin: 0 0 7px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

.search-empty-state strong {
    color: #374151;
}

.search-empty-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    min-height: 38px;
    padding: 9px 16px;
    box-sizing: border-box;
    background: #f97316;
    border: 1px solid #f97316;
    border-radius: 6px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.search-empty-button:hover {
    background: #ea580c;
    border-color: #ea580c;
    color: #ffffff;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1000px) {

    .search-stores-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .search-coupons-grid,
    .search-deals-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}


@media (max-width: 750px) {

    .search-page-header {
        padding: 24px;
    }

    .search-stores-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}


@media (max-width: 600px) {

    .search-results-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-coupons-grid,
    .search-deals-grid {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 500px) {

    .search-page-header {
        padding: 20px 16px;
    }

    .search-page-header h1 {
        font-size: 25px;
    }

    .search-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        padding: 6px;
    }

    .search-input-wrapper input {
        width: 100%;
    }

    .search-input-wrapper button {
        width: 100%;
    }

    .search-stores-grid {
        grid-template-columns: 1fr;
    }

    .search-results-section {
        margin-bottom: 35px;
    }

}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.search-breadcrumb a:focus-visible,
.search-input-wrapper button:focus-visible,
.search-offer-filter:focus-visible,
.search-store-link:focus-visible,
.search-offer-card .deal-primary-action:focus-visible,
.search-deal-card .deal-get-button:focus-visible,
.search-deal-card .deal-view-link:focus-visible,
.search-empty-button:focus-visible,
.offer-popup-close:focus-visible,
.offer-popup-copy:focus-visible,
.offer-popup-action:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}
