/* ============================================
   Match My Ingredients — styles
   ============================================ */

.match-page {
    padding: 2rem 1rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}
.match-page__inner {
    max-width: 900px;
    margin: 0 auto;
}

/* Hero */
.match-hero {
    text-align: center;
    margin-bottom: 2rem;
}
.match-hero__title {
    font-family: 'Playfair Display', serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text, #1a1a1a);
    margin: 0 0 0.5rem;
}
.match-hero__subtitle {
    font-size: 1.05rem;
    color: var(--text-muted, #666);
    margin: 0;
}

/* Input Section */
.match-input-section {
    margin-bottom: 1.5rem;
}
.match-input-wrap {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    background: var(--card-bg, #fff);
    border: 2px solid var(--border, #e0d5c7);
    border-radius: 14px;
    padding: 0.5rem 0.75rem;
    min-height: 52px;
    transition: border-color 0.2s;
}
.match-input-wrap:focus-within {
    border-color: var(--accent, #d4a853);
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}
.match-input {
    flex: 1;
    min-width: 140px;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    color: var(--text, #1a1a1a);
    padding: 0.35rem 0.25rem;
}
.match-input::placeholder {
    color: var(--text-muted, #999);
}

/* Selected Ingredient Pills */
.match-pills {
    display: contents;
}
.match-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--accent, #d4a853);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.3rem 0.55rem 0.3rem 0.7rem;
    border-radius: 20px;
    white-space: nowrap;
    animation: pillIn 0.2s ease;
}
@keyframes pillIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.match-pill__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: rgba(255,255,255,0.25);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}
.match-pill__remove:hover {
    background: rgba(255,255,255,0.45);
}

/* Autocomplete Dropdown */
.match-autocomplete {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #ddd);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 200;
    max-height: 380px;
    overflow-y: auto;
}
.match-autocomplete--active {
    display: block;
}
.match-ac-category {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #888);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-top: 1px solid var(--border, #f0f0f0);
}
.match-ac-category:first-child {
    border-top: none;
}
.match-ac-category__emoji {
    font-size: 1.1rem;
}
.match-ac-item {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem 0.55rem 2.25rem;
    cursor: pointer;
    transition: background 0.12s;
    font-size: 0.95rem;
    color: var(--text, #333);
}
.match-ac-item:hover,
.match-ac-item--active {
    background: var(--card-hover-bg, #fdf8f3);
}
.match-ac-item mark {
    background: rgba(212, 168, 83, 0.25);
    color: inherit;
    padding: 0;
    border-radius: 2px;
}

/* Popular Suggestions */
.match-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.match-suggestions__label {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    font-weight: 500;
}
.match-suggestions__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.match-suggestion-tag {
    border: 1px dashed var(--border, #e0d5c7);
    background: transparent;
    color: var(--text-muted, #888);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    opacity: 0.7;
}
.match-suggestion-tag:hover {
    background: var(--accent, #d4a853);
    color: #fff;
    border-color: var(--accent, #d4a853);
}

/* Results Info */
.match-results-info {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-muted, #666);
    font-weight: 500;
}
.match-results-info span {
    font-weight: 700;
    color: var(--text, #333);
}

/* Results Grid */
.match-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* Recipe Card */
.match-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg, #fff);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    text-decoration: none;
    color: var(--text, #333);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: cardIn 0.3s ease;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.match-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.1);
}

/* Match percentage bar */
.match-card__match-bar-wrap {
    position: relative;
    height: 26px;
    background: var(--badge-bg, #f0ebe4);
    display: flex;
    align-items: center;
}
.match-card__match-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #d4a853), #e8c36a);
    border-radius: 0;
    transition: width 0.4s ease;
    min-width: 2px;
}
.match-card__match-label {
    position: absolute;
    right: 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text, #333);
}

/* Image */
.match-card__image-wrap {
    position: relative;
    height: 160px;
    overflow: hidden;
    background: var(--placeholder-bg, #f5f0ea);
}
.match-card__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.match-card__no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 3rem;
    background: var(--placeholder-bg, #f5f0ea);
}
.match-card__cuisine-badge {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* Card Body */
.match-card__body {
    padding: 0.85rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.match-card__name {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.15rem;
    line-height: 1.3;
}
.match-card__english {
    font-size: 0.82rem;
    color: var(--text-muted, #888);
    margin: 0 0 0.5rem;
}
.match-card__missing {
    margin-top: auto;
    padding-top: 0.5rem;
}
.match-card__missing-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted, #999);
    margin-bottom: 0.25rem;
}
.match-card__missing-list {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    line-height: 1.45;
}
.match-card__meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted, #888);
}

/* Empty / Loading / No Results States */
.match-empty,
.match-no-results {
    text-align: center;
    padding: 3rem 1rem;
}
.match-empty__icon {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
}
.match-empty__text {
    font-size: 1.1rem;
    color: var(--text, #333);
    margin: 0 0 0.35rem;
    font-weight: 500;
}
.match-empty__hint {
    font-size: 0.9rem;
    color: var(--text-muted, #888);
    margin: 0;
}
.match-loading {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted, #888);
}
.match-loading__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border, #e0d5c7);
    border-top-color: var(--accent, #d4a853);
    border-radius: 50%;
    animation: matchSpin 0.7s linear infinite;
    margin: 0 auto 0.75rem;
}
@keyframes matchSpin {
    to { transform: rotate(360deg); }
}

/* Footer link */
.match-footer {
    text-align: center;
    margin-top: 2.5rem;
}
.match-footer__link {
    color: var(--accent, #d4a853);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.15s;
}
.match-footer__link:hover {
    color: var(--accent-hover, #c49840);
    text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .match-hero__title {
        font-size: 1.6rem;
    }
    .match-results {
        grid-template-columns: 1fr;
    }
    .match-card__image-wrap {
        height: 140px;
    }
}
