/* retoor <retoor@molodetz.nl> */

.reaction-bar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.reaction-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.reaction-list:not(:has(.reaction-chip:not([hidden]))) {
    display: none;
}

.reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.reaction-chip:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
}

.reaction-chip.reacted {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--text-primary);
}

.reaction-chip[disabled] {
    cursor: default;
}

.reaction-chip[hidden] {
    display: none;
}

.reaction-count {
    font-variant-numeric: tabular-nums;
    min-width: 0.75rem;
    text-align: center;
}

.reaction-add {
    position: relative;
}

.reaction-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: var(--radius);
    background: none;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s;
}

.reaction-add-btn:hover {
    color: var(--accent);
}

.reaction-add-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.reaction-add-label {
    font-weight: 500;
}

.reaction-palette {
    position: absolute;
    bottom: calc(100% + var(--space-xs));
    left: 0;
    z-index: 20;
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.reaction-palette[hidden] {
    display: none;
}

@media (max-width: 768px) {
    .reaction-palette {
        flex-wrap: wrap;
        justify-content: flex-start;
        max-width: calc(100vw - 2 * var(--space-md));
    }
}

.reaction-palette-btn {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem;
    border-radius: var(--radius);
}

.reaction-palette-btn:hover {
    background: var(--bg-card-hover);
}

.reaction-palette-more {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius);
}

.reaction-palette-more:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.reaction-picker {
    position: absolute;
    bottom: calc(100% + var(--space-xs));
    left: 0;
    z-index: var(--z-popover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.reaction-picker.below {
    top: calc(100% + var(--space-xs));
    bottom: auto;
}

.reaction-picker[hidden] {
    display: none;
}

.reaction-picker emoji-picker {
    display: block;
    width: 320px;
    height: 350px;
    max-width: calc(100vw - 2 * var(--space-md));
}

.bookmark-btn.bookmarked {
    color: var(--accent);
}

.poll {
    margin: var(--space-md) 0;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.poll-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.poll-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

.poll-option[disabled] {
    cursor: default;
}

.poll-option:not([disabled]):hover {
    border-color: var(--border-light);
}

.poll-option.chosen {
    border-color: var(--accent);
}

.poll-option.chosen .poll-option-label {
    font-weight: 600;
}

.poll-option-bar {
    position: absolute;
    inset: 0;
    width: var(--poll-pct, 0);
    background: rgba(var(--accent-rgb), 0.18);
    transition: width 0.3s ease;
    z-index: 0;
}

.poll-option.chosen .poll-option-bar {
    background: rgba(var(--accent-rgb), 0.32);
}

.poll-option-label {
    position: relative;
    z-index: 1;
}

.poll-option-meta {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
}

.poll-option-check {
    color: var(--accent);
    font-weight: 700;
}

.poll-option-pct {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.poll-total {
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.poll-builder {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-lg);
}

.poll-builder[hidden] {
    display: none;
}

.poll-builder-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.poll-builder-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.poll-builder-row input {
    flex: 1;
}

.poll-builder-remove {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.poll-builder-remove:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.poll-builder-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.8rem;
}

.saved-page {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.saved-title {
    margin-bottom: var(--space-lg);
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.saved-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.saved-item:hover {
    background: var(--bg-card-hover);
}

.saved-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-item-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}
