/*
 * See Match popup, gift ideas and shop buttons.
 * Markup: Users::generateSeeMatchElements(), Affiliate::giftIdeasHtml() / shopButtonsHtml().
 * Plain CSS (the LESS build is cached per theme version); enqueued with its mtime as version.
 * Theme colours: #1b1b1b (main), #3ec7c2 (accent), #6d6d6d (text).
 */

.mm-match {
    --mm-dark: #1b1b1b;
    --mm-accent: #3ec7c2;
    --mm-accent-dark: #2a9d99;
    --mm-accent-soft: rgba(62, 199, 194, .12);
    --mm-text: #6d6d6d;
    --mm-line: #ececec;
    --mm-radius: 14px;

    color: var(--mm-text);
    font-size: 16px;
    line-height: 1.45;
    text-align: left;
}

.mm-match *,
.mm-match *::before,
.mm-match *::after {
    box-sizing: border-box;
}

/* ---------- Header ---------- */

.mm-match__hero {
    text-align: center;
    padding: 4px 0 22px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--mm-line);
}

.mm-match__gift {
    width: 64px;
    height: auto;
    margin: 0 auto 10px;
    display: block;
}

.mm-match__eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--mm-accent-dark);
}

.mm-match__name {
    margin-top: 2px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--mm-dark);
    overflow-wrap: anywhere;
}

.mm-match__chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.mm-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--mm-accent-soft);
    color: var(--mm-dark);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.mm-chip svg,
.mm-chip i {
    color: var(--mm-accent-dark);
}

/* ---------- Sections ---------- */

.mm-sec {
    padding: 22px 0 6px;
}

.mm-sec + .mm-sec {
    border-top: 1px solid var(--mm-line);
}

.mm-match .mm-sec__title {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--mm-dark);
}

.mm-match .mm-sec__title span {
    color: var(--mm-accent);
    font-weight: 400;
}

.mm-match .mm-sec__title > svg,
.mm-match .mm-sec__title > i {
    width: 18px;
    margin-right: 8px;
    color: var(--mm-dark);
}

.mm-sec__count {
    margin-left: auto;
    min-width: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--mm-dark);
    color: #fff;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0;
    text-align: center;
}

.mm-sec__label {
    margin-bottom: 8px;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #aaa;
    text-align: center;
}

.mm-ad {
    text-align: center;
}

.mm-card {
    padding: 14px 16px;
    border: 1px solid var(--mm-line);
    border-radius: var(--mm-radius);
    background: #fafafa;
}

.mm-address {
    color: var(--mm-dark);
    font-size: 15px;
    overflow-wrap: anywhere;
}

.mm-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px dashed #d9d9d9;
    border-radius: var(--mm-radius);
    color: var(--mm-text);
    font-size: 14px;
}

.mm-empty p {
    margin: 0;
}

.mm-empty svg,
.mm-empty i {
    flex: 0 0 auto;
    font-size: 18px;
    color: #c4c4c4;
}

/* ---------- Wishlist ---------- */

.mm-match .mm-wish {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.mm-match .mm-wish__item {
    display: flex;
    gap: 12px;
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid var(--mm-line);
}

.mm-match .mm-wish__item:last-child {
    border-bottom: 0;
}

.mm-match .mm-wish__item::before {
    content: none;
}

.mm-wish__num {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--mm-dark);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.mm-wish__body {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 2px;
}

.mm-wish__text {
    color: var(--mm-dark);
    font-size: 16px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.mm-wish__text a {
    color: var(--mm-accent-dark);
    text-decoration: underline;
}

.mm-wish__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.mm-match a.mm-wish__link {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border: 1px solid var(--mm-dark);
    border-radius: 999px;
    background: #fff;
    color: var(--mm-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
    line-height: 1.2;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.mm-match a.mm-wish__link:hover,
.mm-match a.mm-wish__link:focus {
    background: var(--mm-dark);
    color: #fff;
}

/* ---------- Store pills ---------- */

.mm-store {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 92px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .3px;
    color: #fff !important;
    text-decoration: none !important;
    transition: transform .15s ease, box-shadow .15s ease;
}

.mm-store svg,
.mm-store i {
    font-size: 12px;
}

.mm-store--lazada { background: #0f146d; }
.mm-store--shopee { background: #ee4d2d; }

.mm-store:hover,
.mm-store:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
    color: #fff !important;
}

/* ---------- "Shop for <name>" strip ---------- */

.mm-shop {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: var(--mm-radius, 14px);
    background: rgba(62, 199, 194, .1);
    border: 1px solid rgba(62, 199, 194, .35);
}

.mm-shop__text {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mm-shop__text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #1b1b1b;
    line-height: 1.25;
}

.mm-shop__text small {
    display: block;
    font-size: 13px;
    color: #6d6d6d;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.mm-shop__icon,
.mm-gift__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #3ec7c2;
    color: #fff;
    font-size: 16px;
}

.mm-shop__btns,
.mm-gift__btns {
    display: flex;
    gap: 8px;
}

/* ---------- Gift ideas ---------- */

.mm-gifts__sub {
    margin: -6px 0 14px;
    font-size: 13px;
    color: #6d6d6d;
}

.mm-gifts__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.mm-gift {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid #ececec;
    border-radius: 14px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.mm-gift:hover {
    border-color: rgba(62, 199, 194, .6);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
}

.mm-gift__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.mm-gift__icon {
    width: 34px;
    height: 34px;
    font-size: 15px;
    background: rgba(62, 199, 194, .15);
    color: #2a9d99;
}

.mm-gift__label {
    font-size: 15px;
    font-weight: 700;
    color: #1b1b1b;
    line-height: 1.3;
}

.mm-gift__why {
    margin-top: 3px;
    font-size: 13px;
    color: #6d6d6d;
    line-height: 1.35;
}

.mm-gift__btns .mm-store {
    flex: 1 1 0;
    min-width: 0;
}

/* ---------- Comments ---------- */

.mm-match .mm-comments {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.mm-match .mm-comment {
    margin: 0 0 10px;
    padding: 12px 14px;
    border-radius: 4px var(--mm-radius) var(--mm-radius) var(--mm-radius);
    background: #f4f4f4;
}

.mm-match .mm-comment::before {
    content: none;
}

.mm-comment__text {
    color: var(--mm-dark);
    font-size: 15px;
    overflow-wrap: anywhere;
}

.mm-comment__date {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #9a9a9a;
}

/* ---------- Footer ---------- */

.mm-match__footer {
    margin-top: 10px;
    padding: 20px 0 4px;
    border-top: 1px solid var(--mm-line);
    text-align: center;
}

.mm-match__footer p {
    max-width: 420px;
    margin: 0 auto 10px;
    font-size: 14px;
    color: var(--mm-text);
}

.mm-match__footer p span {
    color: var(--mm-accent);
    font-weight: 700;
}

.mm-match__footer iframe {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

/* ---------- Members list (narrow columns) ---------- */

.card-body .mm-shop {
    margin: 0 0 16px;
}

/* ---------- Phones ---------- */

@media (max-width: 575px) {
    .mm-match__name {
        font-size: 26px;
    }

    .mm-shop__btns {
        width: 100%;
    }

    .mm-shop__btns .mm-store {
        flex: 1 1 0;
    }

    .mm-gifts__grid {
        grid-template-columns: 1fr;
    }

    /* Compact rows: name on the left, store buttons stacked on the right */
    .mm-gift {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
    }

    .mm-gift__head {
        flex: 1 1 auto;
        min-width: 0;
        align-items: center;
        gap: 10px;
    }

    .mm-gift__icon {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .mm-gift__btns {
        flex: 0 0 auto;
        flex-direction: column;
        gap: 6px;
    }

    .mm-gift__btns .mm-store {
        flex: 0 0 auto;
        width: 96px;
        padding: 7px 10px;
        font-size: 12px;
    }
}

/* ---------- Wishlist editor (Users::generateWishlistEditor) ---------- */

.mm-edit__hero {
    padding-top: 0;
}

.mm-edit__title {
    margin-top: 4px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--mm-dark);
}

.mm-edit__lead {
    max-width: 440px;
    margin: 6px auto 0;
    font-size: 14px;
    color: var(--mm-text);
}

.mm-sec__tag {
    margin-left: auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f1f1f1;
    color: #8a8a8a;
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: .5px;
}

.mm-match .mm-items {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

.mm-match .mm-item {
    margin: 0 0 12px;
    padding: 12px 14px 10px;
    border: 1px solid var(--mm-line);
    border-radius: var(--mm-radius);
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease, background .6s ease;
}

.mm-match .mm-item::before {
    content: none;
}

.mm-match .mm-item:focus-within {
    border-color: var(--mm-accent);
    box-shadow: 0 0 0 3px var(--mm-accent-soft);
}

.mm-match .mm-item.is-new {
    background: var(--mm-accent-soft);
}

.mm-match .mm-item.is-invalid {
    border-color: #e5484d;
}

#custom-popup .mm-match .mm-item.is-invalid textarea,
.mm-match .mm-item.is-invalid textarea {
    border-color: #e5484d;
}

.mm-item__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mm-item__label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--mm-dark);
}

.mm-item__head .mm-icon-btn {
    margin-left: auto;
}

/* Reset the theme's base form styles (elements/forms.less: centred grey text, 512px max width, 200px textareas) */
#custom-popup .mm-match textarea,
#custom-popup .mm-match input[type="url"],
.mm-match textarea,
.mm-match input[type="url"] {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 10px;
    background: #fff;
    color: var(--mm-dark);
    font-family: inherit;
    font-size: 16px; /* 16px stops iOS from zooming in */
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

#custom-popup .mm-match textarea,
.mm-match textarea {
    min-height: 74px; /* two lines */
    resize: none;
    overflow-y: hidden; /* grows with its content (Theme.js) */
    field-sizing: content;
}

#custom-popup .mm-match textarea[name="address"],
.mm-match textarea[name="address"] {
    min-height: 98px; /* three lines */
}

#custom-popup .mm-match textarea:focus,
#custom-popup .mm-match input[type="url"]:focus,
.mm-match textarea:focus,
.mm-match input[type="url"]:focus {
    border-color: var(--mm-accent);
    box-shadow: 0 0 0 3px var(--mm-accent-soft);
    color: var(--mm-dark);
    text-align: left;
}

.mm-match .mm-item:focus-within {
    box-shadow: none;
}

.mm-item__meta {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    font-size: 12px;
    color: #a8a8a8;
}

.mm-item__meta.is-near {
    color: #e08a00;
}

.mm-match textarea::placeholder,
.mm-match input::placeholder {
    color: #a8a8a8;
}

.mm-item__error {
    margin-top: 6px;
    font-size: 13px;
    color: #e5484d;
}

.mm-item__error:empty {
    display: none;
}

.mm-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.mm-links:empty {
    display: none;
}

.mm-link {
    display: flex;
    align-items: center;
    gap: 8px;
}

#custom-popup .mm-link input[type="url"],
.mm-link input[type="url"] {
    padding: 9px 12px;
    font-size: 15px;
}

#custom-popup .mm-link.is-invalid input[type="url"],
.mm-link.is-invalid input[type="url"] {
    border-color: #e5484d;
}

.mm-link__store {
    flex: 0 0 64px;
    padding: 5px 0;
    border-radius: 999px;
    background: #f1f1f1;
    color: #8a8a8a;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.mm-link__store[data-store="lazada"] { background: #0f146d; color: #fff; }
.mm-link__store[data-store="shopee"] { background: #ee4d2d; color: #fff; }

.mm-item__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin-top: 8px;
}

.mm-item__find {
    font-size: 12px;
    color: var(--mm-text);
}

.mm-item__find[hidden] {
    display: none;
}

.mm-match a.mm-find {
    margin-left: 4px;
    font-weight: 700;
    text-decoration: none;
}

.mm-match a.mm-find--lazada { color: #0f146d; }
.mm-match a.mm-find--shopee { color: #ee4d2d; }
.mm-match a.mm-find:hover { text-decoration: underline; }

/* Buttons */
.mm-match .mm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: none;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
}

.mm-match .mm-btn:disabled {
    opacity: .6;
    cursor: default;
}

.mm-match .mm-btn--primary {
    background: var(--mm-dark);
    color: #fff;
}

.mm-match .mm-btn--primary:hover:not(:disabled) {
    background: var(--mm-accent-dark);
}

.mm-match .mm-btn--ghost {
    border-color: #d6d6d6;
    color: var(--mm-dark);
    background: #fff;
}

.mm-match .mm-btn--ghost:hover {
    border-color: var(--mm-dark);
}

.mm-match .mm-btn--block {
    width: 100%;
    border-style: dashed;
}

.mm-match .mm-btn--add {
    min-height: 34px;
    padding: 7px 14px;
    background: var(--mm-accent-soft);
    color: var(--mm-accent-dark);
    font-size: 13px;
}

.mm-match .mm-btn--add:hover {
    background: var(--mm-accent);
    color: #fff;
}

.mm-match .mm-btn--add.is-added {
    background: #f1f1f1;
    color: #8a8a8a;
}

.mm-match .mm-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--mm-accent-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.mm-match .mm-btn-text:hover {
    text-decoration: underline;
}

.mm-match .mm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: #9a9a9a;
    cursor: pointer;
}

.mm-match .mm-icon-btn:hover {
    background: #fdecec;
    color: #e5484d;
}

/* Suggestions */
.mm-suggest__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.mm-suggest__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--mm-line);
    border-radius: 12px;
}

.mm-suggest__item .mm-gift__icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.mm-suggest__text {
    flex: 1 1 auto;
    min-width: 0;
}

.mm-suggest__stores {
    margin-top: 2px;
    font-size: 12px;
}

.mm-match a.mm-suggest__store {
    margin-right: 8px;
    color: var(--mm-text);
    font-weight: 600;
    text-decoration: underline;
}

.mm-match a.mm-suggest__store:hover {
    color: var(--mm-dark);
}

/* Address */
.mm-field {
    display: block;
    margin: 0 0 12px;
}

.mm-field__hint {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--mm-text);
}

/* Sticky footer with Save */
.mm-edit__footer {
    position: sticky;
    bottom: -25px; /* sits over the popup's bottom padding */
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 8px -15px -25px;
    padding: 12px 15px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--mm-line);
    background: rgba(255, 255, 255, .96);
}

.mm-edit__status {
    margin-right: auto;
    font-size: 13px;
    font-weight: 600;
}

.mm-edit__status[data-type="error"] { color: #e5484d; }
.mm-edit__status[data-type="ok"] { color: var(--mm-accent-dark); }
.mm-edit__status[data-type="busy"] { color: var(--mm-text); }

@media (max-width: 575px) {
    .mm-suggest__grid {
        grid-template-columns: 1fr;
    }

    .mm-edit__status {
        flex: 1 1 100%;
        margin: 0;
        text-align: center;
    }

    .mm-edit__status:empty {
        display: none;
    }

    .mm-edit__footer .mm-btn {
        flex: 1 1 0;
    }
}

/* Hidden for 24h after an affiliate click (assets/js/Theme.js initAffiliateCap) */
.aff-recent .aff-cta-optional {
    display: none;
}
