{{define "parlvotesrows"}}
<div style="display: flex; align-items: center; gap: 24px; padding: 16px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 24px; flex-wrap: wrap;">
    <div>
        <div style="font-size: 28px; font-weight: 700; line-height: 1;">{{.TotalVotes}}</div>
        <div style="font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-top: 3px;">Abstimmungen</div>
    </div>
    <div style="width: 1px; height: 40px; background: var(--border);"></div>
    {{range .Parties}}
    <div style="display: flex; align-items: center; gap: 10px;">
        <span style="background: {{partyColor .Code}}; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em;">{{.Code}}</span>
        <div style="font-size: 12px; line-height: 1.6;">
            <div><span style="color: #16a34a; font-weight: 600;">{{.For}}×</span> <span style="color: var(--text-muted);">dafür</span></div>
            <div><span style="color: #dc2626; font-weight: 600;">{{.Against}}×</span> <span style="color: var(--text-muted);">dagegen</span></div>
        </div>
    </div>
    {{end}}
</div>
{{range .Groups}}
<details {{if .HasVotes}}open{{end}} style="margin-bottom: 12px;">
    <summary style="
        list-style: none;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 16px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        cursor: pointer;
        font-weight: 600;
        font-size: 14px;
        user-select: none;
    ">
        <span>{{.Label}}</span>
        <span style="font-size: 12px; font-weight: 400; color: var(--text-muted);">{{len .Docs}}</span>
    </summary>
    <div style="border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); background: var(--bg-card);" class="table-scroll">
        <table style="width: 100%; border-collapse: collapse; font-size: 14px;">
            <thead>
                <tr style="background: var(--bg); border-bottom: 1px solid var(--border);">
                    <th style="text-align: left; padding: 8px 16px; font-weight: 600; color: var(--text-muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;">Datum</th>
                    <th style="text-align: left; padding: 8px 16px; font-weight: 600; color: var(--text-muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;">Nr.</th>
                    <th style="text-align: left; padding: 8px 16px; font-weight: 600; color: var(--text-muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;">Betreff</th>
                    <th style="text-align: left; padding: 8px 16px; font-weight: 600; color: var(--text-muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;">Abstimmung</th>
                </tr>
            </thead>
            <tbody>
                {{range .Docs}}
                <tr style="border-bottom: 1px solid var(--border);">
                    <td style="padding: 10px 16px; color: var(--text-muted); white-space: nowrap; font-size: 13px;">{{.Date}}</td>
                    <td style="padding: 10px 16px; color: var(--text-muted); white-space: nowrap; font-size: 12px;">{{.Number}}</td>
                    <td style="padding: 10px 16px;">
                        {{if .RouteID}}
                        <a href="/parlament/{{.RouteID}}" style="color: var(--text); font-weight: 500; text-decoration: none;">{{.Title}}</a>
                        {{else}}
                        <span style="font-weight: 500;">{{.Title}}</span>
                        {{end}}
                        {{if .Topics}}
                        <div style="display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px;">
                            {{range .Topics}}
                            <span style="background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); padding: 1px 7px; border-radius: 99px; font-size: 11px;">{{.}}</span>
                            {{end}}
                        </div>
                        {{end}}
                    </td>
                    <td style="padding: 10px 16px;">
                        {{if or .VotesFor .VotesAgainst}}
                        <div style="display: flex; flex-direction: column; gap: 4px;">
                            {{if .VotesFor}}
                            <div style="display: flex; align-items: center; gap: 4px;">
                                <span style="font-size: 10px; font-weight: 600; color: #16a34a; text-transform: uppercase; letter-spacing: 0.05em; min-width: 42px;">Dafür</span>
                                {{range .VotesFor}}
                                <span style="background: {{partyColor .}}; color: #fff; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;">{{.}}</span>
                                {{end}}
                            </div>
                            {{end}}
                            {{if .VotesAgainst}}
                            <div style="display: flex; align-items: center; gap: 4px;">
                                <span style="font-size: 10px; font-weight: 600; color: #dc2626; text-transform: uppercase; letter-spacing: 0.05em; min-width: 42px;">Dagegen</span>
                                {{range .VotesAgainst}}
                                <span style="background: {{partyColor .}}; color: #fff; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; opacity: 0.75;">{{.}}</span>
                                {{end}}
                            </div>
                            {{end}}
                        </div>
                        {{else}}
                        <span style="color: var(--text-muted); font-size: 13px;">—</span>
                        {{end}}
                    </td>
                </tr>
                {{end}}
            </tbody>
        </table>
    </div>
</details>
{{end}}
{{end}}
