.brew-finder-wrapper,
.brew-finder-wrapper * {
    box-sizing: border-box;
}

.brew-finder-wrapper {
    --primary-color: #111827;
    --accent-blue: #2563eb;
    --accent-green: #157f5b;
    --accent-red: #c2415d;
    --card-border: #e5e7eb;
    --text-dark: #111827;
    --text-muted: #667085;
    --surface: #ffffff;
    --surface-hover: #f5f8ff;
    --ring: rgba(37, 99, 235, 0.2);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow-md: 0 10px 24px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 18px 42px rgba(16, 24, 40, 0.12);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 42px 24px 56px;
    color: var(--text-dark);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: 0;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.06), transparent 30rem),
        linear-gradient(180deg, #ffffff 0%, #f7f8fb 100%);
    border-radius: 28px;
    overflow: hidden;
}

.brew-finder-header {
    max-width: 720px;
    margin: 0 auto 34px;
    text-align: center;
    animation: brewFadeUp 420ms var(--ease-out) both;
}

.brew-finder-header h2 {
    margin: 0 0 10px;
    color: var(--primary-color);
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.02;
}

.brew-finder-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 1.04rem;
    line-height: 1.6;
}

.category-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin: 0 auto 22px;
    animation: brewFadeUp 500ms var(--ease-out) both;
}

.tab-btn {
    display: none;
    min-height: 112px;
    padding: 16px;
    color: var(--primary-color);
    text-align: left;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), background 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.tab-btn:hover {
    transform: translateY(-3px);
    background: #ffffff;
    border-color: rgba(37, 99, 235, 0.24);
    box-shadow: var(--shadow-md);
}

.tab-btn.active {
    background: #ffffff;
    border-color: rgba(17, 24, 39, 0.24);
    box-shadow: 0 14px 30px rgba(16, 24, 40, 0.12);
}

.tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 34px;
    margin-bottom: 14px;
    padding: 0 10px;
    color: #344054;
    background: #f2f4f7;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
}

.tab-title {
    display: block;
    color: #101828;
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
}

.tab-count {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 650;
}

.flavor-section {
    margin-bottom: 26px;
    padding: 26px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
    animation: brewFadeUp 580ms var(--ease-out) both;
}

.flavor-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.flavor-section h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 800;
}

.clear-btn {
    padding: 7px 12px;
    color: var(--accent-red);
    font-weight: 700;
    background: #fff5f6;
    border: 1px solid rgba(194, 65, 93, 0.16);
    border-radius: 999px;
    cursor: pointer;
    transition: transform 180ms var(--ease-out), background 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.clear-btn:hover {
    transform: translateY(-1px);
    background: #ffe9ed;
    box-shadow: var(--shadow-sm);
}

.flavor-tools {
    display: grid;
    gap: 14px;
    margin-bottom: 20px;
}

.flavor-search {
    width: 100%;
    padding: 14px 16px;
    color: var(--text-dark);
    font: inherit;
    background: var(--surface);
    border: 1px solid #d0d5dd;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.flavor-search::placeholder {
    color: #98a2b3;
}

.flavor-search:hover {
    border-color: #b8c1d1;
}

.flavor-chip:focus,
.tab-btn:focus,
.clear-btn:focus,
.selected-flavor-pill:focus,
.flavor-search:focus {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

.selected-flavors-bar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.selected-flavors-bar.visible {
    display: flex;
}

.selected-flavor-pill {
    padding: 7px 12px;
    color: #027a48;
    font-weight: 700;
    background: #ecfdf5;
    border: 1px solid rgba(2, 122, 72, 0.18);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(2, 122, 72, 0.08);
    cursor: pointer;
    transition: transform 180ms var(--ease-out), background 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.selected-flavor-pill:hover {
    transform: translateY(-1px);
    background: #d1fadf;
    box-shadow: var(--shadow-sm);
}

.flavor-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 268px;
    padding: 2px 4px 4px 2px;
    overflow-y: auto;
    scrollbar-color: #cbd5e1 transparent;
}

.flavor-chip {
    padding: 8px 14px;
    color: #344054;
    font-size: 0.88rem;
    font-weight: 650;
    background: var(--surface);
    border: 1px solid #d9e0ea;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    cursor: pointer;
    user-select: none;
    transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.flavor-chip:hover {
    transform: translateY(-1px);
    background: var(--surface-hover);
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: var(--shadow-sm);
}

.flavor-chip.selected {
    color: #ffffff;
    font-weight: 800;
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.2);
}

.results-status {
    margin: 0 0 18px;
    color: #344054;
    font-size: 1rem;
    font-weight: 750;
    animation: brewFadeUp 660ms var(--ease-out) both;
}

.drinks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    animation: brewFadeUp 720ms var(--ease-out) both;
}

.drink-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 248px;
    padding: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
    transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out), border-color 220ms var(--ease-out);
}

.drink-card::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
    content: "";
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), transparent 42%);
    opacity: 0;
    transition: opacity 220ms var(--ease-out);
}

.drink-card:hover {
    transform: translateY(-4px);
    border-color: rgba(37, 99, 235, 0.22);
    box-shadow: var(--shadow-lg);
}

.drink-card:hover::before {
    opacity: 1;
}

.card-header-tags {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.drink-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.category-badge {
    padding: 5px 9px;
    color: #475467;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #f2f4f7;
    border: 1px solid #eaecf0;
    border-radius: 999px;
}

.match-badge,
.seasonal-badge,
.sugar-free-badge {
    padding: 5px 9px;
    color: #b54708;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
    background: #fffaeb;
    border: 1px solid #fedf89;
    border-radius: 999px;
}

.seasonal-badge {
    color: #9d174d;
    background: #fdf2f8;
    border-color: #fbcfe8;
}

.sugar-free-badge {
    color: #027a48;
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.drink-title {
    position: relative;
    margin: 0 0 10px;
    color: var(--primary-color);
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.25;
}

.drink-desc {
    position: relative;
    flex-grow: 1;
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.drink-meta {
    position: relative;
    display: grid;
    gap: 10px;
    padding-top: 12px;
    color: #475467;
    font-size: 0.88rem;
    line-height: 1.5;
    border-top: 1px solid #eef2f6;
}

.drink-meta strong {
    display: block;
    margin-bottom: 2px;
    color: var(--primary-color);
}

.flavor-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.flavor-mini-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    color: #344054;
    font-size: 0.78rem;
    font-weight: 650;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 44px;
    color: var(--text-muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px dashed #cbd5e1;
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
}

@keyframes brewFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .brew-finder-wrapper *,
    .brew-finder-wrapper *::before,
    .brew-finder-wrapper *::after {
        animation-duration: 1ms !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}

@media (min-width: 641px) and (max-width: 980px) {
    .category-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .brew-finder-wrapper {
        padding: 28px 14px 42px;
        border-radius: 20px;
    }

    .brew-finder-header {
        text-align: left;
    }

    .category-tabs {
        grid-template-columns: 1fr;
    }

    .tab-btn {
        min-height: 88px;
        padding: 14px;
    }

    .flavor-section {
        padding: 18px;
        border-radius: 20px;
    }

    .flavor-section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .drinks-grid {
        grid-template-columns: 1fr;
    }

    .card-header-tags {
        align-items: flex-start;
        flex-direction: column;
    }

    .drink-badges {
        justify-content: flex-start;
    }
}
